[glsl] Convert `select` to `mix` instead of ternary.
The current GLSL IR and AST backends translate the `select` builtin to a
ternary condition. This isn't correct as in WGSL both branches need to
be evaluated all of the time while in GLSL only the selected branch of
a ternary is evaluated.
This Cl converts the `select` calls to a `mix` call. In the case of a
WGSL select with vector values and a scalar boolean condition the scalar
boolean is splatted into a vector of correct size.
Bug: 367066331
Change-Id: Ibe2bd5a3aabd29a108831e3ed4469eb40c490278
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/208194
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/glsl/builtin_fn.cc b/src/tint/lang/glsl/builtin_fn.cc
index 09492c5..5f2f55f 100644
--- a/src/tint/lang/glsl/builtin_fn.cc
+++ b/src/tint/lang/glsl/builtin_fn.cc
@@ -80,6 +80,8 @@
return "all";
case BuiltinFn::kDot:
return "dot";
+ case BuiltinFn::kMix:
+ return "mix";
case BuiltinFn::kModf:
return "modf";
case BuiltinFn::kFrexp:
diff --git a/src/tint/lang/glsl/builtin_fn.h b/src/tint/lang/glsl/builtin_fn.h
index a4416d9..83216f5 100644
--- a/src/tint/lang/glsl/builtin_fn.h
+++ b/src/tint/lang/glsl/builtin_fn.h
@@ -66,6 +66,7 @@
kAny,
kAll,
kDot,
+ kMix,
kModf,
kFrexp,
kTextureSize,
diff --git a/src/tint/lang/glsl/glsl.def b/src/tint/lang/glsl/glsl.def
index 7b7826b..c3c1e28 100644
--- a/src/tint/lang/glsl/glsl.def
+++ b/src/tint/lang/glsl/glsl.def
@@ -79,6 +79,7 @@
// Type matchers //
////////////////////////////////////////////////////////////////////////////////
+match scalar: f32 | f16 | i32 | u32 | bool
match iu32: i32 | u32
match fiu32: f32 | i32 | u32
match fi32_f16: f32 | i32 | f16
@@ -175,6 +176,9 @@
implicit(N: num) fn all(vec<N, bool>) -> bool
implicit(T: f32_f16, N: num) fn dot(vec<N, T>, vec<N, T>) -> T
+@must_use implicit(T: scalar) fn mix(T, T, bool) -> T
+@must_use implicit(N: num, T: scalar) fn mix(vec<N, T>, vec<N, T>, vec<N, bool>) -> vec<N, T>
+
@must_use @const implicit(T: f32_f16) fn modf(value: T, result: ptr<function, T, read_write>) -> T
@must_use @const implicit(N: num, T: f32_f16) fn modf(value: vec<N, T>,
result: ptr<function, vec<N, T>, read_write>) -> vec<N, T>
diff --git a/src/tint/lang/glsl/intrinsic/data.cc b/src/tint/lang/glsl/intrinsic/data.cc
index 2945a37..7d2dcac 100644
--- a/src/tint/lang/glsl/intrinsic/data.cc
+++ b/src/tint/lang/glsl/intrinsic/data.cc
@@ -616,6 +616,32 @@
};
+/// TypeMatcher for 'match scalar'
+constexpr TypeMatcher kScalarMatcher {
+/* match */ [](MatchState& state, const Type* ty) -> const Type* {
+ if (MatchF32(state, ty)) {
+ return BuildF32(state, ty);
+ }
+ if (MatchF16(state, ty)) {
+ return BuildF16(state, ty);
+ }
+ if (MatchI32(state, ty)) {
+ return BuildI32(state, ty);
+ }
+ if (MatchU32(state, ty)) {
+ return BuildU32(state, ty);
+ }
+ if (MatchBool(state, ty)) {
+ return BuildBool(state, ty);
+ }
+ return nullptr;
+ },
+/* print */ [](MatchState*, StyledText& out) {
+ // Note: We pass nullptr to the Matcher.print() functions, as matchers do not support
+ // template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
+ kF32Matcher.print(nullptr, out); out << style::Plain(", "); kF16Matcher.print(nullptr, out); out << style::Plain(", "); kI32Matcher.print(nullptr, out); out << style::Plain(", "); kU32Matcher.print(nullptr, out); out << style::Plain(" or "); kBoolMatcher.print(nullptr, out);}
+};
+
/// TypeMatcher for 'match iu32'
constexpr TypeMatcher kIu32Matcher {
/* match */ [](MatchState& state, const Type* ty) -> const Type* {
@@ -920,12 +946,13 @@
/* [27] */ kTextureStorage2DMatcher,
/* [28] */ kTextureStorage2DArrayMatcher,
/* [29] */ kTextureStorage3DMatcher,
- /* [30] */ kIu32Matcher,
- /* [31] */ kFiu32Matcher,
- /* [32] */ kFi32F16Matcher,
- /* [33] */ kFiu32F16Matcher,
- /* [34] */ kFiu32F16BoolMatcher,
- /* [35] */ kF32F16Matcher,
+ /* [30] */ kScalarMatcher,
+ /* [31] */ kIu32Matcher,
+ /* [32] */ kFiu32Matcher,
+ /* [33] */ kFi32F16Matcher,
+ /* [34] */ kFiu32F16Matcher,
+ /* [35] */ kFiu32F16BoolMatcher,
+ /* [36] */ kF32F16Matcher,
};
/// The template numbers, and number matchers
@@ -1077,17 +1104,18 @@
/* [130] */ MatcherIndex(0),
/* [131] */ MatcherIndex(10),
/* [132] */ MatcherIndex(0),
- /* [133] */ MatcherIndex(30),
- /* [134] */ MatcherIndex(32),
- /* [135] */ MatcherIndex(35),
- /* [136] */ MatcherIndex(31),
- /* [137] */ MatcherIndex(21),
- /* [138] */ MatcherIndex(22),
- /* [139] */ MatcherIndex(23),
- /* [140] */ MatcherIndex(24),
- /* [141] */ MatcherIndex(25),
- /* [142] */ MatcherIndex(33),
+ /* [133] */ MatcherIndex(31),
+ /* [134] */ MatcherIndex(33),
+ /* [135] */ MatcherIndex(36),
+ /* [136] */ MatcherIndex(30),
+ /* [137] */ MatcherIndex(32),
+ /* [138] */ MatcherIndex(21),
+ /* [139] */ MatcherIndex(22),
+ /* [140] */ MatcherIndex(23),
+ /* [141] */ MatcherIndex(24),
+ /* [142] */ MatcherIndex(25),
/* [143] */ MatcherIndex(34),
+ /* [144] */ MatcherIndex(35),
};
static_assert(MatcherIndicesIndex::CanIndex(kMatcherIndices),
@@ -1176,43 +1204,43 @@
},
{
/* [16] */
- /* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(103),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(3),
},
{
/* [17] */
- /* usage */ core::ParameterUsage::kLocation,
- /* matcher_indices */ MatcherIndicesIndex(10),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(3),
},
{
/* [18] */
- /* usage */ core::ParameterUsage::kLevel,
- /* matcher_indices */ MatcherIndicesIndex(10),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(5),
},
{
/* [19] */
- /* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(107),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(2),
},
{
/* [20] */
- /* usage */ core::ParameterUsage::kLocation,
- /* matcher_indices */ MatcherIndicesIndex(105),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(2),
},
{
/* [21] */
- /* usage */ core::ParameterUsage::kLevel,
- /* matcher_indices */ MatcherIndicesIndex(10),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(47),
},
{
/* [22] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(111),
+ /* matcher_indices */ MatcherIndicesIndex(103),
},
{
/* [23] */
/* usage */ core::ParameterUsage::kLocation,
- /* matcher_indices */ MatcherIndicesIndex(109),
+ /* matcher_indices */ MatcherIndicesIndex(10),
},
{
/* [24] */
@@ -1222,7 +1250,7 @@
{
/* [25] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(119),
+ /* matcher_indices */ MatcherIndicesIndex(107),
},
{
/* [26] */
@@ -1231,13 +1259,13 @@
},
{
/* [27] */
- /* usage */ core::ParameterUsage::kSampleIndex,
+ /* usage */ core::ParameterUsage::kLevel,
/* matcher_indices */ MatcherIndicesIndex(10),
},
{
/* [28] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(113),
+ /* matcher_indices */ MatcherIndicesIndex(111),
},
{
/* [29] */
@@ -1252,37 +1280,37 @@
{
/* [31] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(62),
+ /* matcher_indices */ MatcherIndicesIndex(119),
},
{
/* [32] */
- /* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(3),
+ /* usage */ core::ParameterUsage::kLocation,
+ /* matcher_indices */ MatcherIndicesIndex(105),
},
{
/* [33] */
- /* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(123),
+ /* usage */ core::ParameterUsage::kSampleIndex,
+ /* matcher_indices */ MatcherIndicesIndex(10),
},
{
/* [34] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(65),
+ /* matcher_indices */ MatcherIndicesIndex(113),
},
{
/* [35] */
- /* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(3),
+ /* usage */ core::ParameterUsage::kLocation,
+ /* matcher_indices */ MatcherIndicesIndex(109),
},
{
/* [36] */
- /* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(125),
+ /* usage */ core::ParameterUsage::kLevel,
+ /* matcher_indices */ MatcherIndicesIndex(10),
},
{
/* [37] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(68),
+ /* matcher_indices */ MatcherIndicesIndex(62),
},
{
/* [38] */
@@ -1292,42 +1320,42 @@
{
/* [39] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(127),
+ /* matcher_indices */ MatcherIndicesIndex(123),
},
{
/* [40] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(71),
+ /* matcher_indices */ MatcherIndicesIndex(65),
},
{
/* [41] */
/* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(129),
+ /* matcher_indices */ MatcherIndicesIndex(3),
},
{
/* [42] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(123),
+ /* matcher_indices */ MatcherIndicesIndex(125),
},
{
/* [43] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(74),
+ /* matcher_indices */ MatcherIndicesIndex(68),
},
{
/* [44] */
/* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(129),
+ /* matcher_indices */ MatcherIndicesIndex(3),
},
{
/* [45] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(125),
+ /* matcher_indices */ MatcherIndicesIndex(127),
},
{
/* [46] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(77),
+ /* matcher_indices */ MatcherIndicesIndex(71),
},
{
/* [47] */
@@ -1337,42 +1365,42 @@
{
/* [48] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(127),
+ /* matcher_indices */ MatcherIndicesIndex(123),
},
{
/* [49] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(80),
+ /* matcher_indices */ MatcherIndicesIndex(74),
},
{
/* [50] */
/* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(131),
+ /* matcher_indices */ MatcherIndicesIndex(129),
},
{
/* [51] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(123),
+ /* matcher_indices */ MatcherIndicesIndex(125),
},
{
/* [52] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(83),
+ /* matcher_indices */ MatcherIndicesIndex(77),
},
{
/* [53] */
/* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(131),
+ /* matcher_indices */ MatcherIndicesIndex(129),
},
{
/* [54] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(125),
+ /* matcher_indices */ MatcherIndicesIndex(127),
},
{
/* [55] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(86),
+ /* matcher_indices */ MatcherIndicesIndex(80),
},
{
/* [56] */
@@ -1382,12 +1410,12 @@
{
/* [57] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(127),
+ /* matcher_indices */ MatcherIndicesIndex(123),
},
{
/* [58] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(89),
+ /* matcher_indices */ MatcherIndicesIndex(83),
},
{
/* [59] */
@@ -1397,12 +1425,12 @@
{
/* [60] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(123),
+ /* matcher_indices */ MatcherIndicesIndex(125),
},
{
/* [61] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(92),
+ /* matcher_indices */ MatcherIndicesIndex(86),
},
{
/* [62] */
@@ -1412,12 +1440,12 @@
{
/* [63] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(125),
+ /* matcher_indices */ MatcherIndicesIndex(127),
},
{
/* [64] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(95),
+ /* matcher_indices */ MatcherIndicesIndex(89),
},
{
/* [65] */
@@ -1427,102 +1455,102 @@
{
/* [66] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(127),
+ /* matcher_indices */ MatcherIndicesIndex(123),
},
{
/* [67] */
+ /* usage */ core::ParameterUsage::kTexture,
+ /* matcher_indices */ MatcherIndicesIndex(92),
+ },
+ {
+ /* [68] */
+ /* usage */ core::ParameterUsage::kCoords,
+ /* matcher_indices */ MatcherIndicesIndex(131),
+ },
+ {
+ /* [69] */
+ /* usage */ core::ParameterUsage::kValue,
+ /* matcher_indices */ MatcherIndicesIndex(125),
+ },
+ {
+ /* [70] */
+ /* usage */ core::ParameterUsage::kTexture,
+ /* matcher_indices */ MatcherIndicesIndex(95),
+ },
+ {
+ /* [71] */
+ /* usage */ core::ParameterUsage::kCoords,
+ /* matcher_indices */ MatcherIndicesIndex(131),
+ },
+ {
+ /* [72] */
+ /* usage */ core::ParameterUsage::kValue,
+ /* matcher_indices */ MatcherIndicesIndex(127),
+ },
+ {
+ /* [73] */
/* usage */ core::ParameterUsage::kNone,
/* matcher_indices */ MatcherIndicesIndex(22),
},
{
- /* [68] */
- /* usage */ core::ParameterUsage::kNone,
- /* matcher_indices */ MatcherIndicesIndex(3),
- },
- {
- /* [69] */
- /* usage */ core::ParameterUsage::kNone,
- /* matcher_indices */ MatcherIndicesIndex(44),
- },
- {
- /* [70] */
- /* usage */ core::ParameterUsage::kNone,
- /* matcher_indices */ MatcherIndicesIndex(44),
- },
- {
- /* [71] */
- /* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(3),
- },
- {
- /* [72] */
- /* usage */ core::ParameterUsage::kResult,
- /* matcher_indices */ MatcherIndicesIndex(27),
- },
- {
- /* [73] */
- /* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(2),
- },
- {
/* [74] */
- /* usage */ core::ParameterUsage::kResult,
- /* matcher_indices */ MatcherIndicesIndex(0),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(3),
},
{
/* [75] */
- /* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(3),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(44),
},
{
/* [76] */
- /* usage */ core::ParameterUsage::kExp,
- /* matcher_indices */ MatcherIndicesIndex(31),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(44),
},
{
/* [77] */
/* usage */ core::ParameterUsage::kValue,
- /* matcher_indices */ MatcherIndicesIndex(2),
+ /* matcher_indices */ MatcherIndicesIndex(3),
},
{
/* [78] */
+ /* usage */ core::ParameterUsage::kResult,
+ /* matcher_indices */ MatcherIndicesIndex(27),
+ },
+ {
+ /* [79] */
+ /* usage */ core::ParameterUsage::kValue,
+ /* matcher_indices */ MatcherIndicesIndex(2),
+ },
+ {
+ /* [80] */
+ /* usage */ core::ParameterUsage::kResult,
+ /* matcher_indices */ MatcherIndicesIndex(0),
+ },
+ {
+ /* [81] */
+ /* usage */ core::ParameterUsage::kValue,
+ /* matcher_indices */ MatcherIndicesIndex(3),
+ },
+ {
+ /* [82] */
+ /* usage */ core::ParameterUsage::kExp,
+ /* matcher_indices */ MatcherIndicesIndex(31),
+ },
+ {
+ /* [83] */
+ /* usage */ core::ParameterUsage::kValue,
+ /* matcher_indices */ MatcherIndicesIndex(2),
+ },
+ {
+ /* [84] */
/* usage */ core::ParameterUsage::kExp,
/* matcher_indices */ MatcherIndicesIndex(6),
},
{
- /* [79] */
- /* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(103),
- },
- {
- /* [80] */
- /* usage */ core::ParameterUsage::kLevel,
- /* matcher_indices */ MatcherIndicesIndex(10),
- },
- {
- /* [81] */
- /* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(107),
- },
- {
- /* [82] */
- /* usage */ core::ParameterUsage::kLevel,
- /* matcher_indices */ MatcherIndicesIndex(10),
- },
- {
- /* [83] */
- /* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(111),
- },
- {
- /* [84] */
- /* usage */ core::ParameterUsage::kLevel,
- /* matcher_indices */ MatcherIndicesIndex(10),
- },
- {
/* [85] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(113),
+ /* matcher_indices */ MatcherIndicesIndex(103),
},
{
/* [86] */
@@ -1532,7 +1560,7 @@
{
/* [87] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(115),
+ /* matcher_indices */ MatcherIndicesIndex(107),
},
{
/* [88] */
@@ -1542,7 +1570,7 @@
{
/* [89] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(117),
+ /* matcher_indices */ MatcherIndicesIndex(111),
},
{
/* [90] */
@@ -1552,7 +1580,7 @@
{
/* [91] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(137),
+ /* matcher_indices */ MatcherIndicesIndex(113),
},
{
/* [92] */
@@ -1562,7 +1590,7 @@
{
/* [93] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(138),
+ /* matcher_indices */ MatcherIndicesIndex(115),
},
{
/* [94] */
@@ -1572,7 +1600,7 @@
{
/* [95] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(139),
+ /* matcher_indices */ MatcherIndicesIndex(117),
},
{
/* [96] */
@@ -1582,7 +1610,7 @@
{
/* [97] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(140),
+ /* matcher_indices */ MatcherIndicesIndex(138),
},
{
/* [98] */
@@ -1592,92 +1620,117 @@
{
/* [99] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(50),
+ /* matcher_indices */ MatcherIndicesIndex(139),
},
{
/* [100] */
- /* usage */ core::ParameterUsage::kCoords,
+ /* usage */ core::ParameterUsage::kLevel,
/* matcher_indices */ MatcherIndicesIndex(10),
},
{
/* [101] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(53),
+ /* matcher_indices */ MatcherIndicesIndex(140),
},
{
/* [102] */
- /* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(105),
+ /* usage */ core::ParameterUsage::kLevel,
+ /* matcher_indices */ MatcherIndicesIndex(10),
},
{
/* [103] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(56),
+ /* matcher_indices */ MatcherIndicesIndex(141),
},
{
/* [104] */
- /* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(109),
+ /* usage */ core::ParameterUsage::kLevel,
+ /* matcher_indices */ MatcherIndicesIndex(10),
},
{
/* [105] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(59),
+ /* matcher_indices */ MatcherIndicesIndex(50),
},
{
/* [106] */
/* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(109),
+ /* matcher_indices */ MatcherIndicesIndex(10),
},
{
/* [107] */
+ /* usage */ core::ParameterUsage::kTexture,
+ /* matcher_indices */ MatcherIndicesIndex(53),
+ },
+ {
+ /* [108] */
+ /* usage */ core::ParameterUsage::kCoords,
+ /* matcher_indices */ MatcherIndicesIndex(105),
+ },
+ {
+ /* [109] */
+ /* usage */ core::ParameterUsage::kTexture,
+ /* matcher_indices */ MatcherIndicesIndex(56),
+ },
+ {
+ /* [110] */
+ /* usage */ core::ParameterUsage::kCoords,
+ /* matcher_indices */ MatcherIndicesIndex(109),
+ },
+ {
+ /* [111] */
+ /* usage */ core::ParameterUsage::kTexture,
+ /* matcher_indices */ MatcherIndicesIndex(59),
+ },
+ {
+ /* [112] */
+ /* usage */ core::ParameterUsage::kCoords,
+ /* matcher_indices */ MatcherIndicesIndex(109),
+ },
+ {
+ /* [113] */
/* usage */ core::ParameterUsage::kNone,
/* matcher_indices */ MatcherIndicesIndex(12),
},
{
- /* [108] */
+ /* [114] */
/* usage */ core::ParameterUsage::kValue,
/* matcher_indices */ MatcherIndicesIndex(37),
},
{
- /* [109] */
+ /* [115] */
/* usage */ core::ParameterUsage::kValue,
/* matcher_indices */ MatcherIndicesIndex(35),
},
{
- /* [110] */
+ /* [116] */
/* usage */ core::ParameterUsage::kValue,
/* matcher_indices */ MatcherIndicesIndex(10),
},
{
- /* [111] */
+ /* [117] */
/* usage */ core::ParameterUsage::kValue,
/* matcher_indices */ MatcherIndicesIndex(8),
},
{
- /* [112] */
+ /* [118] */
/* usage */ core::ParameterUsage::kValue,
/* matcher_indices */ MatcherIndicesIndex(1),
},
{
- /* [113] */
+ /* [119] */
/* usage */ core::ParameterUsage::kValue,
/* matcher_indices */ MatcherIndicesIndex(38),
},
{
- /* [114] */
+ /* [120] */
/* usage */ core::ParameterUsage::kValue,
/* matcher_indices */ MatcherIndicesIndex(101),
},
{
- /* [115] */
- /* usage */ core::ParameterUsage::kNone,
- /* matcher_indices */ MatcherIndicesIndex(47),
- },
- {
- /* [116] */
+ /* [121] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(141),
+ /* matcher_indices */ MatcherIndicesIndex(142),
},
};
@@ -1724,107 +1777,113 @@
{
/* [6] */
/* name */ "T",
- /* matcher_indices */ MatcherIndicesIndex(135),
+ /* matcher_indices */ MatcherIndicesIndex(136),
/* kind */ TemplateInfo::Kind::kType,
},
{
/* [7] */
- /* name */ "N",
- /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
- /* kind */ TemplateInfo::Kind::kNumber,
- },
- {
- /* [8] */
/* name */ "T",
/* matcher_indices */ MatcherIndicesIndex(134),
/* kind */ TemplateInfo::Kind::kType,
},
{
- /* [9] */
+ /* [8] */
/* name */ "N",
/* matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
+ /* [9] */
+ /* name */ "T",
+ /* matcher_indices */ MatcherIndicesIndex(135),
+ /* kind */ TemplateInfo::Kind::kType,
+ },
+ {
/* [10] */
- /* name */ "F",
+ /* name */ "N",
/* matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
/* [11] */
- /* name */ "A",
+ /* name */ "F",
/* matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
/* [12] */
+ /* name */ "A",
+ /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
+ /* kind */ TemplateInfo::Kind::kNumber,
+ },
+ {
+ /* [13] */
/* name */ "F",
/* matcher_indices */ MatcherIndicesIndex(0),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
- /* [13] */
+ /* [14] */
/* name */ "A",
/* matcher_indices */ MatcherIndicesIndex(102),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
- /* [14] */
+ /* [15] */
/* name */ "F",
/* matcher_indices */ MatcherIndicesIndex(66),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
- /* [15] */
+ /* [16] */
/* name */ "A",
/* matcher_indices */ MatcherIndicesIndex(102),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
- /* [16] */
+ /* [17] */
/* name */ "F",
/* matcher_indices */ MatcherIndicesIndex(69),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
- /* [17] */
+ /* [18] */
/* name */ "A",
/* matcher_indices */ MatcherIndicesIndex(102),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
- /* [18] */
- /* name */ "T",
- /* matcher_indices */ MatcherIndicesIndex(142),
- /* kind */ TemplateInfo::Kind::kType,
- },
- {
/* [19] */
- /* name */ "N",
- /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
- /* kind */ TemplateInfo::Kind::kNumber,
- },
- {
- /* [20] */
/* name */ "T",
/* matcher_indices */ MatcherIndicesIndex(143),
/* kind */ TemplateInfo::Kind::kType,
},
{
- /* [21] */
+ /* [20] */
/* name */ "N",
/* matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
- /* [22] */
+ /* [21] */
/* name */ "T",
- /* matcher_indices */ MatcherIndicesIndex(136),
+ /* matcher_indices */ MatcherIndicesIndex(144),
/* kind */ TemplateInfo::Kind::kType,
},
{
+ /* [22] */
+ /* name */ "N",
+ /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
+ /* kind */ TemplateInfo::Kind::kNumber,
+ },
+ {
/* [23] */
+ /* name */ "T",
+ /* matcher_indices */ MatcherIndicesIndex(137),
+ /* kind */ TemplateInfo::Kind::kType,
+ },
+ {
+ /* [24] */
/* name */ "C",
/* matcher_indices */ MatcherIndicesIndex(133),
/* kind */ TemplateInfo::Kind::kType,
@@ -1849,8 +1908,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(79),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(85),
/* return_matcher_indices */ MatcherIndicesIndex(10),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1860,8 +1919,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(81),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(87),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1871,8 +1930,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(83),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(89),
/* return_matcher_indices */ MatcherIndicesIndex(109),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1882,8 +1941,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(85),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(91),
/* return_matcher_indices */ MatcherIndicesIndex(109),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1893,8 +1952,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(87),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(93),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1904,8 +1963,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(89),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(95),
/* return_matcher_indices */ MatcherIndicesIndex(109),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1916,7 +1975,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(91),
+ /* parameters */ ParameterIndex(97),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1927,7 +1986,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(93),
+ /* parameters */ ParameterIndex(99),
/* return_matcher_indices */ MatcherIndicesIndex(109),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1938,7 +1997,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(95),
+ /* parameters */ ParameterIndex(101),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1949,7 +2008,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(97),
+ /* parameters */ ParameterIndex(103),
/* return_matcher_indices */ MatcherIndicesIndex(109),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1959,8 +2018,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(25),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(31),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1971,7 +2030,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(116),
+ /* parameters */ ParameterIndex(121),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1981,8 +2040,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(12),
- /* parameters */ ParameterIndex(99),
+ /* templates */ TemplateIndex(13),
+ /* parameters */ ParameterIndex(105),
/* return_matcher_indices */ MatcherIndicesIndex(123),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1992,8 +2051,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(12),
- /* parameters */ ParameterIndex(101),
+ /* templates */ TemplateIndex(13),
+ /* parameters */ ParameterIndex(107),
/* return_matcher_indices */ MatcherIndicesIndex(123),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2003,8 +2062,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(12),
- /* parameters */ ParameterIndex(103),
+ /* templates */ TemplateIndex(13),
+ /* parameters */ ParameterIndex(109),
/* return_matcher_indices */ MatcherIndicesIndex(123),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2014,8 +2073,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(12),
- /* parameters */ ParameterIndex(105),
+ /* templates */ TemplateIndex(13),
+ /* parameters */ ParameterIndex(111),
/* return_matcher_indices */ MatcherIndicesIndex(123),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2025,8 +2084,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(14),
- /* parameters */ ParameterIndex(99),
+ /* templates */ TemplateIndex(15),
+ /* parameters */ ParameterIndex(105),
/* return_matcher_indices */ MatcherIndicesIndex(125),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2036,8 +2095,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(14),
- /* parameters */ ParameterIndex(101),
+ /* templates */ TemplateIndex(15),
+ /* parameters */ ParameterIndex(107),
/* return_matcher_indices */ MatcherIndicesIndex(125),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2047,8 +2106,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(14),
- /* parameters */ ParameterIndex(103),
+ /* templates */ TemplateIndex(15),
+ /* parameters */ ParameterIndex(109),
/* return_matcher_indices */ MatcherIndicesIndex(125),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2058,8 +2117,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(14),
- /* parameters */ ParameterIndex(105),
+ /* templates */ TemplateIndex(15),
+ /* parameters */ ParameterIndex(111),
/* return_matcher_indices */ MatcherIndicesIndex(125),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2069,8 +2128,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(16),
- /* parameters */ ParameterIndex(99),
+ /* templates */ TemplateIndex(17),
+ /* parameters */ ParameterIndex(105),
/* return_matcher_indices */ MatcherIndicesIndex(127),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2080,8 +2139,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(16),
- /* parameters */ ParameterIndex(101),
+ /* templates */ TemplateIndex(17),
+ /* parameters */ ParameterIndex(107),
/* return_matcher_indices */ MatcherIndicesIndex(127),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2091,8 +2150,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(16),
- /* parameters */ ParameterIndex(103),
+ /* templates */ TemplateIndex(17),
+ /* parameters */ ParameterIndex(109),
/* return_matcher_indices */ MatcherIndicesIndex(127),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2102,8 +2161,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(16),
- /* parameters */ ParameterIndex(105),
+ /* templates */ TemplateIndex(17),
+ /* parameters */ ParameterIndex(111),
/* return_matcher_indices */ MatcherIndicesIndex(127),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2113,8 +2172,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(31),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(37),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2124,8 +2183,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(34),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(40),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2135,8 +2194,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(37),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(43),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2146,8 +2205,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(40),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(46),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2157,8 +2216,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(43),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(49),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2168,8 +2227,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(46),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(52),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2179,8 +2238,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(49),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(55),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2190,8 +2249,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(52),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(58),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2201,8 +2260,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(55),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(61),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2212,8 +2271,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(58),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(64),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2223,8 +2282,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(61),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(67),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2234,8 +2293,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(23),
- /* parameters */ ParameterIndex(64),
+ /* templates */ TemplateIndex(24),
+ /* parameters */ ParameterIndex(70),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2245,8 +2304,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(16),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(22),
/* return_matcher_indices */ MatcherIndicesIndex(121),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2256,8 +2315,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(19),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(25),
/* return_matcher_indices */ MatcherIndicesIndex(121),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2267,8 +2326,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(22),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(28),
/* return_matcher_indices */ MatcherIndicesIndex(121),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2278,8 +2337,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(25),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(31),
/* return_matcher_indices */ MatcherIndicesIndex(121),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2289,8 +2348,8 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(22),
- /* parameters */ ParameterIndex(28),
+ /* templates */ TemplateIndex(23),
+ /* parameters */ ParameterIndex(34),
/* return_matcher_indices */ MatcherIndicesIndex(121),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2300,8 +2359,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(10),
- /* parameters */ ParameterIndex(99),
+ /* templates */ TemplateIndex(11),
+ /* parameters */ ParameterIndex(105),
/* return_matcher_indices */ MatcherIndicesIndex(10),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2311,8 +2370,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(10),
- /* parameters */ ParameterIndex(101),
+ /* templates */ TemplateIndex(11),
+ /* parameters */ ParameterIndex(107),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2322,8 +2381,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(10),
- /* parameters */ ParameterIndex(103),
+ /* templates */ TemplateIndex(11),
+ /* parameters */ ParameterIndex(109),
/* return_matcher_indices */ MatcherIndicesIndex(109),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2333,8 +2392,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(10),
- /* parameters */ ParameterIndex(105),
+ /* templates */ TemplateIndex(11),
+ /* parameters */ ParameterIndex(111),
/* return_matcher_indices */ MatcherIndicesIndex(109),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2345,7 +2404,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(108),
+ /* parameters */ ParameterIndex(114),
/* return_matcher_indices */ MatcherIndicesIndex(10),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2356,7 +2415,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 1,
/* templates */ TemplateIndex(5),
- /* parameters */ ParameterIndex(109),
+ /* parameters */ ParameterIndex(115),
/* return_matcher_indices */ MatcherIndicesIndex(8),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2367,7 +2426,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(108),
+ /* parameters */ ParameterIndex(114),
/* return_matcher_indices */ MatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2378,7 +2437,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 1,
/* templates */ TemplateIndex(5),
- /* parameters */ ParameterIndex(109),
+ /* parameters */ ParameterIndex(115),
/* return_matcher_indices */ MatcherIndicesIndex(38),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2389,7 +2448,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(110),
+ /* parameters */ ParameterIndex(116),
/* return_matcher_indices */ MatcherIndicesIndex(37),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2400,7 +2459,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 1,
/* templates */ TemplateIndex(5),
- /* parameters */ ParameterIndex(111),
+ /* parameters */ ParameterIndex(117),
/* return_matcher_indices */ MatcherIndicesIndex(35),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2411,7 +2470,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(112),
+ /* parameters */ ParameterIndex(118),
/* return_matcher_indices */ MatcherIndicesIndex(37),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2422,7 +2481,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 1,
/* templates */ TemplateIndex(5),
- /* parameters */ ParameterIndex(113),
+ /* parameters */ ParameterIndex(119),
/* return_matcher_indices */ MatcherIndicesIndex(35),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2498,8 +2557,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(8),
- /* parameters */ ParameterIndex(68),
+ /* templates */ TemplateIndex(7),
+ /* parameters */ ParameterIndex(16),
/* return_matcher_indices */ MatcherIndicesIndex(3),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2509,32 +2568,32 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(8),
- /* parameters */ ParameterIndex(69),
+ /* templates */ TemplateIndex(7),
+ /* parameters */ ParameterIndex(75),
/* return_matcher_indices */ MatcherIndicesIndex(44),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
/* [61] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
- /* num_parameters */ 2,
+ /* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
/* templates */ TemplateIndex(6),
- /* parameters */ ParameterIndex(71),
+ /* parameters */ ParameterIndex(16),
/* return_matcher_indices */ MatcherIndicesIndex(3),
- /* const_eval_fn */ ConstEvalFunctionIndex(0),
+ /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
/* [62] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
- /* num_parameters */ 2,
+ /* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
/* templates */ TemplateIndex(5),
- /* parameters */ ParameterIndex(73),
+ /* parameters */ ParameterIndex(19),
/* return_matcher_indices */ MatcherIndicesIndex(2),
- /* const_eval_fn */ ConstEvalFunctionIndex(0),
+ /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
/* [63] */
@@ -2542,10 +2601,10 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(6),
- /* parameters */ ParameterIndex(75),
+ /* templates */ TemplateIndex(9),
+ /* parameters */ ParameterIndex(77),
/* return_matcher_indices */ MatcherIndicesIndex(3),
- /* const_eval_fn */ ConstEvalFunctionIndex(1),
+ /* const_eval_fn */ ConstEvalFunctionIndex(0),
},
{
/* [64] */
@@ -2553,24 +2612,46 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(5),
- /* parameters */ ParameterIndex(77),
+ /* templates */ TemplateIndex(8),
+ /* parameters */ ParameterIndex(79),
+ /* return_matcher_indices */ MatcherIndicesIndex(2),
+ /* const_eval_fn */ ConstEvalFunctionIndex(0),
+ },
+ {
+ /* [65] */
+ /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* num_parameters */ 2,
+ /* num_explicit_templates */ 0,
+ /* num_templates */ 1,
+ /* templates */ TemplateIndex(9),
+ /* parameters */ ParameterIndex(81),
+ /* return_matcher_indices */ MatcherIndicesIndex(3),
+ /* const_eval_fn */ ConstEvalFunctionIndex(1),
+ },
+ {
+ /* [66] */
+ /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* num_parameters */ 2,
+ /* num_explicit_templates */ 0,
+ /* num_templates */ 2,
+ /* templates */ TemplateIndex(8),
+ /* parameters */ ParameterIndex(83),
/* return_matcher_indices */ MatcherIndicesIndex(2),
/* const_eval_fn */ ConstEvalFunctionIndex(1),
},
{
- /* [65] */
+ /* [67] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse, OverloadFlag::kMemberFunction),
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
/* templates */ TemplateIndex(0),
- /* parameters */ ParameterIndex(107),
+ /* parameters */ ParameterIndex(113),
/* return_matcher_indices */ MatcherIndicesIndex(10),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
- /* [66] */
+ /* [68] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsComputePipeline),
/* num_parameters */ 0,
/* num_explicit_templates */ 0,
@@ -2581,7 +2662,7 @@
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
- /* [67] */
+ /* [69] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
@@ -2592,69 +2673,47 @@
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
- /* [68] */
+ /* [70] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
/* templates */ TemplateIndex(2),
- /* parameters */ ParameterIndex(67),
+ /* parameters */ ParameterIndex(73),
/* return_matcher_indices */ MatcherIndicesIndex(3),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
- /* [69] */
- /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* num_parameters */ 1,
- /* num_explicit_templates */ 0,
- /* num_templates */ 0,
- /* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(114),
- /* return_matcher_indices */ MatcherIndicesIndex(1),
- /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
- },
- {
- /* [70] */
- /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* num_parameters */ 1,
- /* num_explicit_templates */ 0,
- /* num_templates */ 0,
- /* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(112),
- /* return_matcher_indices */ MatcherIndicesIndex(101),
- /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
- },
- {
/* [71] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
- /* num_templates */ 1,
- /* templates */ TemplateIndex(5),
- /* parameters */ ParameterIndex(115),
- /* return_matcher_indices */ MatcherIndicesIndex(5),
+ /* num_templates */ 0,
+ /* templates */ TemplateIndex(/* invalid */),
+ /* parameters */ ParameterIndex(120),
+ /* return_matcher_indices */ MatcherIndicesIndex(1),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
/* [72] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* num_parameters */ 2,
+ /* num_parameters */ 1,
/* num_explicit_templates */ 0,
- /* num_templates */ 2,
- /* templates */ TemplateIndex(6),
- /* parameters */ ParameterIndex(69),
- /* return_matcher_indices */ MatcherIndicesIndex(3),
+ /* num_templates */ 0,
+ /* templates */ TemplateIndex(/* invalid */),
+ /* parameters */ ParameterIndex(118),
+ /* return_matcher_indices */ MatcherIndicesIndex(101),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
/* [73] */
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* num_parameters */ 2,
+ /* num_parameters */ 1,
/* num_explicit_templates */ 0,
- /* num_templates */ 2,
- /* templates */ TemplateIndex(18),
- /* parameters */ ParameterIndex(69),
- /* return_matcher_indices */ MatcherIndicesIndex(98),
+ /* num_templates */ 1,
+ /* templates */ TemplateIndex(5),
+ /* parameters */ ParameterIndex(21),
+ /* return_matcher_indices */ MatcherIndicesIndex(5),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
@@ -2663,8 +2722,30 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(20),
- /* parameters */ ParameterIndex(69),
+ /* templates */ TemplateIndex(9),
+ /* parameters */ ParameterIndex(75),
+ /* return_matcher_indices */ MatcherIndicesIndex(3),
+ /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+ },
+ {
+ /* [75] */
+ /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
+ /* num_parameters */ 2,
+ /* num_explicit_templates */ 0,
+ /* num_templates */ 2,
+ /* templates */ TemplateIndex(19),
+ /* parameters */ ParameterIndex(75),
+ /* return_matcher_indices */ MatcherIndicesIndex(98),
+ /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+ },
+ {
+ /* [76] */
+ /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
+ /* num_parameters */ 2,
+ /* num_explicit_templates */ 0,
+ /* num_templates */ 2,
+ /* templates */ TemplateIndex(21),
+ /* parameters */ ParameterIndex(75),
/* return_matcher_indices */ MatcherIndicesIndex(98),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2678,37 +2759,37 @@
/* [0] */
/* fn length[T, A : access](ptr<storage, array<T>, A>) -> i32 */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(65),
+ /* overloads */ OverloadIndex(67),
},
{
/* [1] */
/* fn barrier() */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(66),
+ /* overloads */ OverloadIndex(68),
},
{
/* [2] */
/* fn memoryBarrierBuffer() */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(66),
+ /* overloads */ OverloadIndex(68),
},
{
/* [3] */
/* fn memoryBarrierImage() */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(66),
+ /* overloads */ OverloadIndex(68),
},
{
/* [4] */
/* fn atomicCompSwap[T : iu32](ptr<workgroup_or_storage, atomic<T>, read_write>, compare_value: T, value: T) -> T */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(67),
+ /* overloads */ OverloadIndex(69),
},
{
/* [5] */
/* fn atomicSub[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T) -> T */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(68),
+ /* overloads */ OverloadIndex(70),
},
{
/* [6] */
@@ -2763,13 +2844,13 @@
/* [13] */
/* fn packFloat2x16(value: vec2<f16>) -> u32 */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(69),
+ /* overloads */ OverloadIndex(71),
},
{
/* [14] */
/* fn unpackFloat2x16(value: u32) -> vec2<f16> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(70),
+ /* overloads */ OverloadIndex(72),
},
{
/* [15] */
@@ -2782,36 +2863,43 @@
/* [16] */
/* fn any[N : num](vec<N, bool>) -> bool */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(71),
+ /* overloads */ OverloadIndex(73),
},
{
/* [17] */
/* fn all[N : num](vec<N, bool>) -> bool */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(71),
+ /* overloads */ OverloadIndex(73),
},
{
/* [18] */
/* fn dot[T : f32_f16, N : num](vec<N, T>, vec<N, T>) -> T */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(72),
+ /* overloads */ OverloadIndex(74),
},
{
/* [19] */
- /* fn modf[T : f32_f16](value: T, result: ptr<function, T, read_write>) -> T */
- /* fn modf[N : num, T : f32_f16](value: vec<N, T>, result: ptr<function, vec<N, T>, read_write>) -> vec<N, T> */
+ /* fn mix[T : scalar](T, T, bool) -> T */
+ /* fn mix[N : num, T : scalar](vec<N, T>, vec<N, T>, vec<N, bool>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ OverloadIndex(61),
},
{
/* [20] */
- /* fn frexp[T : f32_f16](value: T, exp: ptr<function, i32, read_write>) -> T */
- /* fn frexp[N : num, T : f32_f16](value: vec<N, T>, exp: ptr<function, vec<N, i32>, read_write>) -> vec<N, T> */
+ /* fn modf[T : f32_f16](value: T, result: ptr<function, T, read_write>) -> T */
+ /* fn modf[N : num, T : f32_f16](value: vec<N, T>, result: ptr<function, vec<N, T>, read_write>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ OverloadIndex(63),
},
{
/* [21] */
+ /* fn frexp[T : f32_f16](value: T, exp: ptr<function, i32, read_write>) -> T */
+ /* fn frexp[N : num, T : f32_f16](value: vec<N, T>, exp: ptr<function, vec<N, i32>, read_write>) -> vec<N, T> */
+ /* num overloads */ 2,
+ /* overloads */ OverloadIndex(65),
+ },
+ {
+ /* [22] */
/* fn textureSize[T : fiu32](texture: texture_1d<T>, level: i32) -> i32 */
/* fn textureSize[T : fiu32](texture: texture_2d<T>, level: i32) -> vec2<i32> */
/* fn textureSize[T : fiu32](texture: texture_2d_array<T>, level: i32) -> vec3<i32> */
@@ -2828,7 +2916,7 @@
/* overloads */ OverloadIndex(0),
},
{
- /* [22] */
+ /* [23] */
/* fn imageSize[F : texel_format, A : access](texture: texture_storage_1d<F, A>) -> i32 */
/* fn imageSize[F : texel_format, A : access](texture: texture_storage_2d<F, A>) -> vec2<i32> */
/* fn imageSize[F : texel_format, A : access](texture: texture_storage_2d_array<F, A>) -> vec3<i32> */
@@ -2837,7 +2925,7 @@
/* overloads */ OverloadIndex(41),
},
{
- /* [23] */
+ /* [24] */
/* fn texelFetch[T : fiu32](texture: texture_1d<T>, location: i32, level: i32) -> vec4<T> */
/* fn texelFetch[T : fiu32](texture: texture_2d<T>, location: vec2<i32>, level: i32) -> vec4<T> */
/* fn texelFetch[T : fiu32](texture: texture_2d_array<T>, location: vec3<i32>, level: i32) -> vec4<T> */
@@ -2847,7 +2935,7 @@
/* overloads */ OverloadIndex(36),
},
{
- /* [24] */
+ /* [25] */
/* fn imageLoad[F : f32_texel_format, A : readable](texture: texture_storage_1d<F, A>, coords: i32) -> vec4<f32> */
/* fn imageLoad[F : f32_texel_format, A : readable](texture: texture_storage_2d<F, A>, coords: vec2<i32>) -> vec4<f32> */
/* fn imageLoad[F : f32_texel_format, A : readable](texture: texture_storage_2d_array<F, A>, coords: vec3<i32>) -> vec4<f32> */
@@ -2864,7 +2952,7 @@
/* overloads */ OverloadIndex(12),
},
{
- /* [25] */
+ /* [26] */
/* fn imageStore[C : iu32](texture: texture_storage_1d<f32_texel_format, writable>, coords: C, value: vec4<f32>) */
/* fn imageStore[C : iu32](texture: texture_storage_1d<i32_texel_format, writable>, coords: C, value: vec4<i32>) */
/* fn imageStore[C : iu32](texture: texture_storage_1d<u32_texel_format, writable>, coords: C, value: vec4<u32>) */
@@ -2881,40 +2969,40 @@
/* overloads */ OverloadIndex(24),
},
{
- /* [26] */
+ /* [27] */
/* fn lessThan[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(73),
- },
- {
- /* [27] */
- /* fn lessThanEqual[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
- /* num overloads */ 1,
- /* overloads */ OverloadIndex(73),
+ /* overloads */ OverloadIndex(75),
},
{
/* [28] */
- /* fn greaterThan[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
+ /* fn lessThanEqual[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(73),
+ /* overloads */ OverloadIndex(75),
},
{
/* [29] */
- /* fn greaterThanEqual[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
+ /* fn greaterThan[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(73),
+ /* overloads */ OverloadIndex(75),
},
{
/* [30] */
- /* fn equal[T : fiu32_f16_bool, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
+ /* fn greaterThanEqual[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(74),
+ /* overloads */ OverloadIndex(75),
},
{
/* [31] */
+ /* fn equal[T : fiu32_f16_bool, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
+ /* num overloads */ 1,
+ /* overloads */ OverloadIndex(76),
+ },
+ {
+ /* [32] */
/* fn notEqual[T : fiu32_f16_bool, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(74),
+ /* overloads */ OverloadIndex(76),
},
};
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
index e994854..4ee3b91 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
@@ -1127,41 +1127,31 @@
void ASTPrinter::EmitSelectCall(StringStream& out,
const ast::CallExpression* expr,
const sem::BuiltinFn* builtin) {
- // GLSL does not support ternary expressions with a bool vector conditional,
- // so polyfill with a helper.
- if (auto* vec = builtin->Parameters()[2]->Type()->As<core::type::Vector>()) {
- CallBuiltinHelper(out, expr, builtin,
- [&](TextBuffer* b, const std::vector<std::string>& params) {
- auto l = Line(b);
- l << " return ";
- EmitType(l, builtin->ReturnType(), core::AddressSpace::kUndefined,
- core::Access::kUndefined, "");
- {
- ScopedParen sp(l);
- for (uint32_t i = 0; i < vec->Width(); i++) {
- if (i > 0) {
- l << ", ";
- }
- l << params[2] << "[" << i << "] ? " << params[1] << "[" << i
- << "] : " << params[0] << "[" << i << "]";
- }
- }
- l << ";";
- });
- return;
- }
-
auto* expr_false = expr->args[0];
auto* expr_true = expr->args[1];
auto* expr_cond = expr->args[2];
+ out << "mix";
ScopedParen paren(out);
- EmitExpression(out, expr_cond);
- out << " ? ";
- EmitExpression(out, expr_true);
- out << " : ";
EmitExpression(out, expr_false);
+ out << ", ";
+ EmitExpression(out, expr_true);
+ out << ", ";
+
+ auto* p0_ty = builtin->Parameters()[0]->Type();
+ auto* p2_ty = builtin->Parameters()[2]->Type();
+
+ // If the value types are vectors, but the condition is a single bool, splat the bool into a
+ // vector of equivalent size.
+ if (p0_ty->Is<core::type::Vector>() && !p2_ty->Is<core::type::Vector>()) {
+ auto* vec = p0_ty->As<core::type::Vector>();
+ out << "bvec" << vec->Width();
+ ScopedParen cast_paren(out);
+ EmitExpression(out, expr_cond);
+ } else {
+ EmitExpression(out, expr_cond);
+ }
}
void ASTPrinter::EmitDotCall(StringStream& out,
diff --git a/src/tint/lang/glsl/writer/ast_printer/builtin_test.cc b/src/tint/lang/glsl/writer/ast_printer/builtin_test.cc
index 0bdc74c..4a5eed4 100644
--- a/src/tint/lang/glsl/writer/ast_printer/builtin_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/builtin_test.cc
@@ -380,7 +380,7 @@
StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
- EXPECT_EQ(out.str(), "(true ? b : a)");
+ EXPECT_EQ(out.str(), "mix(a, b, true)");
}
TEST_F(GlslASTPrinterTest_Builtin, Select_Vector) {
@@ -394,7 +394,7 @@
StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
- EXPECT_EQ(out.str(), "tint_select(a, b, bvec2(true, false))");
+ EXPECT_EQ(out.str(), "mix(a, b, bvec2(true, false))");
}
TEST_F(GlslASTPrinterTest_Builtin, FMA_f32) {
diff --git a/src/tint/lang/glsl/writer/builtin_test.cc b/src/tint/lang/glsl/writer/builtin_test.cc
index 41b7b74..40c3411 100644
--- a/src/tint/lang/glsl/writer/builtin_test.cc
+++ b/src/tint/lang/glsl/writer/builtin_test.cc
@@ -86,7 +86,7 @@
void main() {
int x = 1;
int y = 2;
- int w = ((true) ? (y) : (x));
+ int w = mix(x, y, true);
}
)");
}
@@ -110,9 +110,7 @@
void main() {
ivec2 x = ivec2(1, 2);
ivec2 y = ivec2(3, 4);
- bvec2 v = bvec2(true, false);
- int v_1 = ((v.x) ? (y.x) : (x.x));
- ivec2 w = ivec2(v_1, ((v.y) ? (y.y) : (x.y)));
+ ivec2 w = mix(x, y, bvec2(true, false));
}
)");
}
diff --git a/src/tint/lang/glsl/writer/raise/builtin_polyfill.cc b/src/tint/lang/glsl/writer/raise/builtin_polyfill.cc
index cb8e57b..141439c 100644
--- a/src/tint/lang/glsl/writer/raise/builtin_polyfill.cc
+++ b/src/tint/lang/glsl/writer/raise/builtin_polyfill.cc
@@ -638,36 +638,23 @@
}
void Select(core::ir::CoreBuiltinCall* call) {
- Vector<core::ir::Value*, 4> args = call->Args();
+ auto args = call->Args();
- // GLSL does not support ternary expressions with a bool vector conditional,
- // so polyfill by manually creating a vector with each of the
- // individual scalar ternaries.
- if (auto* vec = call->Result(0)->Type()->As<core::type::Vector>()) {
- Vector<core::ir::Value*, 4> construct_args;
+ // Implement as `mix` in GLSL. The one caveat is that `mix` requires the number of
+ // parameters to match, so if we have a `vec2` for the results and a single `bool` value,
+ // we need to splat the `bool`.
+ auto bool_ty = args[2]->Type();
+ auto val_ty = args[0]->Type();
- b.InsertBefore(call, [&] {
- auto* elm_ty = vec->Type();
- for (uint32_t i = 0; i < vec->Width(); i++) {
- auto* false_ = b.Swizzle(elm_ty, args[0], {i})->Result(0);
- auto* true_ = b.Swizzle(elm_ty, args[1], {i})->Result(0);
- auto* cond = b.Swizzle(elm_ty, args[2], {i})->Result(0);
+ b.InsertBefore(call, [&] {
+ core::ir::Value* cond = args[2];
+ if (val_ty->Is<core::type::Vector>() && !bool_ty->Is<core::type::Vector>()) {
+ cond = b.Construct(ty.MatchWidth(ty.bool_(), val_ty), cond)->Result(0);
+ }
- auto* ternary = b.ir.CreateInstruction<glsl::ir::Ternary>(
- b.InstructionResult(elm_ty),
- Vector<core::ir::Value*, 3>{false_, true_, cond});
- ternary->InsertBefore(call);
-
- construct_args.Push(ternary->Result(0));
- }
-
- b.ConstructWithResult(call->DetachResult(), construct_args);
- });
-
- } else {
- auto* ternary = b.ir.CreateInstruction<glsl::ir::Ternary>(call->DetachResult(), args);
- ternary->InsertBefore(call);
- }
+ b.CallWithResult<glsl::ir::BuiltinCall>(call->DetachResult(), glsl::BuiltinFn::kMix,
+ args[0], args[1], cond);
+ });
call->Destroy();
}
diff --git a/src/tint/lang/glsl/writer/raise/builtin_polyfill_test.cc b/src/tint/lang/glsl/writer/raise/builtin_polyfill_test.cc
index fad2c27..f692dc6 100644
--- a/src/tint/lang/glsl/writer/raise/builtin_polyfill_test.cc
+++ b/src/tint/lang/glsl/writer/raise/builtin_polyfill_test.cc
@@ -66,7 +66,7 @@
auto* expect = R"(
%foo = func():f32 {
$B1: {
- %2:f32 = glsl.ternary 2.0f, 1.0f, false
+ %2:f32 = glsl.mix 2.0f, 1.0f, false
ret %2
}
}
@@ -98,20 +98,8 @@
auto* expect = R"(
%foo = func():vec3<f32> {
$B1: {
- %2:f32 = swizzle vec3<f32>(2.0f), x
- %3:f32 = swizzle vec3<f32>(1.0f), x
- %4:f32 = swizzle vec3<bool>(false), x
- %5:f32 = glsl.ternary %2, %3, %4
- %6:f32 = swizzle vec3<f32>(2.0f), y
- %7:f32 = swizzle vec3<f32>(1.0f), y
- %8:f32 = swizzle vec3<bool>(false), y
- %9:f32 = glsl.ternary %6, %7, %8
- %10:f32 = swizzle vec3<f32>(2.0f), z
- %11:f32 = swizzle vec3<f32>(1.0f), z
- %12:f32 = swizzle vec3<bool>(false), z
- %13:f32 = glsl.ternary %10, %11, %12
- %14:vec3<f32> = construct %5, %9, %13
- ret %14
+ %2:vec3<f32> = glsl.mix vec3<f32>(2.0f), vec3<f32>(1.0f), vec3<bool>(false)
+ ret %2
}
}
)";
diff --git a/test/tint/access/ptr.wgsl.expected.glsl b/test/tint/access/ptr.wgsl.expected.glsl
index a09f07e..1cd882f 100644
--- a/test/tint/access/ptr.wgsl.expected.glsl
+++ b/test/tint/access/ptr.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
shared int g1;
diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl
index b5e3e3d..75f5620 100644
--- a/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl
+++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl
@@ -1,11 +1,11 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
shared ivec4 dst[4];
diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.glsl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.glsl
index 9ec4ec0..2222ca8 100644
--- a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.glsl
+++ b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
struct Inner {
diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.glsl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.glsl
index 3e68afd..87fba46 100644
--- a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.glsl
+++ b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.glsl
@@ -35,7 +35,7 @@
int tint_symbol_1;
} v;
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void tint_symbol_inner(uint idx) {
float scalar_f32 = sb.arr[idx].scalar_f32;
diff --git a/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.glsl b/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.glsl
index 6d9916a..ea887de 100644
--- a/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.glsl
+++ b/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
struct Inner {
diff --git a/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.ir.glsl b/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.ir.glsl
index 3c64087..ae39b12 100644
--- a/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.ir.glsl
+++ b/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.ir.glsl
@@ -50,10 +50,10 @@
int tint_symbol_1;
} v;
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
int tint_f16_to_i32(float16_t value) {
- return (((value <= 65504.0hf)) ? ((((value >= -65504.0hf)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -65504.0hf)), (value <= 65504.0hf));
}
void tint_symbol_inner(uint idx) {
float scalar_f32 = sb.arr[idx].scalar_f32;
diff --git a/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl b/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl
index d764eec..f645b37 100644
--- a/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl
+++ b/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
struct Inner {
diff --git a/test/tint/buffer/storage/static_index/read.wgsl.expected.ir.glsl b/test/tint/buffer/storage/static_index/read.wgsl.expected.ir.glsl
index b0f5505..742eac7 100644
--- a/test/tint/buffer/storage/static_index/read.wgsl.expected.ir.glsl
+++ b/test/tint/buffer/storage/static_index/read.wgsl.expected.ir.glsl
@@ -42,7 +42,7 @@
int tint_symbol_3;
} v_1;
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/buffer/storage/static_index/read_f16.wgsl.expected.glsl b/test/tint/buffer/storage/static_index/read_f16.wgsl.expected.glsl
index 5d825ff..45ca1a5 100644
--- a/test/tint/buffer/storage/static_index/read_f16.wgsl.expected.glsl
+++ b/test/tint/buffer/storage/static_index/read_f16.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
struct Inner {
diff --git a/test/tint/buffer/storage/static_index/read_f16.wgsl.expected.ir.glsl b/test/tint/buffer/storage/static_index/read_f16.wgsl.expected.ir.glsl
index 61203f5..7e624b7 100644
--- a/test/tint/buffer/storage/static_index/read_f16.wgsl.expected.ir.glsl
+++ b/test/tint/buffer/storage/static_index/read_f16.wgsl.expected.ir.glsl
@@ -58,10 +58,10 @@
int tint_symbol_3;
} v_1;
int tint_f16_to_i32(float16_t value) {
- return (((value <= 65504.0hf)) ? ((((value >= -65504.0hf)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -65504.0hf)), (value <= 65504.0hf));
}
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl
index 49c3529..6cca3ad 100644
--- a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
struct Inner {
diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.ir.glsl b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.ir.glsl
index 24d5626..2cf1a79 100644
--- a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.ir.glsl
+++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.ir.glsl
@@ -51,7 +51,7 @@
int tint_symbol_3;
} v_1;
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void tint_symbol_inner(uint idx) {
float scalar_f32 = v.tint_symbol_1.arr[idx].scalar_f32;
diff --git a/test/tint/buffer/uniform/dynamic_index/read_f16.wgsl.expected.glsl b/test/tint/buffer/uniform/dynamic_index/read_f16.wgsl.expected.glsl
index e23114e..fb36dad 100644
--- a/test/tint/buffer/uniform/dynamic_index/read_f16.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/dynamic_index/read_f16.wgsl.expected.glsl
@@ -9,7 +9,7 @@
};
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
struct Inner {
diff --git a/test/tint/buffer/uniform/dynamic_index/read_f16.wgsl.expected.ir.glsl b/test/tint/buffer/uniform/dynamic_index/read_f16.wgsl.expected.ir.glsl
index 78b86f2..8ad7aba 100644
--- a/test/tint/buffer/uniform/dynamic_index/read_f16.wgsl.expected.ir.glsl
+++ b/test/tint/buffer/uniform/dynamic_index/read_f16.wgsl.expected.ir.glsl
@@ -91,10 +91,10 @@
int tint_symbol_3;
} v_1;
int tint_f16_to_i32(float16_t value) {
- return (((value <= 65504.0hf)) ? ((((value >= -65504.0hf)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -65504.0hf)), (value <= 65504.0hf));
}
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void tint_symbol_inner(uint idx) {
float scalar_f32 = v.tint_symbol_1.arr[idx].scalar_f32;
diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl b/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl
index ffc7bc7..f35cb6e 100644
--- a/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
struct Inner {
diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.ir.glsl b/test/tint/buffer/uniform/static_index/read.wgsl.expected.ir.glsl
index efc91e6..14a3fb8 100644
--- a/test/tint/buffer/uniform/static_index/read.wgsl.expected.ir.glsl
+++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.ir.glsl
@@ -54,7 +54,7 @@
int tint_symbol_3;
} v_1;
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/buffer/uniform/static_index/read_f16.wgsl.expected.glsl b/test/tint/buffer/uniform/static_index/read_f16.wgsl.expected.glsl
index 5b52620..43f647d 100644
--- a/test/tint/buffer/uniform/static_index/read_f16.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/static_index/read_f16.wgsl.expected.glsl
@@ -9,7 +9,7 @@
};
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
struct Inner {
diff --git a/test/tint/buffer/uniform/static_index/read_f16.wgsl.expected.ir.glsl b/test/tint/buffer/uniform/static_index/read_f16.wgsl.expected.ir.glsl
index e88d019..595907f 100644
--- a/test/tint/buffer/uniform/static_index/read_f16.wgsl.expected.ir.glsl
+++ b/test/tint/buffer/uniform/static_index/read_f16.wgsl.expected.ir.glsl
@@ -95,10 +95,10 @@
int tint_symbol_3;
} v_1;
int tint_f16_to_i32(float16_t value) {
- return (((value <= 65504.0hf)) ? ((((value >= -65504.0hf)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -65504.0hf)), (value <= 65504.0hf));
}
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.glsl b/test/tint/bug/chromium/1273230.wgsl.expected.glsl
index 2cab808..23fa4e7 100644
--- a/test/tint/bug/chromium/1273230.wgsl.expected.glsl
+++ b/test/tint/bug/chromium/1273230.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_ftou(vec3 v) {
- return tint_select(uvec3(4294967295u), tint_select(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
+ return mix(uvec3(4294967295u), mix(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
}
struct Uniforms {
diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.ir.glsl b/test/tint/bug/chromium/1273230.wgsl.expected.ir.glsl
index a549330..07b193a 100644
--- a/test/tint/bug/chromium/1273230.wgsl.expected.ir.glsl
+++ b/test/tint/bug/chromium/1273230.wgsl.expected.ir.glsl
@@ -63,14 +63,8 @@
}
uvec3 tint_v3f32_to_v3u32(vec3 value) {
uvec3 v_3 = uvec3(value);
- bvec3 v_4 = greaterThanEqual(value, vec3(0.0f));
- uint v_5 = ((v_4.x) ? (v_3.x) : (uvec3(0u).x));
- uint v_6 = ((v_4.y) ? (v_3.y) : (uvec3(0u).y));
- uvec3 v_7 = uvec3(v_5, v_6, ((v_4.z) ? (v_3.z) : (uvec3(0u).z)));
- bvec3 v_8 = lessThanEqual(value, vec3(4294967040.0f));
- uint v_9 = ((v_8.x) ? (v_7.x) : (uvec3(4294967295u).x));
- uint v_10 = ((v_8.y) ? (v_7.y) : (uvec3(4294967295u).y));
- return uvec3(v_9, v_10, ((v_8.z) ? (v_7.z) : (uvec3(4294967295u).z)));
+ uvec3 v_4 = mix(uvec3(0u), v_3, greaterThanEqual(value, vec3(0.0f)));
+ return mix(uvec3(4294967295u), v_4, lessThanEqual(value, vec3(4294967040.0f)));
}
uint toIndex1D(uint gridSize, vec3 voxelPos) {
uvec3 icoord = tint_v3f32_to_v3u32(voxelPos);
diff --git a/test/tint/bug/chromium/1386647.wgsl.expected.glsl b/test/tint/bug/chromium/1386647.wgsl.expected.glsl
index 8f7b5c8..3e620df 100644
--- a/test/tint/bug/chromium/1386647.wgsl.expected.glsl
+++ b/test/tint/bug/chromium/1386647.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
void f(uvec3 v) {
diff --git a/test/tint/bug/chromium/1386647.wgsl.expected.ir.glsl b/test/tint/bug/chromium/1386647.wgsl.expected.ir.glsl
index a449f88..6c96696 100644
--- a/test/tint/bug/chromium/1386647.wgsl.expected.ir.glsl
+++ b/test/tint/bug/chromium/1386647.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod_u32(uint lhs, uint rhs) {
- uint v_1 = (((rhs == 0u)) ? (1u) : (rhs));
+ uint v_1 = mix(rhs, 1u, (rhs == 0u));
return (lhs - ((lhs / v_1) * v_1));
}
void f_inner(uvec3 v) {
diff --git a/test/tint/bug/tint/1083.wgsl.expected.glsl b/test/tint/bug/tint/1083.wgsl.expected.glsl
index c5d5cd0..5d26b53 100644
--- a/test/tint/bug/tint/1083.wgsl.expected.glsl
+++ b/test/tint/bug/tint/1083.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void f() {
diff --git a/test/tint/bug/tint/1083.wgsl.expected.ir.glsl b/test/tint/bug/tint/1083.wgsl.expected.ir.glsl
index 4a6c53f..d587a6b 100644
--- a/test/tint/bug/tint/1083.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/1083.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- return (lhs / ((bool((v_2 | uint(v_1)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_2 | uint(v_1)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/bug/tint/1113.wgsl.expected.glsl b/test/tint/bug/tint/1113.wgsl.expected.glsl
index 5b10f04..9c10a14 100644
--- a/test/tint/bug/tint/1113.wgsl.expected.glsl
+++ b/test/tint/bug/tint/1113.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_ftou(vec3 v) {
- return tint_select(uvec3(4294967295u), tint_select(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
+ return mix(uvec3(4294967295u), mix(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
}
struct Uniforms {
@@ -203,13 +198,8 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_ftou(vec3 v) {
- return tint_select(uvec3(4294967295u), tint_select(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
+ return mix(uvec3(4294967295u), mix(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
}
struct Uniforms {
diff --git a/test/tint/bug/tint/1113.wgsl.expected.ir.glsl b/test/tint/bug/tint/1113.wgsl.expected.ir.glsl
index 67f20f4..7cb94f4 100644
--- a/test/tint/bug/tint/1113.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/1113.wgsl.expected.ir.glsl
@@ -63,14 +63,8 @@
}
uvec3 tint_v3f32_to_v3u32(vec3 value) {
uvec3 v_3 = uvec3(value);
- bvec3 v_4 = greaterThanEqual(value, vec3(0.0f));
- uint v_5 = ((v_4.x) ? (v_3.x) : (uvec3(0u).x));
- uint v_6 = ((v_4.y) ? (v_3.y) : (uvec3(0u).y));
- uvec3 v_7 = uvec3(v_5, v_6, ((v_4.z) ? (v_3.z) : (uvec3(0u).z)));
- bvec3 v_8 = lessThanEqual(value, vec3(4294967040.0f));
- uint v_9 = ((v_8.x) ? (v_7.x) : (uvec3(4294967295u).x));
- uint v_10 = ((v_8.y) ? (v_7.y) : (uvec3(4294967295u).y));
- return uvec3(v_9, v_10, ((v_8.z) ? (v_7.z) : (uvec3(4294967295u).z)));
+ uvec3 v_4 = mix(uvec3(0u), v_3, greaterThanEqual(value, vec3(0.0f)));
+ return mix(uvec3(4294967295u), v_4, lessThanEqual(value, vec3(4294967040.0f)));
}
uint toIndex1D(uint gridSize, vec3 voxelPos) {
uvec3 icoord = tint_v3f32_to_v3u32(voxelPos);
@@ -257,14 +251,8 @@
}
uvec3 tint_v3f32_to_v3u32(vec3 value) {
uvec3 v_3 = uvec3(value);
- bvec3 v_4 = greaterThanEqual(value, vec3(0.0f));
- uint v_5 = ((v_4.x) ? (v_3.x) : (uvec3(0u).x));
- uint v_6 = ((v_4.y) ? (v_3.y) : (uvec3(0u).y));
- uvec3 v_7 = uvec3(v_5, v_6, ((v_4.z) ? (v_3.z) : (uvec3(0u).z)));
- bvec3 v_8 = lessThanEqual(value, vec3(4294967040.0f));
- uint v_9 = ((v_8.x) ? (v_7.x) : (uvec3(4294967295u).x));
- uint v_10 = ((v_8.y) ? (v_7.y) : (uvec3(4294967295u).y));
- return uvec3(v_9, v_10, ((v_8.z) ? (v_7.z) : (uvec3(4294967295u).z)));
+ uvec3 v_4 = mix(uvec3(0u), v_3, greaterThanEqual(value, vec3(0.0f)));
+ return mix(uvec3(4294967295u), v_4, lessThanEqual(value, vec3(4294967040.0f)));
}
uint toIndex1D(uint gridSize, vec3 voxelPos) {
uvec3 icoord = tint_v3f32_to_v3u32(voxelPos);
diff --git a/test/tint/bug/tint/1520.spvasm.expected.glsl b/test/tint/bug/tint/1520.spvasm.expected.glsl
index 3017acd..5b67445 100644
--- a/test/tint/bug/tint/1520.spvasm.expected.glsl
+++ b/test/tint/bug/tint/1520.spvasm.expected.glsl
@@ -2,13 +2,8 @@
precision highp float;
precision highp int;
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
layout(location = 0) in vec4 vcolor_S0_param_1;
@@ -35,7 +30,7 @@
bool sk_Clockwise = false;
vec4 vcolor_S0 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
ivec4 tint_div(ivec4 lhs, ivec4 rhs) {
- return (lhs / tint_select(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4((-2147483647 - 1)))) & uvec4(equal(rhs, ivec4(-1))))))));
+ return (lhs / mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4((-2147483647 - 1)))) & uvec4(equal(rhs, ivec4(-1))))))));
}
bool test_int_S1_c0_b() {
diff --git a/test/tint/bug/tint/1520.spvasm.expected.ir.glsl b/test/tint/bug/tint/1520.spvasm.expected.ir.glsl
index 7f8fb0a..b744f97 100644
--- a/test/tint/bug/tint/1520.spvasm.expected.ir.glsl
+++ b/test/tint/bug/tint/1520.spvasm.expected.ir.glsl
@@ -32,14 +32,10 @@
uvec4 v_4 = uvec4(v_2);
bvec4 v_5 = bvec4((v_4 & uvec4(v_3)));
uvec4 v_6 = uvec4(v_1);
- bvec4 v_7 = bvec4((v_6 | uvec4(v_5)));
- int v_8 = ((v_7.x) ? (ivec4(1).x) : (rhs.x));
- int v_9 = ((v_7.y) ? (ivec4(1).y) : (rhs.y));
- int v_10 = ((v_7.z) ? (ivec4(1).z) : (rhs.z));
- return (lhs / ivec4(v_8, v_9, v_10, ((v_7.w) ? (ivec4(1).w) : (rhs.w))));
+ return (lhs / mix(rhs, ivec4(1), bvec4((v_6 | uvec4(v_5)))));
}
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
bool test_int_S1_c0_b() {
int unknown = 0;
diff --git a/test/tint/bug/tint/1541.wgsl.expected.glsl b/test/tint/bug/tint/1541.wgsl.expected.glsl
index f2ae0aa3..758237f 100644
--- a/test/tint/bug/tint/1541.wgsl.expected.glsl
+++ b/test/tint/bug/tint/1541.wgsl.expected.glsl
@@ -2,7 +2,7 @@
void tint_symbol() {
bool a = true;
- bool v = (false ? true : bool(uint(a) & uint(true)));
+ bool v = mix(bool(uint(a) & uint(true)), true, false);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/bug/tint/1541.wgsl.expected.ir.glsl b/test/tint/bug/tint/1541.wgsl.expected.ir.glsl
index 6e5dd07..ee0f835 100644
--- a/test/tint/bug/tint/1541.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/1541.wgsl.expected.ir.glsl
@@ -4,5 +4,5 @@
void main() {
bool a = true;
uint v_1 = uint(a);
- bool v = ((false) ? (true) : (bool((v_1 & uint(true)))));
+ bool v = mix(bool((v_1 & uint(true))), true, false);
}
diff --git a/test/tint/bug/tint/1739.wgsl.expected.glsl b/test/tint/bug/tint/1739.wgsl.expected.glsl
index 392a797..c7209c1 100644
--- a/test/tint/bug/tint/1739.wgsl.expected.glsl
+++ b/test/tint/bug/tint/1739.wgsl.expected.glsl
@@ -1,16 +1,7 @@
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -75,7 +66,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
diff --git a/test/tint/bug/tint/1739.wgsl.expected.ir.glsl b/test/tint/bug/tint/1739.wgsl.expected.ir.glsl
index 263ebf0..fa128cf 100644
--- a/test/tint/bug/tint/1739.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/1739.wgsl.expected.ir.glsl
@@ -65,48 +65,45 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
- tint_ExternalTextureParams v_23 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
- vec4 red = tint_TextureLoadExternal(t_plane0, t_plane1, v_23, min(uvec2(ivec2(10)), ((v_23.visibleSize + uvec2(1u)) - uvec2(1u))));
+ tint_ExternalTextureParams v_20 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
+ vec4 red = tint_TextureLoadExternal(t_plane0, t_plane1, v_20, min(uvec2(ivec2(10)), ((v_20.visibleSize + uvec2(1u)) - uvec2(1u))));
imageStore(outImage, ivec2(0), red);
- tint_ExternalTextureParams v_24 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
- vec4 green = tint_TextureLoadExternal(t_plane0, t_plane1, v_24, min(uvec2(ivec2(70, 118)), ((v_24.visibleSize + uvec2(1u)) - uvec2(1u))));
+ tint_ExternalTextureParams v_21 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
+ vec4 green = tint_TextureLoadExternal(t_plane0, t_plane1, v_21, min(uvec2(ivec2(70, 118)), ((v_21.visibleSize + uvec2(1u)) - uvec2(1u))));
imageStore(outImage, ivec2(1, 0), green);
}
diff --git a/test/tint/bug/tint/1820.wgsl.expected.glsl b/test/tint/bug/tint/1820.wgsl.expected.glsl
index 6f5b2d1..63d8b54 100644
--- a/test/tint/bug/tint/1820.wgsl.expected.glsl
+++ b/test/tint/bug/tint/1820.wgsl.expected.glsl
@@ -5,7 +5,7 @@
return;
}
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
void foo(float x) {
diff --git a/test/tint/bug/tint/1820.wgsl.expected.ir.glsl b/test/tint/bug/tint/1820.wgsl.expected.ir.glsl
index 507e56c..0fc32fb 100644
--- a/test/tint/bug/tint/1820.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/1820.wgsl.expected.ir.glsl
@@ -2,7 +2,7 @@
int global = 0;
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void foo(float x) {
switch(tint_f32_to_i32(x)) {
diff --git a/test/tint/bug/tint/2054.wgsl.expected.glsl b/test/tint/bug/tint/2054.wgsl.expected.glsl
index 0216cd0..ac877b9 100644
--- a/test/tint/bug/tint/2054.wgsl.expected.glsl
+++ b/test/tint/bug/tint/2054.wgsl.expected.glsl
@@ -12,7 +12,7 @@
tint_tmp = (b >= 0.0f);
}
bool cond = (tint_tmp);
- p = (cond ? b : a);
+ p = mix(a, b, cond);
}
void foo() {
diff --git a/test/tint/bug/tint/2054.wgsl.expected.ir.glsl b/test/tint/bug/tint/2054.wgsl.expected.ir.glsl
index 134745e..279cb50 100644
--- a/test/tint/bug/tint/2054.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/2054.wgsl.expected.ir.glsl
@@ -14,7 +14,7 @@
v_1 = false;
}
bool cond = v_1;
- p = ((cond) ? (b) : (a));
+ p = mix(a, b, cond);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/bug/tint/221.wgsl.expected.glsl b/test/tint/bug/tint/221.wgsl.expected.glsl
index eebf44d..9ac4fcf 100644
--- a/test/tint/bug/tint/221.wgsl.expected.glsl
+++ b/test/tint/bug/tint/221.wgsl.expected.glsl
@@ -10,7 +10,7 @@
} b;
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
void tint_symbol() {
diff --git a/test/tint/bug/tint/349310442.wgsl.expected.glsl b/test/tint/bug/tint/349310442.wgsl.expected.glsl
index 5bbe649..9632065 100644
--- a/test/tint/bug/tint/349310442.wgsl.expected.glsl
+++ b/test/tint/bug/tint/349310442.wgsl.expected.glsl
@@ -1,16 +1,7 @@
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -74,7 +65,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
diff --git a/test/tint/bug/tint/349310442.wgsl.expected.ir.glsl b/test/tint/bug/tint/349310442.wgsl.expected.ir.glsl
index 97891cd..0fccbff 100644
--- a/test/tint/bug/tint/349310442.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/349310442.wgsl.expected.ir.glsl
@@ -64,44 +64,41 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
- tint_ExternalTextureParams v_23 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol);
- vec4 r = tint_TextureLoadExternal(t_plane0, t_plane1, v_23, uvec2(ivec2(0)));
+ tint_ExternalTextureParams v_20 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol);
+ vec4 r = tint_TextureLoadExternal(t_plane0, t_plane1, v_20, uvec2(ivec2(0)));
}
diff --git a/test/tint/bug/tint/534.wgsl.expected.glsl b/test/tint/bug/tint/534.wgsl.expected.glsl
index 82733f7..b5bdedb 100644
--- a/test/tint/bug/tint/534.wgsl.expected.glsl
+++ b/test/tint/bug/tint/534.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_ftou(vec4 v) {
- return tint_select(uvec4(4294967295u), tint_select(uvec4(v), uvec4(0u), lessThan(v, vec4(0.0f))), lessThanEqual(v, vec4(4294967040.0f)));
+ return mix(uvec4(4294967295u), mix(uvec4(v), uvec4(0u), lessThan(v, vec4(0.0f))), lessThanEqual(v, vec4(4294967040.0f)));
}
struct Uniforms {
diff --git a/test/tint/bug/tint/534.wgsl.expected.ir.glsl b/test/tint/bug/tint/534.wgsl.expected.ir.glsl
index f751812..cca3e96 100644
--- a/test/tint/bug/tint/534.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/534.wgsl.expected.ir.glsl
@@ -23,16 +23,8 @@
}
uvec4 tint_v4f32_to_v4u32(vec4 value) {
uvec4 v_1 = uvec4(value);
- bvec4 v_2 = greaterThanEqual(value, vec4(0.0f));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual(value, vec4(4294967040.0f));
- uint v_8 = ((v_7.x) ? (v_6.x) : (uvec4(4294967295u).x));
- uint v_9 = ((v_7.y) ? (v_6.y) : (uvec4(4294967295u).y));
- uint v_10 = ((v_7.z) ? (v_6.z) : (uvec4(4294967295u).z));
- return uvec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (uvec4(4294967295u).w)));
+ uvec4 v_2 = mix(uvec4(0u), v_1, greaterThanEqual(value, vec4(0.0f)));
+ return mix(uvec4(4294967295u), v_2, lessThanEqual(value, vec4(4294967040.0f)));
}
void tint_symbol_1_inner(uvec3 GlobalInvocationID) {
uvec2 size = uvec2(textureSize(src, 0));
@@ -41,10 +33,10 @@
if ((v.tint_symbol_2.dstTextureFlipY == 1u)) {
srcTexCoord[1u] = ((size.y - dstTexCoord.y) - 1u);
}
- ivec2 v_11 = ivec2(srcTexCoord);
- vec4 srcColor = texelFetch(src, v_11, int(0));
- ivec2 v_12 = ivec2(dstTexCoord);
- vec4 dstColor = texelFetch(dst, v_12, int(0));
+ ivec2 v_3 = ivec2(srcTexCoord);
+ vec4 srcColor = texelFetch(src, v_3, int(0));
+ ivec2 v_4 = ivec2(dstTexCoord);
+ vec4 dstColor = texelFetch(dst, v_4, int(0));
bool success = true;
uvec4 srcColorBits = uvec4(0u);
uvec4 dstColorBits = tint_v4f32_to_v4u32(dstColor);
@@ -55,15 +47,15 @@
} else {
break;
}
- uint v_13 = i;
- srcColorBits[v_13] = ConvertToFp16FloatValue(srcColor[i]);
- bool v_14 = false;
+ uint v_5 = i;
+ srcColorBits[v_5] = ConvertToFp16FloatValue(srcColor[i]);
+ bool v_6 = false;
if (success) {
- v_14 = (srcColorBits[i] == dstColorBits[i]);
+ v_6 = (srcColorBits[i] == dstColorBits[i]);
} else {
- v_14 = false;
+ v_6 = false;
}
- success = v_14;
+ success = v_6;
{
i = (i + 1u);
}
diff --git a/test/tint/bug/tint/914.wgsl.expected.glsl b/test/tint/bug/tint/914.wgsl.expected.glsl
index 9d009fe..92edcc6 100644
--- a/test/tint/bug/tint/914.wgsl.expected.glsl
+++ b/test/tint/bug/tint/914.wgsl.expected.glsl
@@ -1,11 +1,11 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
shared float mm_Asub[64][64];
diff --git a/test/tint/bug/tint/922.wgsl.expected.glsl b/test/tint/bug/tint/922.wgsl.expected.glsl
index 3b70006..2c2eaaa 100644
--- a/test/tint/bug/tint/922.wgsl.expected.glsl
+++ b/test/tint/bug/tint/922.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
layout(location = 0) in vec3 a_Position_1;
diff --git a/test/tint/bug/tint/922.wgsl.expected.ir.glsl b/test/tint/bug/tint/922.wgsl.expected.ir.glsl
index a46d6ba..e4666db 100644
--- a/test/tint/bug/tint/922.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/922.wgsl.expected.ir.glsl
@@ -126,7 +126,7 @@
return x_e15;
}
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void main1() {
Mat4x3_ t_PosMtx = Mat4x3_(vec4(0.0f), vec4(0.0f), vec4(0.0f));
diff --git a/test/tint/bug/tint/942.wgsl.expected.glsl b/test/tint/bug/tint/942.wgsl.expected.glsl
index bdca6b5..212bbbb 100644
--- a/test/tint/bug/tint/942.wgsl.expected.glsl
+++ b/test/tint/bug/tint/942.wgsl.expected.glsl
@@ -1,11 +1,11 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
shared vec3 tile[4][256];
diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl
index b80ebf5..e739c41 100644
--- a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl
+++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl
@@ -1,11 +1,11 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
shared uint wg[3][2][1];
diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.ir.glsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.ir.glsl
index 64be95f..7b39cdf 100644
--- a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.ir.glsl
+++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.ir.glsl
@@ -3,11 +3,11 @@
uint local_invocation_index_1 = 0u;
shared uint wg[3][2][1];
uint tint_mod_u32(uint lhs, uint rhs) {
- uint v = (((rhs == 0u)) ? (1u) : (rhs));
+ uint v = mix(rhs, 1u, (rhs == 0u));
return (lhs - ((lhs / v) * v));
}
uint tint_div_u32(uint lhs, uint rhs) {
- return (lhs / (((rhs == 0u)) ? (1u) : (rhs)));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
void compute_main_inner(uint local_invocation_index_2) {
uint idx = 0u;
diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.glsl b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.glsl
index 035955b..de5fe45 100644
--- a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.glsl
+++ b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.glsl
@@ -1,11 +1,11 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
shared uint wg[3][2][1];
diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl
index b80ebf5..e739c41 100644
--- a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl
+++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl
@@ -1,11 +1,11 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
shared uint wg[3][2][1];
diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.ir.glsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.ir.glsl
index 64be95f..7b39cdf 100644
--- a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.ir.glsl
+++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.ir.glsl
@@ -3,11 +3,11 @@
uint local_invocation_index_1 = 0u;
shared uint wg[3][2][1];
uint tint_mod_u32(uint lhs, uint rhs) {
- uint v = (((rhs == 0u)) ? (1u) : (rhs));
+ uint v = mix(rhs, 1u, (rhs == 0u));
return (lhs - ((lhs / v) * v));
}
uint tint_div_u32(uint lhs, uint rhs) {
- return (lhs / (((rhs == 0u)) ? (1u) : (rhs)));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
void compute_main_inner(uint local_invocation_index_2) {
uint idx = 0u;
diff --git a/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.glsl b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.glsl
index 035955b..de5fe45 100644
--- a/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.glsl
+++ b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.glsl
@@ -1,11 +1,11 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
shared uint wg[3][2][1];
diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.glsl
index 37b97dc..f9c0ce3 100644
--- a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int all_353d6a() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int all_353d6a() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int all_353d6a() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.ir.glsl
index 6f4ca6c..ca3c1f4 100644
--- a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int all_353d6a() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = all_353d6a();
@@ -21,7 +21,7 @@
} v;
int all_353d6a() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int all_353d6a() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.glsl
index b7e85dc..89b96d3 100644
--- a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int all_986c7b() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int all_986c7b() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int all_986c7b() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.ir.glsl
index 9ebc101..0a1bb14 100644
--- a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int all_986c7b() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = all_986c7b();
@@ -21,7 +21,7 @@
} v;
int all_986c7b() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int all_986c7b() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.glsl
index 149636c..e1016a1 100644
--- a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int all_bd2dba() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int all_bd2dba() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int all_bd2dba() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.ir.glsl
index 2a57521..93b24df 100644
--- a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int all_bd2dba() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = all_bd2dba();
@@ -21,7 +21,7 @@
} v;
int all_bd2dba() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int all_bd2dba() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.glsl b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.glsl
index 9644585..ed23fcd 100644
--- a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int all_f46790() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int all_f46790() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int all_f46790() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.ir.glsl
index 3f80215..b2536ba 100644
--- a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int all_f46790() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = all_f46790();
@@ -21,7 +21,7 @@
} v;
int all_f46790() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int all_f46790() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.glsl b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.glsl
index d000953..34a20d4 100644
--- a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int any_083428() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int any_083428() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int any_083428() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.ir.glsl
index e8891fa..188be35 100644
--- a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int any_083428() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = any_083428();
@@ -21,7 +21,7 @@
} v;
int any_083428() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int any_083428() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.glsl b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.glsl
index 63d836f..521770b 100644
--- a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int any_0e3e58() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int any_0e3e58() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int any_0e3e58() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.ir.glsl
index 075d96e..787ddb6 100644
--- a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int any_0e3e58() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = any_0e3e58();
@@ -21,7 +21,7 @@
} v;
int any_0e3e58() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int any_0e3e58() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.glsl
index 672fd18..adf3bc6 100644
--- a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int any_2ab91a() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int any_2ab91a() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int any_2ab91a() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.ir.glsl
index 2b84aa8..42e9262 100644
--- a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int any_2ab91a() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = any_2ab91a();
@@ -21,7 +21,7 @@
} v;
int any_2ab91a() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int any_2ab91a() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.glsl
index 54d0a6d..b94e554 100644
--- a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int any_e755c1() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int any_e755c1() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int any_e755c1() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.ir.glsl
index c6565d9..794399f 100644
--- a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int any_e755c1() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = any_e755c1();
@@ -21,7 +21,7 @@
} v;
int any_e755c1() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int any_e755c1() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.glsl
index 99024a5..f7cf01c 100644
--- a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int select_3c25ce() {
bvec3 res = bvec3(true);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int select_3c25ce() {
bvec3 res = bvec3(true);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int select_3c25ce() {
bvec3 res = bvec3(true);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.ir.glsl
index 9a846bd..33d466e 100644
--- a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int select_3c25ce() {
bvec3 res = bvec3(true);
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
void main() {
v.tint_symbol = select_3c25ce();
@@ -21,7 +21,7 @@
} v;
int select_3c25ce() {
bvec3 res = bvec3(true);
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int select_3c25ce() {
bvec3 res = bvec3(true);
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.glsl
index 06fe469..e371283 100644
--- a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int select_80a9a9() {
bvec3 res = bvec3(true);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int select_80a9a9() {
bvec3 res = bvec3(true);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int select_80a9a9() {
bvec3 res = bvec3(true);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.ir.glsl
index a92ed86..d5f1298 100644
--- a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int select_80a9a9() {
bvec3 res = bvec3(true);
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
void main() {
v.tint_symbol = select_80a9a9();
@@ -21,7 +21,7 @@
} v;
int select_80a9a9() {
bvec3 res = bvec3(true);
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int select_80a9a9() {
bvec3 res = bvec3(true);
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.glsl
index 186e8a2..134c68b 100644
--- a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int select_c31f9e() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int select_c31f9e() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int select_c31f9e() {
bool res = true;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.ir.glsl
index 5fedd41..f2653b5 100644
--- a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int select_c31f9e() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = select_c31f9e();
@@ -21,7 +21,7 @@
} v;
int select_c31f9e() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int select_c31f9e() {
bool res = true;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.glsl
index a15b745..1d98cb2 100644
--- a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int select_c41bd1() {
bvec4 res = bvec4(true);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int select_c41bd1() {
bvec4 res = bvec4(true);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int select_c41bd1() {
bvec4 res = bvec4(true);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.ir.glsl
index b22fb8e..40a52a7 100644
--- a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int select_c41bd1() {
bvec4 res = bvec4(true);
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
void main() {
v.tint_symbol = select_c41bd1();
@@ -21,7 +21,7 @@
} v;
int select_c41bd1() {
bvec4 res = bvec4(true);
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int select_c41bd1() {
bvec4 res = bvec4(true);
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.glsl
index a01cc04..3910807 100644
--- a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int select_cb9301() {
bvec2 res = bvec2(true);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int select_cb9301() {
bvec2 res = bvec2(true);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int select_cb9301() {
bvec2 res = bvec2(true);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.ir.glsl
index a3b829f..1ef4314 100644
--- a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int select_cb9301() {
bvec2 res = bvec2(true);
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
void main() {
v.tint_symbol = select_cb9301();
@@ -21,7 +21,7 @@
} v;
int select_cb9301() {
bvec2 res = bvec2(true);
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int select_cb9301() {
bvec2 res = bvec2(true);
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.glsl
index 31d0539..30e376e 100644
--- a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int select_e3e028() {
bvec4 res = bvec4(true);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int select_e3e028() {
bvec4 res = bvec4(true);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int select_e3e028() {
bvec4 res = bvec4(true);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.ir.glsl
index 31d406a..9d01c27 100644
--- a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int select_e3e028() {
bvec4 res = bvec4(true);
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
void main() {
v.tint_symbol = select_e3e028();
@@ -21,7 +21,7 @@
} v;
int select_e3e028() {
bvec4 res = bvec4(true);
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int select_e3e028() {
bvec4 res = bvec4(true);
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.glsl
index d780c8f..cc6ff2f 100644
--- a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int select_fb7e53() {
bvec2 res = bvec2(true);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int select_fb7e53() {
bvec2 res = bvec2(true);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int select_fb7e53() {
bvec2 res = bvec2(true);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.ir.glsl
index 24c233b..e8badb4 100644
--- a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int select_fb7e53() {
bvec2 res = bvec2(true);
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
void main() {
v.tint_symbol = select_fb7e53();
@@ -21,7 +21,7 @@
} v;
int select_fb7e53() {
bvec2 res = bvec2(true);
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int select_fb7e53() {
bvec2 res = bvec2(true);
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
index 95d4ef8..5a16fbc 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
@@ -2,17 +2,8 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -80,7 +71,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
@@ -127,17 +118,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -205,7 +187,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
@@ -253,17 +235,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
layout(location = 0) flat out vec4 prevent_dce_1;
@@ -328,7 +301,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.ir.glsl
index f6fe91b..4ab78ff 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.ir.glsl
@@ -70,41 +70,38 @@
vec3 v_5 = abs(v);
vec3 v_6 = sign(v);
bvec3 v_7 = lessThan(v_5, v_4);
- vec3 v_8 = (v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E));
- float v_9 = ((v_7.x) ? ((v_6 * ((params.C * v_5) + params.F)).x) : (v_8.x));
- float v_10 = ((v_7.y) ? ((v_6 * ((params.C * v_5) + params.F)).y) : (v_8.y));
- return vec3(v_9, v_10, ((v_7.z) ? ((v_6 * ((params.C * v_5) + params.F)).z) : (v_8.z)));
+ return mix((v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E)), (v_6 * ((params.C * v_5) + params.F)), v_7);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_11 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_12 = uvec2(v_11);
- vec3 v_13 = vec3(0.0f);
- float v_14 = 0.0f;
+ vec2 v_8 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_9 = uvec2(v_8);
+ vec3 v_10 = vec3(0.0f);
+ float v_11 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_15 = ivec2(v_12);
- vec4 v_16 = texelFetch(plane_0, v_15, int(0u));
- v_13 = v_16.xyz;
- v_14 = v_16[3u];
+ ivec2 v_12 = ivec2(v_9);
+ vec4 v_13 = texelFetch(plane_0, v_12, int(0u));
+ v_10 = v_13.xyz;
+ v_11 = v_13[3u];
} else {
- ivec2 v_17 = ivec2(v_12);
- float v_18 = texelFetch(plane_0, v_17, int(0u))[0u];
- ivec2 v_19 = ivec2(uvec2((v_11 * params.plane1CoordFactor)));
- v_13 = (vec4(v_18, texelFetch(plane_1, v_19, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_14 = 1.0f;
+ ivec2 v_14 = ivec2(v_9);
+ float v_15 = texelFetch(plane_0, v_14, int(0u))[0u];
+ ivec2 v_16 = ivec2(uvec2((v_8 * params.plane1CoordFactor)));
+ v_10 = (vec4(v_15, texelFetch(plane_1, v_16, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_11 = 1.0f;
}
- vec3 v_20 = v_13;
- vec3 v_21 = vec3(0.0f);
+ vec3 v_17 = v_10;
+ vec3 v_18 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_21 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_20, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_18 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_17, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_21 = v_20;
+ v_18 = v_17;
}
- return vec4(v_21, v_14);
+ return vec4(v_18, v_11);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_22 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_23 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_22, v_23, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_19 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_20 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_19, v_20, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_1bfdfb() {
vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2), uvec2(1u));
@@ -183,41 +180,38 @@
vec3 v_5 = abs(v);
vec3 v_6 = sign(v);
bvec3 v_7 = lessThan(v_5, v_4);
- vec3 v_8 = (v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E));
- float v_9 = ((v_7.x) ? ((v_6 * ((params.C * v_5) + params.F)).x) : (v_8.x));
- float v_10 = ((v_7.y) ? ((v_6 * ((params.C * v_5) + params.F)).y) : (v_8.y));
- return vec3(v_9, v_10, ((v_7.z) ? ((v_6 * ((params.C * v_5) + params.F)).z) : (v_8.z)));
+ return mix((v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E)), (v_6 * ((params.C * v_5) + params.F)), v_7);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_11 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_12 = uvec2(v_11);
- vec3 v_13 = vec3(0.0f);
- float v_14 = 0.0f;
+ vec2 v_8 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_9 = uvec2(v_8);
+ vec3 v_10 = vec3(0.0f);
+ float v_11 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_15 = ivec2(v_12);
- vec4 v_16 = texelFetch(plane_0, v_15, int(0u));
- v_13 = v_16.xyz;
- v_14 = v_16[3u];
+ ivec2 v_12 = ivec2(v_9);
+ vec4 v_13 = texelFetch(plane_0, v_12, int(0u));
+ v_10 = v_13.xyz;
+ v_11 = v_13[3u];
} else {
- ivec2 v_17 = ivec2(v_12);
- float v_18 = texelFetch(plane_0, v_17, int(0u))[0u];
- ivec2 v_19 = ivec2(uvec2((v_11 * params.plane1CoordFactor)));
- v_13 = (vec4(v_18, texelFetch(plane_1, v_19, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_14 = 1.0f;
+ ivec2 v_14 = ivec2(v_9);
+ float v_15 = texelFetch(plane_0, v_14, int(0u))[0u];
+ ivec2 v_16 = ivec2(uvec2((v_8 * params.plane1CoordFactor)));
+ v_10 = (vec4(v_15, texelFetch(plane_1, v_16, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_11 = 1.0f;
}
- vec3 v_20 = v_13;
- vec3 v_21 = vec3(0.0f);
+ vec3 v_17 = v_10;
+ vec3 v_18 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_21 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_20, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_18 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_17, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_21 = v_20;
+ v_18 = v_17;
}
- return vec4(v_21, v_14);
+ return vec4(v_18, v_11);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_22 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_23 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_22, v_23, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_19 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_20 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_19, v_20, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_1bfdfb() {
vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2), uvec2(1u));
@@ -299,41 +293,38 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_1bfdfb() {
vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1), uvec2(1u));
@@ -346,10 +337,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_23 = vertex_main_inner();
- gl_Position = v_23.pos;
+ VertexOutput v_20 = vertex_main_inner();
+ gl_Position = v_20.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_23.prevent_dce;
+ vertex_main_loc0_Output = v_20.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl
index 75f080b..bfbc61b 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl
@@ -2,17 +2,8 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -80,7 +71,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
@@ -127,17 +118,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -205,7 +187,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
@@ -253,17 +235,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
layout(location = 0) flat out vec4 prevent_dce_1;
@@ -328,7 +301,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.ir.glsl
index 1805059..b1861ad 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.ir.glsl
@@ -70,45 +70,42 @@
vec3 v_5 = abs(v);
vec3 v_6 = sign(v);
bvec3 v_7 = lessThan(v_5, v_4);
- vec3 v_8 = (v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E));
- float v_9 = ((v_7.x) ? ((v_6 * ((params.C * v_5) + params.F)).x) : (v_8.x));
- float v_10 = ((v_7.y) ? ((v_6 * ((params.C * v_5) + params.F)).y) : (v_8.y));
- return vec3(v_9, v_10, ((v_7.z) ? ((v_6 * ((params.C * v_5) + params.F)).z) : (v_8.z)));
+ return mix((v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E)), (v_6 * ((params.C * v_5) + params.F)), v_7);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_11 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_12 = uvec2(v_11);
- vec3 v_13 = vec3(0.0f);
- float v_14 = 0.0f;
+ vec2 v_8 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_9 = uvec2(v_8);
+ vec3 v_10 = vec3(0.0f);
+ float v_11 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_15 = ivec2(v_12);
- vec4 v_16 = texelFetch(plane_0, v_15, int(0u));
- v_13 = v_16.xyz;
- v_14 = v_16[3u];
+ ivec2 v_12 = ivec2(v_9);
+ vec4 v_13 = texelFetch(plane_0, v_12, int(0u));
+ v_10 = v_13.xyz;
+ v_11 = v_13[3u];
} else {
- ivec2 v_17 = ivec2(v_12);
- float v_18 = texelFetch(plane_0, v_17, int(0u))[0u];
- ivec2 v_19 = ivec2(uvec2((v_11 * params.plane1CoordFactor)));
- v_13 = (vec4(v_18, texelFetch(plane_1, v_19, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_14 = 1.0f;
+ ivec2 v_14 = ivec2(v_9);
+ float v_15 = texelFetch(plane_0, v_14, int(0u))[0u];
+ ivec2 v_16 = ivec2(uvec2((v_8 * params.plane1CoordFactor)));
+ v_10 = (vec4(v_15, texelFetch(plane_1, v_16, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_11 = 1.0f;
}
- vec3 v_20 = v_13;
- vec3 v_21 = vec3(0.0f);
+ vec3 v_17 = v_10;
+ vec3 v_18 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_21 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_20, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_18 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_17, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_21 = v_20;
+ v_18 = v_17;
}
- return vec4(v_21, v_14);
+ return vec4(v_18, v_11);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_22 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_23 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_22, v_23, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_19 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_20 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_19, v_20, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_8acf41() {
- tint_ExternalTextureParams v_24 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_24, uvec2(ivec2(1)));
+ tint_ExternalTextureParams v_21 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_21, uvec2(ivec2(1)));
return res;
}
void main() {
@@ -184,45 +181,42 @@
vec3 v_5 = abs(v);
vec3 v_6 = sign(v);
bvec3 v_7 = lessThan(v_5, v_4);
- vec3 v_8 = (v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E));
- float v_9 = ((v_7.x) ? ((v_6 * ((params.C * v_5) + params.F)).x) : (v_8.x));
- float v_10 = ((v_7.y) ? ((v_6 * ((params.C * v_5) + params.F)).y) : (v_8.y));
- return vec3(v_9, v_10, ((v_7.z) ? ((v_6 * ((params.C * v_5) + params.F)).z) : (v_8.z)));
+ return mix((v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E)), (v_6 * ((params.C * v_5) + params.F)), v_7);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_11 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_12 = uvec2(v_11);
- vec3 v_13 = vec3(0.0f);
- float v_14 = 0.0f;
+ vec2 v_8 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_9 = uvec2(v_8);
+ vec3 v_10 = vec3(0.0f);
+ float v_11 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_15 = ivec2(v_12);
- vec4 v_16 = texelFetch(plane_0, v_15, int(0u));
- v_13 = v_16.xyz;
- v_14 = v_16[3u];
+ ivec2 v_12 = ivec2(v_9);
+ vec4 v_13 = texelFetch(plane_0, v_12, int(0u));
+ v_10 = v_13.xyz;
+ v_11 = v_13[3u];
} else {
- ivec2 v_17 = ivec2(v_12);
- float v_18 = texelFetch(plane_0, v_17, int(0u))[0u];
- ivec2 v_19 = ivec2(uvec2((v_11 * params.plane1CoordFactor)));
- v_13 = (vec4(v_18, texelFetch(plane_1, v_19, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_14 = 1.0f;
+ ivec2 v_14 = ivec2(v_9);
+ float v_15 = texelFetch(plane_0, v_14, int(0u))[0u];
+ ivec2 v_16 = ivec2(uvec2((v_8 * params.plane1CoordFactor)));
+ v_10 = (vec4(v_15, texelFetch(plane_1, v_16, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_11 = 1.0f;
}
- vec3 v_20 = v_13;
- vec3 v_21 = vec3(0.0f);
+ vec3 v_17 = v_10;
+ vec3 v_18 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_21 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_20, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_18 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_17, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_21 = v_20;
+ v_18 = v_17;
}
- return vec4(v_21, v_14);
+ return vec4(v_18, v_11);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_22 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_23 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_22, v_23, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_19 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_20 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_19, v_20, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_8acf41() {
- tint_ExternalTextureParams v_24 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_24, uvec2(ivec2(1)));
+ tint_ExternalTextureParams v_21 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_21, uvec2(ivec2(1)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -301,45 +295,42 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_8acf41() {
- tint_ExternalTextureParams v_23 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_23, uvec2(ivec2(1)));
+ tint_ExternalTextureParams v_20 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_20, uvec2(ivec2(1)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -349,10 +340,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_24 = vertex_main_inner();
- gl_Position = v_24.pos;
+ VertexOutput v_21 = vertex_main_inner();
+ gl_Position = v_21.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_24.prevent_dce;
+ vertex_main_loc0_Output = v_21.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
index 1c882c1..e208e2d 100644
--- a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
struct GammaTransferParams {
float G;
float A;
@@ -72,7 +67,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select(f, t, cond);
+ return mix(f, t, cond);
}
@@ -120,11 +115,6 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
struct GammaTransferParams {
float G;
float A;
@@ -190,7 +180,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select(f, t, cond);
+ return mix(f, t, cond);
}
@@ -239,11 +229,6 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(location = 0) flat out vec4 prevent_dce_1;
struct GammaTransferParams {
float G;
@@ -306,7 +291,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select(f, t, cond);
+ return mix(f, t, cond);
}
diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl
index 20a763b..efea3a9 100644
--- a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_06794e() {
f16mat3 res = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_06794e() {
f16mat3 res = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_06794e() {
f16mat3 res = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.ir.glsl
index 821d6ad..c1e7026 100644
--- a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_06794e() {
f16mat3 res = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_06794e();
@@ -23,7 +23,7 @@
} v;
int transpose_06794e() {
f16mat3 res = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_06794e() {
f16mat3 res = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.glsl
index 2392376..c069179 100644
--- a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_2585cd() {
mat3x4 res = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_2585cd() {
mat3x4 res = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_2585cd() {
mat3x4 res = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.ir.glsl
index cafebfd..e9e1533 100644
--- a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_2585cd() {
mat3x4 res = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_2585cd();
@@ -21,7 +21,7 @@
} v;
int transpose_2585cd() {
mat3x4 res = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_2585cd() {
mat3x4 res = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.glsl
index 39a6af8..1f71eed 100644
--- a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_31d679() {
mat2 res = mat2(vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_31d679() {
mat2 res = mat2(vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_31d679() {
mat2 res = mat2(vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.ir.glsl
index 2f669ab..931d2ff 100644
--- a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_31d679() {
mat2 res = mat2(vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_31d679();
@@ -21,7 +21,7 @@
} v;
int transpose_31d679() {
mat2 res = mat2(vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_31d679() {
mat2 res = mat2(vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.glsl
index f02dbdd..d6909ce 100644
--- a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_31e37e() {
mat2x4 res = mat2x4(vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_31e37e() {
mat2x4 res = mat2x4(vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_31e37e() {
mat2x4 res = mat2x4(vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.ir.glsl
index 2899a36..828379d 100644
--- a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_31e37e() {
mat2x4 res = mat2x4(vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_31e37e();
@@ -21,7 +21,7 @@
} v;
int transpose_31e37e() {
mat2x4 res = mat2x4(vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_31e37e() {
mat2x4 res = mat2x4(vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.glsl
index ebae6fd..af4cace 100644
--- a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_4ce359() {
mat4x2 res = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_4ce359() {
mat4x2 res = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_4ce359() {
mat4x2 res = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.ir.glsl
index f236a88..43abb95 100644
--- a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_4ce359() {
mat4x2 res = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_4ce359();
@@ -21,7 +21,7 @@
} v;
int transpose_4ce359() {
mat4x2 res = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_4ce359() {
mat4x2 res = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.glsl
index 39e0fea..e8f5735 100644
--- a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_4dc9a1() {
mat3x2 res = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_4dc9a1() {
mat3x2 res = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_4dc9a1() {
mat3x2 res = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.ir.glsl
index 514c7c6..b8b5eac 100644
--- a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_4dc9a1() {
mat3x2 res = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_4dc9a1();
@@ -21,7 +21,7 @@
} v;
int transpose_4dc9a1() {
mat3x2 res = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_4dc9a1() {
mat3x2 res = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl
index 0086014..e0c2fa9 100644
--- a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_5edd96() {
f16mat2x4 res = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_5edd96() {
f16mat2x4 res = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_5edd96() {
f16mat2x4 res = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.ir.glsl
index d7a363d..d71a8ee 100644
--- a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_5edd96() {
f16mat2x4 res = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_5edd96();
@@ -23,7 +23,7 @@
} v;
int transpose_5edd96() {
f16mat2x4 res = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_5edd96() {
f16mat2x4 res = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl
index f83b579..82f886e 100644
--- a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_5f36bf() {
f16mat3x4 res = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_5f36bf() {
f16mat3x4 res = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_5f36bf() {
f16mat3x4 res = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.ir.glsl
index a204b65..d993919 100644
--- a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_5f36bf() {
f16mat3x4 res = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_5f36bf();
@@ -23,7 +23,7 @@
} v;
int transpose_5f36bf() {
f16mat3x4 res = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_5f36bf() {
f16mat3x4 res = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl
index cf97bcc..86735b6 100644
--- a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_7be8b2() {
f16mat2 res = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_7be8b2() {
f16mat2 res = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_7be8b2() {
f16mat2 res = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.ir.glsl
index 44c8cb4..8588562 100644
--- a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_7be8b2() {
f16mat2 res = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_7be8b2();
@@ -23,7 +23,7 @@
} v;
int transpose_7be8b2() {
f16mat2 res = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_7be8b2() {
f16mat2 res = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl
index bbaaa76..501526f 100644
--- a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_844869() {
f16mat4 res = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_844869() {
f16mat4 res = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_844869() {
f16mat4 res = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.ir.glsl
index 497cc06..08941a7 100644
--- a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_844869() {
f16mat4 res = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_844869();
@@ -23,7 +23,7 @@
} v;
int transpose_844869() {
f16mat4 res = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_844869() {
f16mat4 res = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.glsl
index 7129515..4ef173c 100644
--- a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_854336() {
mat3 res = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_854336() {
mat3 res = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_854336() {
mat3 res = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.ir.glsl
index 9c9160e..e939a21 100644
--- a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_854336() {
mat3 res = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_854336();
@@ -21,7 +21,7 @@
} v;
int transpose_854336() {
mat3 res = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_854336() {
mat3 res = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl
index c47c3f5..b583b2b 100644
--- a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_8c06ce() {
f16mat4x3 res = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_8c06ce() {
f16mat4x3 res = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_8c06ce() {
f16mat4x3 res = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.ir.glsl
index 2c279cd..dfc8962 100644
--- a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_8c06ce() {
f16mat4x3 res = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_8c06ce();
@@ -23,7 +23,7 @@
} v;
int transpose_8c06ce() {
f16mat4x3 res = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_8c06ce() {
f16mat4x3 res = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl
index dfe460b..bfc1d8c 100644
--- a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_b9ad1f() {
f16mat2x3 res = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_b9ad1f() {
f16mat2x3 res = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_b9ad1f() {
f16mat2x3 res = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.ir.glsl
index e7b5522..337c29e 100644
--- a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_b9ad1f() {
f16mat2x3 res = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_b9ad1f();
@@ -23,7 +23,7 @@
} v;
int transpose_b9ad1f() {
f16mat2x3 res = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_b9ad1f() {
f16mat2x3 res = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.glsl
index 87cc708..22793f7 100644
--- a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_c1b600() {
mat4 res = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_c1b600() {
mat4 res = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_c1b600() {
mat4 res = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.ir.glsl
index a317a44..472fb11 100644
--- a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_c1b600() {
mat4 res = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_c1b600();
@@ -21,7 +21,7 @@
} v;
int transpose_c1b600() {
mat4 res = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_c1b600() {
mat4 res = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl
index 215aae63..2b4896f 100644
--- a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_d6faec() {
f16mat3x2 res = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_d6faec() {
f16mat3x2 res = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_d6faec() {
f16mat3x2 res = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.ir.glsl
index fdfc434..63cacf6 100644
--- a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_d6faec() {
f16mat3x2 res = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_d6faec();
@@ -23,7 +23,7 @@
} v;
int transpose_d6faec() {
f16mat3x2 res = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_d6faec() {
f16mat3x2 res = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.glsl
index 2a30310..2c9c961 100644
--- a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_d8f8ba() {
mat4x3 res = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_d8f8ba() {
mat4x3 res = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_d8f8ba() {
mat4x3 res = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.ir.glsl
index 7434a84..564b3b2 100644
--- a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_d8f8ba() {
mat4x3 res = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_d8f8ba();
@@ -21,7 +21,7 @@
} v;
int transpose_d8f8ba() {
mat4x3 res = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_d8f8ba() {
mat4x3 res = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.glsl
index ed5bddc..69637fa 100644
--- a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int transpose_ed4bdc() {
mat2x3 res = mat2x3(vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -32,7 +32,7 @@
int transpose_ed4bdc() {
mat2x3 res = mat2x3(vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -54,7 +54,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_ed4bdc() {
mat2x3 res = mat2x3(vec3(1.0f), vec3(1.0f));
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.ir.glsl
index 5b23c71..6d2795f 100644
--- a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
int transpose_ed4bdc() {
mat2x3 res = mat2x3(vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_ed4bdc();
@@ -21,7 +21,7 @@
} v;
int transpose_ed4bdc() {
mat2x3 res = mat2x3(vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -38,7 +38,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_ed4bdc() {
mat2x3 res = mat2x3(vec3(1.0f), vec3(1.0f));
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl
index effb099..db36689 100644
--- a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_faeb05() {
f16mat4x2 res = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_faeb05() {
f16mat4x2 res = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
layout(location = 0) flat out int prevent_dce_1;
int transpose_faeb05() {
f16mat4x2 res = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.ir.glsl
index 86b7aba..cd70fd9 100644
--- a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
} v;
int transpose_faeb05() {
f16mat4x2 res = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_faeb05();
@@ -23,7 +23,7 @@
} v;
int transpose_faeb05() {
f16mat4x2 res = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
layout(location = 0) flat out int vertex_main_loc0_Output;
int transpose_faeb05() {
f16mat4x2 res = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl
index f6f93e4..b5c4654 100644
--- a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl
@@ -3,13 +3,8 @@
precision highp float;
precision highp int;
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
f16vec2 tint_acosh(f16vec2 x) {
- return tint_select(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
+ return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -38,13 +33,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
f16vec2 tint_acosh(f16vec2 x) {
- return tint_select(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
+ return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -74,13 +64,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
f16vec2 tint_acosh(f16vec2 x) {
- return tint_select(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
+ return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
}
layout(location = 0) flat out f16vec2 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.glsl
index d2a1cf1..e255b42 100644
--- a/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.glsl
@@ -2,13 +2,8 @@
precision highp float;
precision highp int;
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
vec2 tint_acosh(vec2 x) {
- return tint_select(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
+ return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -36,13 +31,8 @@
}
#version 310 es
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
vec2 tint_acosh(vec2 x) {
- return tint_select(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
+ return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -71,13 +61,8 @@
}
#version 310 es
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
vec2 tint_acosh(vec2 x) {
- return tint_select(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
+ return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
}
layout(location = 0) flat out vec2 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl
index d85f988..1858ac3 100644
--- a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl
@@ -4,7 +4,7 @@
precision highp int;
float16_t tint_acosh(float16_t x) {
- return ((x < 1.0hf) ? 0.0hf : acosh(x));
+ return mix(acosh(x), 0.0hf, (x < 1.0hf));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -34,7 +34,7 @@
#extension GL_AMD_gpu_shader_half_float : require
float16_t tint_acosh(float16_t x) {
- return ((x < 1.0hf) ? 0.0hf : acosh(x));
+ return mix(acosh(x), 0.0hf, (x < 1.0hf));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -65,7 +65,7 @@
#extension GL_AMD_gpu_shader_half_float : require
float16_t tint_acosh(float16_t x) {
- return ((x < 1.0hf) ? 0.0hf : acosh(x));
+ return mix(acosh(x), 0.0hf, (x < 1.0hf));
}
layout(location = 0) flat out float16_t prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.glsl
index eeb845f..e9acf5b 100644
--- a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.glsl
@@ -2,13 +2,8 @@
precision highp float;
precision highp int;
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
vec4 tint_acosh(vec4 x) {
- return tint_select(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
+ return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -36,13 +31,8 @@
}
#version 310 es
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
vec4 tint_acosh(vec4 x) {
- return tint_select(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
+ return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -71,13 +61,8 @@
}
#version 310 es
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
vec4 tint_acosh(vec4 x) {
- return tint_select(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
+ return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
}
layout(location = 0) flat out vec4 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl
index c8c32ae..6a9d5f7 100644
--- a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl
@@ -3,13 +3,8 @@
precision highp float;
precision highp int;
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
f16vec4 tint_acosh(f16vec4 x) {
- return tint_select(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
+ return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -38,13 +33,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
f16vec4 tint_acosh(f16vec4 x) {
- return tint_select(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
+ return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -74,13 +64,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
f16vec4 tint_acosh(f16vec4 x) {
- return tint_select(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
+ return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
}
layout(location = 0) flat out f16vec4 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.glsl
index 1d42033..792c76f 100644
--- a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.glsl
@@ -2,13 +2,8 @@
precision highp float;
precision highp int;
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
vec3 tint_acosh(vec3 x) {
- return tint_select(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
+ return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -36,13 +31,8 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
vec3 tint_acosh(vec3 x) {
- return tint_select(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
+ return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -71,13 +61,8 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
vec3 tint_acosh(vec3 x) {
- return tint_select(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
+ return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
}
layout(location = 0) flat out vec3 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.glsl
index adde42f..5ede946 100644
--- a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.glsl
@@ -3,7 +3,7 @@
precision highp int;
float tint_acosh(float x) {
- return ((x < 1.0f) ? 0.0f : acosh(x));
+ return mix(acosh(x), 0.0f, (x < 1.0f));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -32,7 +32,7 @@
#version 310 es
float tint_acosh(float x) {
- return ((x < 1.0f) ? 0.0f : acosh(x));
+ return mix(acosh(x), 0.0f, (x < 1.0f));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -62,7 +62,7 @@
#version 310 es
float tint_acosh(float x) {
- return ((x < 1.0f) ? 0.0f : acosh(x));
+ return mix(acosh(x), 0.0f, (x < 1.0f));
}
layout(location = 0) flat out float prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl
index f2a70da..347bd8a 100644
--- a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl
@@ -3,13 +3,8 @@
precision highp float;
precision highp int;
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
f16vec3 tint_acosh(f16vec3 x) {
- return tint_select(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
+ return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -38,13 +33,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
f16vec3 tint_acosh(f16vec3 x) {
- return tint_select(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
+ return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -74,13 +64,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
f16vec3 tint_acosh(f16vec3 x) {
- return tint_select(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
+ return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
}
layout(location = 0) flat out f16vec3 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl
index 24e5968..56b4e36 100644
--- a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int all_353d6a() {
bool arg_0 = true;
bool res = arg_0;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int all_353d6a() {
bool arg_0 = true;
bool res = arg_0;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int all_353d6a() {
bool arg_0 = true;
bool res = arg_0;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.ir.glsl
index 7a0d2b4..df4322f 100644
--- a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int all_353d6a() {
bool arg_0 = true;
bool res = arg_0;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = all_353d6a();
@@ -23,7 +23,7 @@
int all_353d6a() {
bool arg_0 = true;
bool res = arg_0;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int all_353d6a() {
bool arg_0 = true;
bool res = arg_0;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl
index a586508..cb3b27d 100644
--- a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int all_986c7b() {
bvec4 arg_0 = bvec4(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int all_986c7b() {
bvec4 arg_0 = bvec4(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int all_986c7b() {
bvec4 arg_0 = bvec4(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.ir.glsl
index 2310f75..967b60c 100644
--- a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int all_986c7b() {
bvec4 arg_0 = bvec4(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = all_986c7b();
@@ -23,7 +23,7 @@
int all_986c7b() {
bvec4 arg_0 = bvec4(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int all_986c7b() {
bvec4 arg_0 = bvec4(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl
index 2d72edc..4ff6def 100644
--- a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int all_bd2dba() {
bvec3 arg_0 = bvec3(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int all_bd2dba() {
bvec3 arg_0 = bvec3(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int all_bd2dba() {
bvec3 arg_0 = bvec3(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.ir.glsl
index 2fcfd76..05745bd 100644
--- a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int all_bd2dba() {
bvec3 arg_0 = bvec3(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = all_bd2dba();
@@ -23,7 +23,7 @@
int all_bd2dba() {
bvec3 arg_0 = bvec3(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int all_bd2dba() {
bvec3 arg_0 = bvec3(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl
index f28a892..4cb5cc7 100644
--- a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int all_f46790() {
bvec2 arg_0 = bvec2(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int all_f46790() {
bvec2 arg_0 = bvec2(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int all_f46790() {
bvec2 arg_0 = bvec2(true);
bool res = all(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.ir.glsl
index 6e9845c2..353f61e 100644
--- a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int all_f46790() {
bvec2 arg_0 = bvec2(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = all_f46790();
@@ -23,7 +23,7 @@
int all_f46790() {
bvec2 arg_0 = bvec2(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int all_f46790() {
bvec2 arg_0 = bvec2(true);
bool res = all(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl
index 14003fb..fb7324e 100644
--- a/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int any_083428() {
bvec4 arg_0 = bvec4(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int any_083428() {
bvec4 arg_0 = bvec4(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int any_083428() {
bvec4 arg_0 = bvec4(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.ir.glsl
index 2810133..b4360ef 100644
--- a/test/tint/builtins/gen/var/any/083428.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int any_083428() {
bvec4 arg_0 = bvec4(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = any_083428();
@@ -23,7 +23,7 @@
int any_083428() {
bvec4 arg_0 = bvec4(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int any_083428() {
bvec4 arg_0 = bvec4(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl
index ed860af..b9a998c 100644
--- a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int any_0e3e58() {
bvec2 arg_0 = bvec2(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int any_0e3e58() {
bvec2 arg_0 = bvec2(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int any_0e3e58() {
bvec2 arg_0 = bvec2(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.ir.glsl
index bb41a92..8f45924 100644
--- a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int any_0e3e58() {
bvec2 arg_0 = bvec2(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = any_0e3e58();
@@ -23,7 +23,7 @@
int any_0e3e58() {
bvec2 arg_0 = bvec2(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int any_0e3e58() {
bvec2 arg_0 = bvec2(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl
index 1264524..103d19d 100644
--- a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int any_2ab91a() {
bool arg_0 = true;
bool res = arg_0;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int any_2ab91a() {
bool arg_0 = true;
bool res = arg_0;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int any_2ab91a() {
bool arg_0 = true;
bool res = arg_0;
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.ir.glsl
index cb7d977..3d7600e 100644
--- a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int any_2ab91a() {
bool arg_0 = true;
bool res = arg_0;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = any_2ab91a();
@@ -23,7 +23,7 @@
int any_2ab91a() {
bool arg_0 = true;
bool res = arg_0;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int any_2ab91a() {
bool arg_0 = true;
bool res = arg_0;
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl
index 37920e1..8f886bf 100644
--- a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int any_e755c1() {
bvec3 arg_0 = bvec3(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int any_e755c1() {
bvec3 arg_0 = bvec3(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int any_e755c1() {
bvec3 arg_0 = bvec3(true);
bool res = any(arg_0);
- return ((res == false) ? 1 : 0);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.ir.glsl
index bba4173..1fed475 100644
--- a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int any_e755c1() {
bvec3 arg_0 = bvec3(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = any_e755c1();
@@ -23,7 +23,7 @@
int any_e755c1() {
bvec3 arg_0 = bvec3(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int any_e755c1() {
bvec3 arg_0 = bvec3(true);
bool res = any(arg_0);
- return (((res == false)) ? (1) : (0));
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.glsl
index bd7271e..e864013 100644
--- a/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.glsl
@@ -2,13 +2,8 @@
precision highp float;
precision highp int;
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
vec3 tint_atanh(vec3 x) {
- return tint_select(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f)));
+ return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -36,13 +31,8 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
vec3 tint_atanh(vec3 x) {
- return tint_select(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f)));
+ return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -71,13 +61,8 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
vec3 tint_atanh(vec3 x) {
- return tint_select(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f)));
+ return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f)));
}
layout(location = 0) flat out vec3 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl
index 991f737..2b45802 100644
--- a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl
@@ -3,13 +3,8 @@
precision highp float;
precision highp int;
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
f16vec2 tint_atanh(f16vec2 x) {
- return tint_select(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf)));
+ return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -38,13 +33,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
f16vec2 tint_atanh(f16vec2 x) {
- return tint_select(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf)));
+ return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -74,13 +64,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
f16vec2 tint_atanh(f16vec2 x) {
- return tint_select(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf)));
+ return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf)));
}
layout(location = 0) flat out f16vec2 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.glsl
index 0058bd4..03f0040 100644
--- a/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.glsl
@@ -3,7 +3,7 @@
precision highp int;
float tint_atanh(float x) {
- return ((x >= 1.0f) ? 0.0f : atanh(x));
+ return mix(atanh(x), 0.0f, (x >= 1.0f));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -32,7 +32,7 @@
#version 310 es
float tint_atanh(float x) {
- return ((x >= 1.0f) ? 0.0f : atanh(x));
+ return mix(atanh(x), 0.0f, (x >= 1.0f));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -62,7 +62,7 @@
#version 310 es
float tint_atanh(float x) {
- return ((x >= 1.0f) ? 0.0f : atanh(x));
+ return mix(atanh(x), 0.0f, (x >= 1.0f));
}
layout(location = 0) flat out float prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.glsl
index e2fb840..ee45bf9 100644
--- a/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.glsl
@@ -2,13 +2,8 @@
precision highp float;
precision highp int;
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
vec2 tint_atanh(vec2 x) {
- return tint_select(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f)));
+ return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -36,13 +31,8 @@
}
#version 310 es
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
vec2 tint_atanh(vec2 x) {
- return tint_select(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f)));
+ return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -71,13 +61,8 @@
}
#version 310 es
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
vec2 tint_atanh(vec2 x) {
- return tint_select(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f)));
+ return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f)));
}
layout(location = 0) flat out vec2 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl
index e1f0401..ec10f81 100644
--- a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl
@@ -4,7 +4,7 @@
precision highp int;
float16_t tint_atanh(float16_t x) {
- return ((x >= 1.0hf) ? 0.0hf : atanh(x));
+ return mix(atanh(x), 0.0hf, (x >= 1.0hf));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -34,7 +34,7 @@
#extension GL_AMD_gpu_shader_half_float : require
float16_t tint_atanh(float16_t x) {
- return ((x >= 1.0hf) ? 0.0hf : atanh(x));
+ return mix(atanh(x), 0.0hf, (x >= 1.0hf));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -65,7 +65,7 @@
#extension GL_AMD_gpu_shader_half_float : require
float16_t tint_atanh(float16_t x) {
- return ((x >= 1.0hf) ? 0.0hf : atanh(x));
+ return mix(atanh(x), 0.0hf, (x >= 1.0hf));
}
layout(location = 0) flat out float16_t prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl
index 5c12582..deee37c 100644
--- a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl
@@ -3,13 +3,8 @@
precision highp float;
precision highp int;
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
f16vec4 tint_atanh(f16vec4 x) {
- return tint_select(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf)));
+ return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -38,13 +33,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
f16vec4 tint_atanh(f16vec4 x) {
- return tint_select(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf)));
+ return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -74,13 +64,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
f16vec4 tint_atanh(f16vec4 x) {
- return tint_select(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf)));
+ return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf)));
}
layout(location = 0) flat out f16vec4 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl
index 5993745..3e88c35 100644
--- a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl
@@ -3,13 +3,8 @@
precision highp float;
precision highp int;
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
f16vec3 tint_atanh(f16vec3 x) {
- return tint_select(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf)));
+ return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -38,13 +33,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
f16vec3 tint_atanh(f16vec3 x) {
- return tint_select(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf)));
+ return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -74,13 +64,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
f16vec3 tint_atanh(f16vec3 x) {
- return tint_select(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf)));
+ return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf)));
}
layout(location = 0) flat out f16vec3 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.glsl
index 8ada17a..a263800 100644
--- a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.glsl
@@ -2,13 +2,8 @@
precision highp float;
precision highp int;
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
vec4 tint_atanh(vec4 x) {
- return tint_select(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f)));
+ return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -36,13 +31,8 @@
}
#version 310 es
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
vec4 tint_atanh(vec4 x) {
- return tint_select(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f)));
+ return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f)));
}
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
@@ -71,13 +61,8 @@
}
#version 310 es
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
vec4 tint_atanh(vec4 x) {
- return tint_select(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f)));
+ return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f)));
}
layout(location = 0) flat out vec4 prevent_dce_1;
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl
index 2adc9e9..150c18c 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl
@@ -4,16 +4,16 @@
uint tint_count_leading_zeros(uint v) {
uint x = uint(v);
- uint b16 = ((x <= 65535u) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, (x <= 65535u));
x = (x << b16);
- uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, (x <= 16777215u));
x = (x << b8);
- uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, (x <= 268435455u));
x = (x << b4);
- uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, (x <= 1073741823u));
x = (x << b2);
- uint b1 = ((x <= 2147483647u) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(0u, 1u, (x <= 2147483647u));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -44,16 +44,16 @@
uint tint_count_leading_zeros(uint v) {
uint x = uint(v);
- uint b16 = ((x <= 65535u) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, (x <= 65535u));
x = (x << b16);
- uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, (x <= 16777215u));
x = (x << b8);
- uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, (x <= 268435455u));
x = (x << b4);
- uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, (x <= 1073741823u));
x = (x << b2);
- uint b1 = ((x <= 2147483647u) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(0u, 1u, (x <= 2147483647u));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -85,16 +85,16 @@
uint tint_count_leading_zeros(uint v) {
uint x = uint(v);
- uint b16 = ((x <= 65535u) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, (x <= 65535u));
x = (x << b16);
- uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, (x <= 16777215u));
x = (x << b8);
- uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, (x <= 268435455u));
x = (x << b4);
- uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, (x <= 1073741823u));
x = (x << b2);
- uint b1 = ((x <= 2147483647u) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(0u, 1u, (x <= 2147483647u));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.ir.glsl
index b1a9ac6..92ef7e5 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.ir.glsl
@@ -9,12 +9,12 @@
uint countLeadingZeros_208d46() {
uint arg_0 = 1u;
uint v_1 = arg_0;
- uint v_2 = (((v_1 <= 65535u)) ? (16u) : (0u));
- uint v_3 = ((((v_1 << v_2) <= 16777215u)) ? (8u) : (0u));
- uint v_4 = (((((v_1 << v_2) << v_3) <= 268435455u)) ? (4u) : (0u));
- uint v_5 = ((((((v_1 << v_2) << v_3) << v_4) <= 1073741823u)) ? (2u) : (0u));
- uint v_6 = (((((((v_1 << v_2) << v_3) << v_4) << v_5) <= 2147483647u)) ? (1u) : (0u));
- uint v_7 = (((((((v_1 << v_2) << v_3) << v_4) << v_5) == 0u)) ? (1u) : (0u));
+ uint v_2 = mix(0u, 16u, (v_1 <= 65535u));
+ uint v_3 = mix(0u, 8u, ((v_1 << v_2) <= 16777215u));
+ uint v_4 = mix(0u, 4u, (((v_1 << v_2) << v_3) <= 268435455u));
+ uint v_5 = mix(0u, 2u, ((((v_1 << v_2) << v_3) << v_4) <= 1073741823u));
+ uint v_6 = mix(0u, 1u, (((((v_1 << v_2) << v_3) << v_4) << v_5) <= 2147483647u));
+ uint v_7 = mix(0u, 1u, (((((v_1 << v_2) << v_3) << v_4) << v_5) == 0u));
uint res = ((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7);
return res;
}
@@ -30,12 +30,12 @@
uint countLeadingZeros_208d46() {
uint arg_0 = 1u;
uint v_1 = arg_0;
- uint v_2 = (((v_1 <= 65535u)) ? (16u) : (0u));
- uint v_3 = ((((v_1 << v_2) <= 16777215u)) ? (8u) : (0u));
- uint v_4 = (((((v_1 << v_2) << v_3) <= 268435455u)) ? (4u) : (0u));
- uint v_5 = ((((((v_1 << v_2) << v_3) << v_4) <= 1073741823u)) ? (2u) : (0u));
- uint v_6 = (((((((v_1 << v_2) << v_3) << v_4) << v_5) <= 2147483647u)) ? (1u) : (0u));
- uint v_7 = (((((((v_1 << v_2) << v_3) << v_4) << v_5) == 0u)) ? (1u) : (0u));
+ uint v_2 = mix(0u, 16u, (v_1 <= 65535u));
+ uint v_3 = mix(0u, 8u, ((v_1 << v_2) <= 16777215u));
+ uint v_4 = mix(0u, 4u, (((v_1 << v_2) << v_3) <= 268435455u));
+ uint v_5 = mix(0u, 2u, ((((v_1 << v_2) << v_3) << v_4) <= 1073741823u));
+ uint v_6 = mix(0u, 1u, (((((v_1 << v_2) << v_3) << v_4) << v_5) <= 2147483647u));
+ uint v_7 = mix(0u, 1u, (((((v_1 << v_2) << v_3) << v_4) << v_5) == 0u));
uint res = ((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7);
return res;
}
@@ -55,12 +55,12 @@
uint countLeadingZeros_208d46() {
uint arg_0 = 1u;
uint v = arg_0;
- uint v_1 = (((v <= 65535u)) ? (16u) : (0u));
- uint v_2 = ((((v << v_1) <= 16777215u)) ? (8u) : (0u));
- uint v_3 = (((((v << v_1) << v_2) <= 268435455u)) ? (4u) : (0u));
- uint v_4 = ((((((v << v_1) << v_2) << v_3) <= 1073741823u)) ? (2u) : (0u));
- uint v_5 = (((((((v << v_1) << v_2) << v_3) << v_4) <= 2147483647u)) ? (1u) : (0u));
- uint v_6 = (((((((v << v_1) << v_2) << v_3) << v_4) == 0u)) ? (1u) : (0u));
+ uint v_1 = mix(0u, 16u, (v <= 65535u));
+ uint v_2 = mix(0u, 8u, ((v << v_1) <= 16777215u));
+ uint v_3 = mix(0u, 4u, (((v << v_1) << v_2) <= 268435455u));
+ uint v_4 = mix(0u, 2u, ((((v << v_1) << v_2) << v_3) <= 1073741823u));
+ uint v_5 = mix(0u, 1u, (((((v << v_1) << v_2) << v_3) << v_4) <= 2147483647u));
+ uint v_6 = mix(0u, 1u, (((((v << v_1) << v_2) << v_3) << v_4) == 0u));
uint res = ((v_1 | (v_2 | (v_3 | (v_4 | (v_5 | v_6))))) + v_6);
return res;
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl
index dc809ab..473b641 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl
@@ -4,16 +4,16 @@
int tint_count_leading_zeros(int v) {
uint x = uint(v);
- uint b16 = ((x <= 65535u) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, (x <= 65535u));
x = (x << b16);
- uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, (x <= 16777215u));
x = (x << b8);
- uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, (x <= 268435455u));
x = (x << b4);
- uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, (x <= 1073741823u));
x = (x << b2);
- uint b1 = ((x <= 2147483647u) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(0u, 1u, (x <= 2147483647u));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -44,16 +44,16 @@
int tint_count_leading_zeros(int v) {
uint x = uint(v);
- uint b16 = ((x <= 65535u) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, (x <= 65535u));
x = (x << b16);
- uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, (x <= 16777215u));
x = (x << b8);
- uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, (x <= 268435455u));
x = (x << b4);
- uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, (x <= 1073741823u));
x = (x << b2);
- uint b1 = ((x <= 2147483647u) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(0u, 1u, (x <= 2147483647u));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -85,16 +85,16 @@
int tint_count_leading_zeros(int v) {
uint x = uint(v);
- uint b16 = ((x <= 65535u) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, (x <= 65535u));
x = (x << b16);
- uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, (x <= 16777215u));
x = (x << b8);
- uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, (x <= 268435455u));
x = (x << b4);
- uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, (x <= 1073741823u));
x = (x << b2);
- uint b1 = ((x <= 2147483647u) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(0u, 1u, (x <= 2147483647u));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.ir.glsl
index 475e9ea..97c1b86 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.ir.glsl
@@ -9,12 +9,12 @@
int countLeadingZeros_6d4656() {
int arg_0 = 1;
uint v_1 = uint(arg_0);
- uint v_2 = (((v_1 <= 65535u)) ? (16u) : (0u));
- uint v_3 = ((((v_1 << v_2) <= 16777215u)) ? (8u) : (0u));
- uint v_4 = (((((v_1 << v_2) << v_3) <= 268435455u)) ? (4u) : (0u));
- uint v_5 = ((((((v_1 << v_2) << v_3) << v_4) <= 1073741823u)) ? (2u) : (0u));
- uint v_6 = (((((((v_1 << v_2) << v_3) << v_4) << v_5) <= 2147483647u)) ? (1u) : (0u));
- uint v_7 = (((((((v_1 << v_2) << v_3) << v_4) << v_5) == 0u)) ? (1u) : (0u));
+ uint v_2 = mix(0u, 16u, (v_1 <= 65535u));
+ uint v_3 = mix(0u, 8u, ((v_1 << v_2) <= 16777215u));
+ uint v_4 = mix(0u, 4u, (((v_1 << v_2) << v_3) <= 268435455u));
+ uint v_5 = mix(0u, 2u, ((((v_1 << v_2) << v_3) << v_4) <= 1073741823u));
+ uint v_6 = mix(0u, 1u, (((((v_1 << v_2) << v_3) << v_4) << v_5) <= 2147483647u));
+ uint v_7 = mix(0u, 1u, (((((v_1 << v_2) << v_3) << v_4) << v_5) == 0u));
int res = int(((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7));
return res;
}
@@ -30,12 +30,12 @@
int countLeadingZeros_6d4656() {
int arg_0 = 1;
uint v_1 = uint(arg_0);
- uint v_2 = (((v_1 <= 65535u)) ? (16u) : (0u));
- uint v_3 = ((((v_1 << v_2) <= 16777215u)) ? (8u) : (0u));
- uint v_4 = (((((v_1 << v_2) << v_3) <= 268435455u)) ? (4u) : (0u));
- uint v_5 = ((((((v_1 << v_2) << v_3) << v_4) <= 1073741823u)) ? (2u) : (0u));
- uint v_6 = (((((((v_1 << v_2) << v_3) << v_4) << v_5) <= 2147483647u)) ? (1u) : (0u));
- uint v_7 = (((((((v_1 << v_2) << v_3) << v_4) << v_5) == 0u)) ? (1u) : (0u));
+ uint v_2 = mix(0u, 16u, (v_1 <= 65535u));
+ uint v_3 = mix(0u, 8u, ((v_1 << v_2) <= 16777215u));
+ uint v_4 = mix(0u, 4u, (((v_1 << v_2) << v_3) <= 268435455u));
+ uint v_5 = mix(0u, 2u, ((((v_1 << v_2) << v_3) << v_4) <= 1073741823u));
+ uint v_6 = mix(0u, 1u, (((((v_1 << v_2) << v_3) << v_4) << v_5) <= 2147483647u));
+ uint v_7 = mix(0u, 1u, (((((v_1 << v_2) << v_3) << v_4) << v_5) == 0u));
int res = int(((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7));
return res;
}
@@ -55,12 +55,12 @@
int countLeadingZeros_6d4656() {
int arg_0 = 1;
uint v = uint(arg_0);
- uint v_1 = (((v <= 65535u)) ? (16u) : (0u));
- uint v_2 = ((((v << v_1) <= 16777215u)) ? (8u) : (0u));
- uint v_3 = (((((v << v_1) << v_2) <= 268435455u)) ? (4u) : (0u));
- uint v_4 = ((((((v << v_1) << v_2) << v_3) <= 1073741823u)) ? (2u) : (0u));
- uint v_5 = (((((((v << v_1) << v_2) << v_3) << v_4) <= 2147483647u)) ? (1u) : (0u));
- uint v_6 = (((((((v << v_1) << v_2) << v_3) << v_4) == 0u)) ? (1u) : (0u));
+ uint v_1 = mix(0u, 16u, (v <= 65535u));
+ uint v_2 = mix(0u, 8u, ((v << v_1) <= 16777215u));
+ uint v_3 = mix(0u, 4u, (((v << v_1) << v_2) <= 268435455u));
+ uint v_4 = mix(0u, 2u, ((((v << v_1) << v_2) << v_3) <= 1073741823u));
+ uint v_5 = mix(0u, 1u, (((((v << v_1) << v_2) << v_3) << v_4) <= 2147483647u));
+ uint v_6 = mix(0u, 1u, (((((v << v_1) << v_2) << v_3) << v_4) == 0u));
int res = int(((v_1 | (v_2 | (v_3 | (v_4 | (v_5 | v_6))))) + v_6));
return res;
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl
index 929eb68..5cdb903 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_count_leading_zeros(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
x = (x << b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
x = (x << b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
x = (x << b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
x = (x << b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_count_leading_zeros(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
x = (x << b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
x = (x << b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
x = (x << b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
x = (x << b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_count_leading_zeros(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
x = (x << b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
x = (x << b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
x = (x << b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
x = (x << b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.ir.glsl
index 42c719d..b57380c 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.ir.glsl
@@ -9,25 +9,13 @@
uvec2 countLeadingZeros_70783f() {
uvec2 arg_0 = uvec2(1u);
uvec2 v_1 = arg_0;
- bvec2 v_2 = lessThanEqual(v_1, uvec2(65535u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = lessThanEqual((v_1 << v_4), uvec2(16777215u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = lessThanEqual(((v_1 << v_4) << v_7), uvec2(268435455u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = lessThanEqual((((v_1 << v_4) << v_7) << v_10), uvec2(1073741823u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = lessThanEqual(((((v_1 << v_4) << v_7) << v_10) << v_13), uvec2(2147483647u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_17 = equal(((((v_1 << v_4) << v_7) << v_10) << v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_19 = uvec2(v_18, ((v_17.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- uvec2 res = ((v_4 | (v_7 | (v_10 | (v_13 | (v_16 | v_19))))) + v_19);
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), lessThanEqual(v_1, uvec2(65535u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), lessThanEqual((v_1 << v_2), uvec2(16777215u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec2(268435455u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec2(1073741823u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec2(2147483647u)));
+ uvec2 v_7 = mix(uvec2(0u), uvec2(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec2(0u)));
+ uvec2 res = ((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7);
return res;
}
void main() {
@@ -42,25 +30,13 @@
uvec2 countLeadingZeros_70783f() {
uvec2 arg_0 = uvec2(1u);
uvec2 v_1 = arg_0;
- bvec2 v_2 = lessThanEqual(v_1, uvec2(65535u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = lessThanEqual((v_1 << v_4), uvec2(16777215u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = lessThanEqual(((v_1 << v_4) << v_7), uvec2(268435455u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = lessThanEqual((((v_1 << v_4) << v_7) << v_10), uvec2(1073741823u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = lessThanEqual(((((v_1 << v_4) << v_7) << v_10) << v_13), uvec2(2147483647u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_17 = equal(((((v_1 << v_4) << v_7) << v_10) << v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_19 = uvec2(v_18, ((v_17.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- uvec2 res = ((v_4 | (v_7 | (v_10 | (v_13 | (v_16 | v_19))))) + v_19);
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), lessThanEqual(v_1, uvec2(65535u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), lessThanEqual((v_1 << v_2), uvec2(16777215u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec2(268435455u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec2(1073741823u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec2(2147483647u)));
+ uvec2 v_7 = mix(uvec2(0u), uvec2(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec2(0u)));
+ uvec2 res = ((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -79,25 +55,13 @@
uvec2 countLeadingZeros_70783f() {
uvec2 arg_0 = uvec2(1u);
uvec2 v = arg_0;
- bvec2 v_1 = lessThanEqual(v, uvec2(65535u));
- uint v_2 = ((v_1.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_3 = uvec2(v_2, ((v_1.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_4 = lessThanEqual((v << v_3), uvec2(16777215u));
- uint v_5 = ((v_4.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_6 = uvec2(v_5, ((v_4.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_7 = lessThanEqual(((v << v_3) << v_6), uvec2(268435455u));
- uint v_8 = ((v_7.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_9 = uvec2(v_8, ((v_7.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_10 = lessThanEqual((((v << v_3) << v_6) << v_9), uvec2(1073741823u));
- uint v_11 = ((v_10.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_12 = uvec2(v_11, ((v_10.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_13 = lessThanEqual(((((v << v_3) << v_6) << v_9) << v_12), uvec2(2147483647u));
- uint v_14 = ((v_13.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_15 = uvec2(v_14, ((v_13.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_16 = equal(((((v << v_3) << v_6) << v_9) << v_12), uvec2(0u));
- uint v_17 = ((v_16.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_18 = uvec2(v_17, ((v_16.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- uvec2 res = ((v_3 | (v_6 | (v_9 | (v_12 | (v_15 | v_18))))) + v_18);
+ uvec2 v_1 = mix(uvec2(0u), uvec2(16u), lessThanEqual(v, uvec2(65535u)));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(8u), lessThanEqual((v << v_1), uvec2(16777215u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(4u), lessThanEqual(((v << v_1) << v_2), uvec2(268435455u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(2u), lessThanEqual((((v << v_1) << v_2) << v_3), uvec2(1073741823u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(1u), lessThanEqual(((((v << v_1) << v_2) << v_3) << v_4), uvec2(2147483647u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), equal(((((v << v_1) << v_2) << v_3) << v_4), uvec2(0u)));
+ uvec2 res = ((v_1 | (v_2 | (v_3 | (v_4 | (v_5 | v_6))))) + v_6);
return res;
}
VertexOutput vertex_main_inner() {
@@ -107,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_19 = vertex_main_inner();
- gl_Position = v_19.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_19.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl
index 5ec054e..80f1826 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_count_leading_zeros(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
x = (x << b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
x = (x << b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
x = (x << b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
x = (x << b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_count_leading_zeros(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
x = (x << b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
x = (x << b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
x = (x << b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
x = (x << b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_count_leading_zeros(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
x = (x << b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
x = (x << b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
x = (x << b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
x = (x << b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.ir.glsl
index f1c3ee0..a50a638 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.ir.glsl
@@ -9,31 +9,13 @@
ivec3 countLeadingZeros_7c38a6() {
ivec3 arg_0 = ivec3(1);
uvec3 v_1 = uvec3(arg_0);
- bvec3 v_2 = lessThanEqual(v_1, uvec3(65535u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = lessThanEqual((v_1 << v_5), uvec3(16777215u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = lessThanEqual(((v_1 << v_5) << v_9), uvec3(268435455u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = lessThanEqual((((v_1 << v_5) << v_9) << v_13), uvec3(1073741823u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = lessThanEqual(((((v_1 << v_5) << v_9) << v_13) << v_17), uvec3(2147483647u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_22 = equal(((((v_1 << v_5) << v_9) << v_13) << v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_24 = ((v_22.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_25 = uvec3(v_23, v_24, ((v_22.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- ivec3 res = ivec3(((v_5 | (v_9 | (v_13 | (v_17 | (v_21 | v_25))))) + v_25));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), lessThanEqual(v_1, uvec3(65535u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), lessThanEqual((v_1 << v_2), uvec3(16777215u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec3(268435455u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec3(1073741823u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec3(2147483647u)));
+ uvec3 v_7 = mix(uvec3(0u), uvec3(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec3(0u)));
+ ivec3 res = ivec3(((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7));
return res;
}
void main() {
@@ -48,31 +30,13 @@
ivec3 countLeadingZeros_7c38a6() {
ivec3 arg_0 = ivec3(1);
uvec3 v_1 = uvec3(arg_0);
- bvec3 v_2 = lessThanEqual(v_1, uvec3(65535u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = lessThanEqual((v_1 << v_5), uvec3(16777215u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = lessThanEqual(((v_1 << v_5) << v_9), uvec3(268435455u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = lessThanEqual((((v_1 << v_5) << v_9) << v_13), uvec3(1073741823u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = lessThanEqual(((((v_1 << v_5) << v_9) << v_13) << v_17), uvec3(2147483647u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_22 = equal(((((v_1 << v_5) << v_9) << v_13) << v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_24 = ((v_22.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_25 = uvec3(v_23, v_24, ((v_22.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- ivec3 res = ivec3(((v_5 | (v_9 | (v_13 | (v_17 | (v_21 | v_25))))) + v_25));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), lessThanEqual(v_1, uvec3(65535u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), lessThanEqual((v_1 << v_2), uvec3(16777215u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec3(268435455u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec3(1073741823u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec3(2147483647u)));
+ uvec3 v_7 = mix(uvec3(0u), uvec3(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec3(0u)));
+ ivec3 res = ivec3(((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -91,31 +55,13 @@
ivec3 countLeadingZeros_7c38a6() {
ivec3 arg_0 = ivec3(1);
uvec3 v = uvec3(arg_0);
- bvec3 v_1 = lessThanEqual(v, uvec3(65535u));
- uint v_2 = ((v_1.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_3 = ((v_1.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_4 = uvec3(v_2, v_3, ((v_1.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_5 = lessThanEqual((v << v_4), uvec3(16777215u));
- uint v_6 = ((v_5.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_7 = ((v_5.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_8 = uvec3(v_6, v_7, ((v_5.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_9 = lessThanEqual(((v << v_4) << v_8), uvec3(268435455u));
- uint v_10 = ((v_9.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_11 = ((v_9.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_12 = uvec3(v_10, v_11, ((v_9.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_13 = lessThanEqual((((v << v_4) << v_8) << v_12), uvec3(1073741823u));
- uint v_14 = ((v_13.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_15 = ((v_13.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_16 = uvec3(v_14, v_15, ((v_13.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_17 = lessThanEqual(((((v << v_4) << v_8) << v_12) << v_16), uvec3(2147483647u));
- uint v_18 = ((v_17.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_19 = ((v_17.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_20 = uvec3(v_18, v_19, ((v_17.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_21 = equal(((((v << v_4) << v_8) << v_12) << v_16), uvec3(0u));
- uint v_22 = ((v_21.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_23 = ((v_21.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_24 = uvec3(v_22, v_23, ((v_21.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- ivec3 res = ivec3(((v_4 | (v_8 | (v_12 | (v_16 | (v_20 | v_24))))) + v_24));
+ uvec3 v_1 = mix(uvec3(0u), uvec3(16u), lessThanEqual(v, uvec3(65535u)));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(8u), lessThanEqual((v << v_1), uvec3(16777215u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(4u), lessThanEqual(((v << v_1) << v_2), uvec3(268435455u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(2u), lessThanEqual((((v << v_1) << v_2) << v_3), uvec3(1073741823u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(1u), lessThanEqual(((((v << v_1) << v_2) << v_3) << v_4), uvec3(2147483647u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), equal(((((v << v_1) << v_2) << v_3) << v_4), uvec3(0u)));
+ ivec3 res = ivec3(((v_1 | (v_2 | (v_3 | (v_4 | (v_5 | v_6))))) + v_6));
return res;
}
VertexOutput vertex_main_inner() {
@@ -125,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_25 = vertex_main_inner();
- gl_Position = v_25.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_25.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl
index 74afb31..90ac6d0 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_count_leading_zeros(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
x = (x << b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
x = (x << b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
x = (x << b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
x = (x << b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_count_leading_zeros(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
x = (x << b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
x = (x << b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
x = (x << b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
x = (x << b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_count_leading_zeros(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
x = (x << b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
x = (x << b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
x = (x << b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
x = (x << b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.ir.glsl
index 5805ec7..a3df598 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.ir.glsl
@@ -9,25 +9,13 @@
ivec2 countLeadingZeros_858d40() {
ivec2 arg_0 = ivec2(1);
uvec2 v_1 = uvec2(arg_0);
- bvec2 v_2 = lessThanEqual(v_1, uvec2(65535u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = lessThanEqual((v_1 << v_4), uvec2(16777215u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = lessThanEqual(((v_1 << v_4) << v_7), uvec2(268435455u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = lessThanEqual((((v_1 << v_4) << v_7) << v_10), uvec2(1073741823u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = lessThanEqual(((((v_1 << v_4) << v_7) << v_10) << v_13), uvec2(2147483647u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_17 = equal(((((v_1 << v_4) << v_7) << v_10) << v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_19 = uvec2(v_18, ((v_17.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- ivec2 res = ivec2(((v_4 | (v_7 | (v_10 | (v_13 | (v_16 | v_19))))) + v_19));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), lessThanEqual(v_1, uvec2(65535u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), lessThanEqual((v_1 << v_2), uvec2(16777215u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec2(268435455u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec2(1073741823u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec2(2147483647u)));
+ uvec2 v_7 = mix(uvec2(0u), uvec2(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec2(0u)));
+ ivec2 res = ivec2(((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7));
return res;
}
void main() {
@@ -42,25 +30,13 @@
ivec2 countLeadingZeros_858d40() {
ivec2 arg_0 = ivec2(1);
uvec2 v_1 = uvec2(arg_0);
- bvec2 v_2 = lessThanEqual(v_1, uvec2(65535u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = lessThanEqual((v_1 << v_4), uvec2(16777215u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = lessThanEqual(((v_1 << v_4) << v_7), uvec2(268435455u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = lessThanEqual((((v_1 << v_4) << v_7) << v_10), uvec2(1073741823u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = lessThanEqual(((((v_1 << v_4) << v_7) << v_10) << v_13), uvec2(2147483647u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_17 = equal(((((v_1 << v_4) << v_7) << v_10) << v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_19 = uvec2(v_18, ((v_17.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- ivec2 res = ivec2(((v_4 | (v_7 | (v_10 | (v_13 | (v_16 | v_19))))) + v_19));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), lessThanEqual(v_1, uvec2(65535u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), lessThanEqual((v_1 << v_2), uvec2(16777215u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec2(268435455u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec2(1073741823u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec2(2147483647u)));
+ uvec2 v_7 = mix(uvec2(0u), uvec2(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec2(0u)));
+ ivec2 res = ivec2(((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -79,25 +55,13 @@
ivec2 countLeadingZeros_858d40() {
ivec2 arg_0 = ivec2(1);
uvec2 v = uvec2(arg_0);
- bvec2 v_1 = lessThanEqual(v, uvec2(65535u));
- uint v_2 = ((v_1.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_3 = uvec2(v_2, ((v_1.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_4 = lessThanEqual((v << v_3), uvec2(16777215u));
- uint v_5 = ((v_4.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_6 = uvec2(v_5, ((v_4.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_7 = lessThanEqual(((v << v_3) << v_6), uvec2(268435455u));
- uint v_8 = ((v_7.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_9 = uvec2(v_8, ((v_7.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_10 = lessThanEqual((((v << v_3) << v_6) << v_9), uvec2(1073741823u));
- uint v_11 = ((v_10.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_12 = uvec2(v_11, ((v_10.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_13 = lessThanEqual(((((v << v_3) << v_6) << v_9) << v_12), uvec2(2147483647u));
- uint v_14 = ((v_13.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_15 = uvec2(v_14, ((v_13.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_16 = equal(((((v << v_3) << v_6) << v_9) << v_12), uvec2(0u));
- uint v_17 = ((v_16.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_18 = uvec2(v_17, ((v_16.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- ivec2 res = ivec2(((v_3 | (v_6 | (v_9 | (v_12 | (v_15 | v_18))))) + v_18));
+ uvec2 v_1 = mix(uvec2(0u), uvec2(16u), lessThanEqual(v, uvec2(65535u)));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(8u), lessThanEqual((v << v_1), uvec2(16777215u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(4u), lessThanEqual(((v << v_1) << v_2), uvec2(268435455u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(2u), lessThanEqual((((v << v_1) << v_2) << v_3), uvec2(1073741823u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(1u), lessThanEqual(((((v << v_1) << v_2) << v_3) << v_4), uvec2(2147483647u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), equal(((((v << v_1) << v_2) << v_3) << v_4), uvec2(0u)));
+ ivec2 res = ivec2(((v_1 | (v_2 | (v_3 | (v_4 | (v_5 | v_6))))) + v_6));
return res;
}
VertexOutput vertex_main_inner() {
@@ -107,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_19 = vertex_main_inner();
- gl_Position = v_19.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_19.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl
index 1ef589b..026b036 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_count_leading_zeros(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
x = (x << b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
x = (x << b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
x = (x << b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
x = (x << b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_count_leading_zeros(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
x = (x << b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
x = (x << b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
x = (x << b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
x = (x << b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_count_leading_zeros(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
x = (x << b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
x = (x << b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
x = (x << b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
x = (x << b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.ir.glsl
index 34a1aa9..489474d 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.ir.glsl
@@ -9,31 +9,13 @@
uvec3 countLeadingZeros_ab6345() {
uvec3 arg_0 = uvec3(1u);
uvec3 v_1 = arg_0;
- bvec3 v_2 = lessThanEqual(v_1, uvec3(65535u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = lessThanEqual((v_1 << v_5), uvec3(16777215u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = lessThanEqual(((v_1 << v_5) << v_9), uvec3(268435455u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = lessThanEqual((((v_1 << v_5) << v_9) << v_13), uvec3(1073741823u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = lessThanEqual(((((v_1 << v_5) << v_9) << v_13) << v_17), uvec3(2147483647u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_22 = equal(((((v_1 << v_5) << v_9) << v_13) << v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_24 = ((v_22.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_25 = uvec3(v_23, v_24, ((v_22.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- uvec3 res = ((v_5 | (v_9 | (v_13 | (v_17 | (v_21 | v_25))))) + v_25);
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), lessThanEqual(v_1, uvec3(65535u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), lessThanEqual((v_1 << v_2), uvec3(16777215u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec3(268435455u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec3(1073741823u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec3(2147483647u)));
+ uvec3 v_7 = mix(uvec3(0u), uvec3(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec3(0u)));
+ uvec3 res = ((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7);
return res;
}
void main() {
@@ -48,31 +30,13 @@
uvec3 countLeadingZeros_ab6345() {
uvec3 arg_0 = uvec3(1u);
uvec3 v_1 = arg_0;
- bvec3 v_2 = lessThanEqual(v_1, uvec3(65535u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = lessThanEqual((v_1 << v_5), uvec3(16777215u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = lessThanEqual(((v_1 << v_5) << v_9), uvec3(268435455u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = lessThanEqual((((v_1 << v_5) << v_9) << v_13), uvec3(1073741823u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = lessThanEqual(((((v_1 << v_5) << v_9) << v_13) << v_17), uvec3(2147483647u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_22 = equal(((((v_1 << v_5) << v_9) << v_13) << v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_24 = ((v_22.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_25 = uvec3(v_23, v_24, ((v_22.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- uvec3 res = ((v_5 | (v_9 | (v_13 | (v_17 | (v_21 | v_25))))) + v_25);
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), lessThanEqual(v_1, uvec3(65535u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), lessThanEqual((v_1 << v_2), uvec3(16777215u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec3(268435455u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec3(1073741823u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec3(2147483647u)));
+ uvec3 v_7 = mix(uvec3(0u), uvec3(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec3(0u)));
+ uvec3 res = ((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -91,31 +55,13 @@
uvec3 countLeadingZeros_ab6345() {
uvec3 arg_0 = uvec3(1u);
uvec3 v = arg_0;
- bvec3 v_1 = lessThanEqual(v, uvec3(65535u));
- uint v_2 = ((v_1.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_3 = ((v_1.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_4 = uvec3(v_2, v_3, ((v_1.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_5 = lessThanEqual((v << v_4), uvec3(16777215u));
- uint v_6 = ((v_5.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_7 = ((v_5.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_8 = uvec3(v_6, v_7, ((v_5.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_9 = lessThanEqual(((v << v_4) << v_8), uvec3(268435455u));
- uint v_10 = ((v_9.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_11 = ((v_9.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_12 = uvec3(v_10, v_11, ((v_9.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_13 = lessThanEqual((((v << v_4) << v_8) << v_12), uvec3(1073741823u));
- uint v_14 = ((v_13.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_15 = ((v_13.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_16 = uvec3(v_14, v_15, ((v_13.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_17 = lessThanEqual(((((v << v_4) << v_8) << v_12) << v_16), uvec3(2147483647u));
- uint v_18 = ((v_17.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_19 = ((v_17.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_20 = uvec3(v_18, v_19, ((v_17.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_21 = equal(((((v << v_4) << v_8) << v_12) << v_16), uvec3(0u));
- uint v_22 = ((v_21.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_23 = ((v_21.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_24 = uvec3(v_22, v_23, ((v_21.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- uvec3 res = ((v_4 | (v_8 | (v_12 | (v_16 | (v_20 | v_24))))) + v_24);
+ uvec3 v_1 = mix(uvec3(0u), uvec3(16u), lessThanEqual(v, uvec3(65535u)));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(8u), lessThanEqual((v << v_1), uvec3(16777215u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(4u), lessThanEqual(((v << v_1) << v_2), uvec3(268435455u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(2u), lessThanEqual((((v << v_1) << v_2) << v_3), uvec3(1073741823u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(1u), lessThanEqual(((((v << v_1) << v_2) << v_3) << v_4), uvec3(2147483647u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), equal(((((v << v_1) << v_2) << v_3) << v_4), uvec3(0u)));
+ uvec3 res = ((v_1 | (v_2 | (v_3 | (v_4 | (v_5 | v_6))))) + v_6);
return res;
}
VertexOutput vertex_main_inner() {
@@ -125,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_25 = vertex_main_inner();
- gl_Position = v_25.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_25.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl
index da9bf40..155c6f3 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_count_leading_zeros(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
x = (x << b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
x = (x << b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
x = (x << b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
x = (x << b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_count_leading_zeros(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
x = (x << b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
x = (x << b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
x = (x << b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
x = (x << b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_count_leading_zeros(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
x = (x << b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
x = (x << b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
x = (x << b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
x = (x << b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.ir.glsl
index 55782c3..d688431 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.ir.glsl
@@ -9,37 +9,13 @@
ivec4 countLeadingZeros_eab32b() {
ivec4 arg_0 = ivec4(1);
uvec4 v_1 = uvec4(arg_0);
- bvec4 v_2 = lessThanEqual(v_1, uvec4(65535u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual((v_1 << v_6), uvec4(16777215u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = lessThanEqual(((v_1 << v_6) << v_11), uvec4(268435455u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = lessThanEqual((((v_1 << v_6) << v_11) << v_16), uvec4(1073741823u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = lessThanEqual(((((v_1 << v_6) << v_11) << v_16) << v_21), uvec4(2147483647u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_27 = equal(((((v_1 << v_6) << v_11) << v_16) << v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_29 = ((v_27.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_30 = ((v_27.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_31 = uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- ivec4 res = ivec4(((v_6 | (v_11 | (v_16 | (v_21 | (v_26 | v_31))))) + v_31));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), lessThanEqual(v_1, uvec4(65535u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), lessThanEqual((v_1 << v_2), uvec4(16777215u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec4(268435455u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec4(1073741823u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec4(2147483647u)));
+ uvec4 v_7 = mix(uvec4(0u), uvec4(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec4(0u)));
+ ivec4 res = ivec4(((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7));
return res;
}
void main() {
@@ -54,37 +30,13 @@
ivec4 countLeadingZeros_eab32b() {
ivec4 arg_0 = ivec4(1);
uvec4 v_1 = uvec4(arg_0);
- bvec4 v_2 = lessThanEqual(v_1, uvec4(65535u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual((v_1 << v_6), uvec4(16777215u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = lessThanEqual(((v_1 << v_6) << v_11), uvec4(268435455u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = lessThanEqual((((v_1 << v_6) << v_11) << v_16), uvec4(1073741823u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = lessThanEqual(((((v_1 << v_6) << v_11) << v_16) << v_21), uvec4(2147483647u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_27 = equal(((((v_1 << v_6) << v_11) << v_16) << v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_29 = ((v_27.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_30 = ((v_27.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_31 = uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- ivec4 res = ivec4(((v_6 | (v_11 | (v_16 | (v_21 | (v_26 | v_31))))) + v_31));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), lessThanEqual(v_1, uvec4(65535u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), lessThanEqual((v_1 << v_2), uvec4(16777215u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec4(268435455u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec4(1073741823u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec4(2147483647u)));
+ uvec4 v_7 = mix(uvec4(0u), uvec4(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec4(0u)));
+ ivec4 res = ivec4(((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -103,37 +55,13 @@
ivec4 countLeadingZeros_eab32b() {
ivec4 arg_0 = ivec4(1);
uvec4 v = uvec4(arg_0);
- bvec4 v_1 = lessThanEqual(v, uvec4(65535u));
- uint v_2 = ((v_1.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_3 = ((v_1.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_4 = ((v_1.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_5 = uvec4(v_2, v_3, v_4, ((v_1.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_6 = lessThanEqual((v << v_5), uvec4(16777215u));
- uint v_7 = ((v_6.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_8 = ((v_6.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_9 = ((v_6.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_10 = uvec4(v_7, v_8, v_9, ((v_6.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_11 = lessThanEqual(((v << v_5) << v_10), uvec4(268435455u));
- uint v_12 = ((v_11.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_13 = ((v_11.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_14 = ((v_11.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_15 = uvec4(v_12, v_13, v_14, ((v_11.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_16 = lessThanEqual((((v << v_5) << v_10) << v_15), uvec4(1073741823u));
- uint v_17 = ((v_16.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_18 = ((v_16.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_19 = ((v_16.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_20 = uvec4(v_17, v_18, v_19, ((v_16.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_21 = lessThanEqual(((((v << v_5) << v_10) << v_15) << v_20), uvec4(2147483647u));
- uint v_22 = ((v_21.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_23 = ((v_21.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_24 = ((v_21.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_25 = uvec4(v_22, v_23, v_24, ((v_21.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_26 = equal(((((v << v_5) << v_10) << v_15) << v_20), uvec4(0u));
- uint v_27 = ((v_26.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_28 = ((v_26.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_29 = ((v_26.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_30 = uvec4(v_27, v_28, v_29, ((v_26.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- ivec4 res = ivec4(((v_5 | (v_10 | (v_15 | (v_20 | (v_25 | v_30))))) + v_30));
+ uvec4 v_1 = mix(uvec4(0u), uvec4(16u), lessThanEqual(v, uvec4(65535u)));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(8u), lessThanEqual((v << v_1), uvec4(16777215u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(4u), lessThanEqual(((v << v_1) << v_2), uvec4(268435455u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(2u), lessThanEqual((((v << v_1) << v_2) << v_3), uvec4(1073741823u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(1u), lessThanEqual(((((v << v_1) << v_2) << v_3) << v_4), uvec4(2147483647u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), equal(((((v << v_1) << v_2) << v_3) << v_4), uvec4(0u)));
+ ivec4 res = ivec4(((v_1 | (v_2 | (v_3 | (v_4 | (v_5 | v_6))))) + v_6));
return res;
}
VertexOutput vertex_main_inner() {
@@ -143,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_31 = vertex_main_inner();
- gl_Position = v_31.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_31.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl
index d676a5d..c1e8a88 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_count_leading_zeros(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
x = (x << b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
x = (x << b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
x = (x << b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
x = (x << b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_count_leading_zeros(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
x = (x << b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
x = (x << b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
x = (x << b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
x = (x << b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_count_leading_zeros(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
x = (x << b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
x = (x << b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
x = (x << b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
x = (x << b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.ir.glsl
index 9a21cab..430d3c2 100644
--- a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.ir.glsl
@@ -9,37 +9,13 @@
uvec4 countLeadingZeros_f70103() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
- bvec4 v_2 = lessThanEqual(v_1, uvec4(65535u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual((v_1 << v_6), uvec4(16777215u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = lessThanEqual(((v_1 << v_6) << v_11), uvec4(268435455u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = lessThanEqual((((v_1 << v_6) << v_11) << v_16), uvec4(1073741823u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = lessThanEqual(((((v_1 << v_6) << v_11) << v_16) << v_21), uvec4(2147483647u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_27 = equal(((((v_1 << v_6) << v_11) << v_16) << v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_29 = ((v_27.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_30 = ((v_27.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_31 = uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- uvec4 res = ((v_6 | (v_11 | (v_16 | (v_21 | (v_26 | v_31))))) + v_31);
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), lessThanEqual(v_1, uvec4(65535u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), lessThanEqual((v_1 << v_2), uvec4(16777215u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec4(268435455u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec4(1073741823u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec4(2147483647u)));
+ uvec4 v_7 = mix(uvec4(0u), uvec4(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec4(0u)));
+ uvec4 res = ((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7);
return res;
}
void main() {
@@ -54,37 +30,13 @@
uvec4 countLeadingZeros_f70103() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
- bvec4 v_2 = lessThanEqual(v_1, uvec4(65535u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual((v_1 << v_6), uvec4(16777215u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = lessThanEqual(((v_1 << v_6) << v_11), uvec4(268435455u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = lessThanEqual((((v_1 << v_6) << v_11) << v_16), uvec4(1073741823u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = lessThanEqual(((((v_1 << v_6) << v_11) << v_16) << v_21), uvec4(2147483647u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_27 = equal(((((v_1 << v_6) << v_11) << v_16) << v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_29 = ((v_27.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_30 = ((v_27.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_31 = uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- uvec4 res = ((v_6 | (v_11 | (v_16 | (v_21 | (v_26 | v_31))))) + v_31);
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), lessThanEqual(v_1, uvec4(65535u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), lessThanEqual((v_1 << v_2), uvec4(16777215u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(((v_1 << v_2) << v_3), uvec4(268435455u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), lessThanEqual((((v_1 << v_2) << v_3) << v_4), uvec4(1073741823u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), lessThanEqual(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec4(2147483647u)));
+ uvec4 v_7 = mix(uvec4(0u), uvec4(1u), equal(((((v_1 << v_2) << v_3) << v_4) << v_5), uvec4(0u)));
+ uvec4 res = ((v_2 | (v_3 | (v_4 | (v_5 | (v_6 | v_7))))) + v_7);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -103,37 +55,13 @@
uvec4 countLeadingZeros_f70103() {
uvec4 arg_0 = uvec4(1u);
uvec4 v = arg_0;
- bvec4 v_1 = lessThanEqual(v, uvec4(65535u));
- uint v_2 = ((v_1.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_3 = ((v_1.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_4 = ((v_1.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_5 = uvec4(v_2, v_3, v_4, ((v_1.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_6 = lessThanEqual((v << v_5), uvec4(16777215u));
- uint v_7 = ((v_6.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_8 = ((v_6.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_9 = ((v_6.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_10 = uvec4(v_7, v_8, v_9, ((v_6.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_11 = lessThanEqual(((v << v_5) << v_10), uvec4(268435455u));
- uint v_12 = ((v_11.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_13 = ((v_11.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_14 = ((v_11.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_15 = uvec4(v_12, v_13, v_14, ((v_11.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_16 = lessThanEqual((((v << v_5) << v_10) << v_15), uvec4(1073741823u));
- uint v_17 = ((v_16.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_18 = ((v_16.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_19 = ((v_16.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_20 = uvec4(v_17, v_18, v_19, ((v_16.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_21 = lessThanEqual(((((v << v_5) << v_10) << v_15) << v_20), uvec4(2147483647u));
- uint v_22 = ((v_21.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_23 = ((v_21.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_24 = ((v_21.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_25 = uvec4(v_22, v_23, v_24, ((v_21.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_26 = equal(((((v << v_5) << v_10) << v_15) << v_20), uvec4(0u));
- uint v_27 = ((v_26.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_28 = ((v_26.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_29 = ((v_26.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_30 = uvec4(v_27, v_28, v_29, ((v_26.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- uvec4 res = ((v_5 | (v_10 | (v_15 | (v_20 | (v_25 | v_30))))) + v_30);
+ uvec4 v_1 = mix(uvec4(0u), uvec4(16u), lessThanEqual(v, uvec4(65535u)));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(8u), lessThanEqual((v << v_1), uvec4(16777215u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(4u), lessThanEqual(((v << v_1) << v_2), uvec4(268435455u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(2u), lessThanEqual((((v << v_1) << v_2) << v_3), uvec4(1073741823u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(1u), lessThanEqual(((((v << v_1) << v_2) << v_3) << v_4), uvec4(2147483647u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), equal(((((v << v_1) << v_2) << v_3) << v_4), uvec4(0u)));
+ uvec4 res = ((v_1 | (v_2 | (v_3 | (v_4 | (v_5 | v_6))))) + v_6);
return res;
}
VertexOutput vertex_main_inner() {
@@ -143,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_31 = vertex_main_inner();
- gl_Position = v_31.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_31.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl
index 86efec1..87a0ec0 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_count_trailing_zeros(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_count_trailing_zeros(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_count_trailing_zeros(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.ir.glsl
index b6e6f58..af754e5 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.ir.glsl
@@ -9,24 +9,12 @@
uvec2 countTrailingZeros_1ad138() {
uvec2 arg_0 = uvec2(1u);
uvec2 v_1 = arg_0;
- bvec2 v_2 = equal((v_1 & uvec2(65535u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(255u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(15u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(3u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(1u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 res = ((v_4 | (v_7 | (v_10 | (v_13 | v_16)))) + uvec2(v_18, ((v_17.y) ? (uvec2(1u).y) : (uvec2(0u).y))));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), equal((v_1 & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), equal(((v_1 >> v_2) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), equal((((v_1 >> v_2) >> v_3) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(1u)), uvec2(0u)));
+ uvec2 res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec2(0u), uvec2(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u))));
return res;
}
void main() {
@@ -41,24 +29,12 @@
uvec2 countTrailingZeros_1ad138() {
uvec2 arg_0 = uvec2(1u);
uvec2 v_1 = arg_0;
- bvec2 v_2 = equal((v_1 & uvec2(65535u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(255u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(15u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(3u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(1u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 res = ((v_4 | (v_7 | (v_10 | (v_13 | v_16)))) + uvec2(v_18, ((v_17.y) ? (uvec2(1u).y) : (uvec2(0u).y))));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), equal((v_1 & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), equal(((v_1 >> v_2) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), equal((((v_1 >> v_2) >> v_3) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(1u)), uvec2(0u)));
+ uvec2 res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec2(0u), uvec2(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -77,24 +53,12 @@
uvec2 countTrailingZeros_1ad138() {
uvec2 arg_0 = uvec2(1u);
uvec2 v = arg_0;
- bvec2 v_1 = equal((v & uvec2(65535u)), uvec2(0u));
- uint v_2 = ((v_1.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_3 = uvec2(v_2, ((v_1.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_4 = equal(((v >> v_3) & uvec2(255u)), uvec2(0u));
- uint v_5 = ((v_4.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_6 = uvec2(v_5, ((v_4.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_7 = equal((((v >> v_3) >> v_6) & uvec2(15u)), uvec2(0u));
- uint v_8 = ((v_7.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_9 = uvec2(v_8, ((v_7.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_10 = equal(((((v >> v_3) >> v_6) >> v_9) & uvec2(3u)), uvec2(0u));
- uint v_11 = ((v_10.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_12 = uvec2(v_11, ((v_10.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_13 = equal((((((v >> v_3) >> v_6) >> v_9) >> v_12) & uvec2(1u)), uvec2(0u));
- uint v_14 = ((v_13.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_15 = uvec2(v_14, ((v_13.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_16 = equal(((((v >> v_3) >> v_6) >> v_9) >> v_12), uvec2(0u));
- uint v_17 = ((v_16.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 res = ((v_3 | (v_6 | (v_9 | (v_12 | v_15)))) + uvec2(v_17, ((v_16.y) ? (uvec2(1u).y) : (uvec2(0u).y))));
+ uvec2 v_1 = mix(uvec2(0u), uvec2(16u), equal((v & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(8u), equal(((v >> v_1) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(4u), equal((((v >> v_1) >> v_2) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec2(1u)), uvec2(0u)));
+ uvec2 res = ((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + mix(uvec2(0u), uvec2(1u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec2(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -104,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_18 = vertex_main_inner();
- gl_Position = v_18.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_18.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl
index d85f4ad..f2f3974 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_count_trailing_zeros(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_count_trailing_zeros(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_count_trailing_zeros(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.ir.glsl
index 1f55047..8dc7cc9 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.ir.glsl
@@ -9,36 +9,12 @@
ivec4 countTrailingZeros_1dc84a() {
ivec4 arg_0 = ivec4(1);
uvec4 v_1 = uvec4(arg_0);
- bvec4 v_2 = equal((v_1 & uvec4(65535u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(255u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(15u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(3u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(1u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_29 = ((v_27.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_30 = ((v_27.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- ivec4 res = ivec4(((v_6 | (v_11 | (v_16 | (v_21 | v_26)))) + uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(1u).w) : (uvec4(0u).w)))));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), equal((v_1 & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), equal(((v_1 >> v_2) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), equal((((v_1 >> v_2) >> v_3) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(1u)), uvec4(0u)));
+ ivec4 res = ivec4(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec4(0u), uvec4(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u)))));
return res;
}
void main() {
@@ -53,36 +29,12 @@
ivec4 countTrailingZeros_1dc84a() {
ivec4 arg_0 = ivec4(1);
uvec4 v_1 = uvec4(arg_0);
- bvec4 v_2 = equal((v_1 & uvec4(65535u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(255u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(15u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(3u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(1u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_29 = ((v_27.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_30 = ((v_27.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- ivec4 res = ivec4(((v_6 | (v_11 | (v_16 | (v_21 | v_26)))) + uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(1u).w) : (uvec4(0u).w)))));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), equal((v_1 & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), equal(((v_1 >> v_2) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), equal((((v_1 >> v_2) >> v_3) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(1u)), uvec4(0u)));
+ ivec4 res = ivec4(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec4(0u), uvec4(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u)))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -101,36 +53,12 @@
ivec4 countTrailingZeros_1dc84a() {
ivec4 arg_0 = ivec4(1);
uvec4 v = uvec4(arg_0);
- bvec4 v_1 = equal((v & uvec4(65535u)), uvec4(0u));
- uint v_2 = ((v_1.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_3 = ((v_1.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_4 = ((v_1.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_5 = uvec4(v_2, v_3, v_4, ((v_1.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_6 = equal(((v >> v_5) & uvec4(255u)), uvec4(0u));
- uint v_7 = ((v_6.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_8 = ((v_6.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_9 = ((v_6.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_10 = uvec4(v_7, v_8, v_9, ((v_6.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_11 = equal((((v >> v_5) >> v_10) & uvec4(15u)), uvec4(0u));
- uint v_12 = ((v_11.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_13 = ((v_11.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_14 = ((v_11.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_15 = uvec4(v_12, v_13, v_14, ((v_11.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_16 = equal(((((v >> v_5) >> v_10) >> v_15) & uvec4(3u)), uvec4(0u));
- uint v_17 = ((v_16.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_18 = ((v_16.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_19 = ((v_16.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_20 = uvec4(v_17, v_18, v_19, ((v_16.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_21 = equal((((((v >> v_5) >> v_10) >> v_15) >> v_20) & uvec4(1u)), uvec4(0u));
- uint v_22 = ((v_21.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_23 = ((v_21.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_24 = ((v_21.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_25 = uvec4(v_22, v_23, v_24, ((v_21.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_26 = equal(((((v >> v_5) >> v_10) >> v_15) >> v_20), uvec4(0u));
- uint v_27 = ((v_26.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_28 = ((v_26.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_29 = ((v_26.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- ivec4 res = ivec4(((v_5 | (v_10 | (v_15 | (v_20 | v_25)))) + uvec4(v_27, v_28, v_29, ((v_26.w) ? (uvec4(1u).w) : (uvec4(0u).w)))));
+ uvec4 v_1 = mix(uvec4(0u), uvec4(16u), equal((v & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(8u), equal(((v >> v_1) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(4u), equal((((v >> v_1) >> v_2) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec4(1u)), uvec4(0u)));
+ ivec4 res = ivec4(((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + mix(uvec4(0u), uvec4(1u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec4(0u)))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -140,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_30 = vertex_main_inner();
- gl_Position = v_30.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_30.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl
index 7360d08..f08479b 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl
@@ -4,16 +4,16 @@
uint tint_count_trailing_zeros(uint v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -44,16 +44,16 @@
uint tint_count_trailing_zeros(uint v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -85,16 +85,16 @@
uint tint_count_trailing_zeros(uint v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.ir.glsl
index 70ab2af..c04b431 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.ir.glsl
@@ -9,12 +9,12 @@
uint countTrailingZeros_21e394() {
uint arg_0 = 1u;
uint v_1 = arg_0;
- uint v_2 = ((((v_1 & 65535u) == 0u)) ? (16u) : (0u));
- uint v_3 = (((((v_1 >> v_2) & 255u) == 0u)) ? (8u) : (0u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 15u) == 0u)) ? (4u) : (0u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u)) ? (2u) : (0u));
- uint v_6 = ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)) ? (1u) : (0u));
- uint res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + (((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (1u) : (0u)));
+ uint v_2 = mix(0u, 16u, ((v_1 & 65535u) == 0u));
+ uint v_3 = mix(0u, 8u, (((v_1 >> v_2) & 255u) == 0u));
+ uint v_4 = mix(0u, 4u, ((((v_1 >> v_2) >> v_3) & 15u) == 0u));
+ uint v_5 = mix(0u, 2u, (((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u));
+ uint v_6 = mix(0u, 1u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u));
+ uint res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(0u, 1u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)));
return res;
}
void main() {
@@ -29,12 +29,12 @@
uint countTrailingZeros_21e394() {
uint arg_0 = 1u;
uint v_1 = arg_0;
- uint v_2 = ((((v_1 & 65535u) == 0u)) ? (16u) : (0u));
- uint v_3 = (((((v_1 >> v_2) & 255u) == 0u)) ? (8u) : (0u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 15u) == 0u)) ? (4u) : (0u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u)) ? (2u) : (0u));
- uint v_6 = ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)) ? (1u) : (0u));
- uint res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + (((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (1u) : (0u)));
+ uint v_2 = mix(0u, 16u, ((v_1 & 65535u) == 0u));
+ uint v_3 = mix(0u, 8u, (((v_1 >> v_2) & 255u) == 0u));
+ uint v_4 = mix(0u, 4u, ((((v_1 >> v_2) >> v_3) & 15u) == 0u));
+ uint v_5 = mix(0u, 2u, (((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u));
+ uint v_6 = mix(0u, 1u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u));
+ uint res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(0u, 1u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -53,12 +53,12 @@
uint countTrailingZeros_21e394() {
uint arg_0 = 1u;
uint v = arg_0;
- uint v_1 = ((((v & 65535u) == 0u)) ? (16u) : (0u));
- uint v_2 = (((((v >> v_1) & 255u) == 0u)) ? (8u) : (0u));
- uint v_3 = ((((((v >> v_1) >> v_2) & 15u) == 0u)) ? (4u) : (0u));
- uint v_4 = (((((((v >> v_1) >> v_2) >> v_3) & 3u) == 0u)) ? (2u) : (0u));
- uint v_5 = ((((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 1u) == 0u)) ? (1u) : (0u));
- uint res = ((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + (((((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u)) ? (1u) : (0u)));
+ uint v_1 = mix(0u, 16u, ((v & 65535u) == 0u));
+ uint v_2 = mix(0u, 8u, (((v >> v_1) & 255u) == 0u));
+ uint v_3 = mix(0u, 4u, ((((v >> v_1) >> v_2) & 15u) == 0u));
+ uint v_4 = mix(0u, 2u, (((((v >> v_1) >> v_2) >> v_3) & 3u) == 0u));
+ uint v_5 = mix(0u, 1u, ((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 1u) == 0u));
+ uint res = ((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + mix(0u, 1u, (((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u)));
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl
index a63271a..8ae7950 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_count_trailing_zeros(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_count_trailing_zeros(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_count_trailing_zeros(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.ir.glsl
index 1458210..8eb4451 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.ir.glsl
@@ -9,24 +9,12 @@
ivec2 countTrailingZeros_327c37() {
ivec2 arg_0 = ivec2(1);
uvec2 v_1 = uvec2(arg_0);
- bvec2 v_2 = equal((v_1 & uvec2(65535u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(255u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(15u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(3u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(1u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- ivec2 res = ivec2(((v_4 | (v_7 | (v_10 | (v_13 | v_16)))) + uvec2(v_18, ((v_17.y) ? (uvec2(1u).y) : (uvec2(0u).y)))));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), equal((v_1 & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), equal(((v_1 >> v_2) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), equal((((v_1 >> v_2) >> v_3) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(1u)), uvec2(0u)));
+ ivec2 res = ivec2(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec2(0u), uvec2(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u)))));
return res;
}
void main() {
@@ -41,24 +29,12 @@
ivec2 countTrailingZeros_327c37() {
ivec2 arg_0 = ivec2(1);
uvec2 v_1 = uvec2(arg_0);
- bvec2 v_2 = equal((v_1 & uvec2(65535u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(255u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(15u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(3u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(1u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- ivec2 res = ivec2(((v_4 | (v_7 | (v_10 | (v_13 | v_16)))) + uvec2(v_18, ((v_17.y) ? (uvec2(1u).y) : (uvec2(0u).y)))));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), equal((v_1 & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), equal(((v_1 >> v_2) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), equal((((v_1 >> v_2) >> v_3) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_6 = mix(uvec2(0u), uvec2(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(1u)), uvec2(0u)));
+ ivec2 res = ivec2(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec2(0u), uvec2(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u)))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -77,24 +53,12 @@
ivec2 countTrailingZeros_327c37() {
ivec2 arg_0 = ivec2(1);
uvec2 v = uvec2(arg_0);
- bvec2 v_1 = equal((v & uvec2(65535u)), uvec2(0u));
- uint v_2 = ((v_1.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_3 = uvec2(v_2, ((v_1.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_4 = equal(((v >> v_3) & uvec2(255u)), uvec2(0u));
- uint v_5 = ((v_4.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_6 = uvec2(v_5, ((v_4.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_7 = equal((((v >> v_3) >> v_6) & uvec2(15u)), uvec2(0u));
- uint v_8 = ((v_7.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_9 = uvec2(v_8, ((v_7.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_10 = equal(((((v >> v_3) >> v_6) >> v_9) & uvec2(3u)), uvec2(0u));
- uint v_11 = ((v_10.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_12 = uvec2(v_11, ((v_10.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_13 = equal((((((v >> v_3) >> v_6) >> v_9) >> v_12) & uvec2(1u)), uvec2(0u));
- uint v_14 = ((v_13.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_15 = uvec2(v_14, ((v_13.y) ? (uvec2(1u).y) : (uvec2(0u).y)));
- bvec2 v_16 = equal(((((v >> v_3) >> v_6) >> v_9) >> v_12), uvec2(0u));
- uint v_17 = ((v_16.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- ivec2 res = ivec2(((v_3 | (v_6 | (v_9 | (v_12 | v_15)))) + uvec2(v_17, ((v_16.y) ? (uvec2(1u).y) : (uvec2(0u).y)))));
+ uvec2 v_1 = mix(uvec2(0u), uvec2(16u), equal((v & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(8u), equal(((v >> v_1) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(4u), equal((((v >> v_1) >> v_2) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec2(1u)), uvec2(0u)));
+ ivec2 res = ivec2(((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + mix(uvec2(0u), uvec2(1u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec2(0u)))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -104,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_18 = vertex_main_inner();
- gl_Position = v_18.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_18.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl
index ad65af1..d31890c 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl
@@ -4,16 +4,16 @@
int tint_count_trailing_zeros(int v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -44,16 +44,16 @@
int tint_count_trailing_zeros(int v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -85,16 +85,16 @@
int tint_count_trailing_zeros(int v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 1u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 1u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.ir.glsl
index e228f3a..066340d 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.ir.glsl
@@ -9,12 +9,12 @@
int countTrailingZeros_42fed6() {
int arg_0 = 1;
uint v_1 = uint(arg_0);
- uint v_2 = ((((v_1 & 65535u) == 0u)) ? (16u) : (0u));
- uint v_3 = (((((v_1 >> v_2) & 255u) == 0u)) ? (8u) : (0u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 15u) == 0u)) ? (4u) : (0u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u)) ? (2u) : (0u));
- uint v_6 = ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)) ? (1u) : (0u));
- int res = int(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + (((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (1u) : (0u))));
+ uint v_2 = mix(0u, 16u, ((v_1 & 65535u) == 0u));
+ uint v_3 = mix(0u, 8u, (((v_1 >> v_2) & 255u) == 0u));
+ uint v_4 = mix(0u, 4u, ((((v_1 >> v_2) >> v_3) & 15u) == 0u));
+ uint v_5 = mix(0u, 2u, (((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u));
+ uint v_6 = mix(0u, 1u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u));
+ int res = int(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(0u, 1u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u))));
return res;
}
void main() {
@@ -29,12 +29,12 @@
int countTrailingZeros_42fed6() {
int arg_0 = 1;
uint v_1 = uint(arg_0);
- uint v_2 = ((((v_1 & 65535u) == 0u)) ? (16u) : (0u));
- uint v_3 = (((((v_1 >> v_2) & 255u) == 0u)) ? (8u) : (0u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 15u) == 0u)) ? (4u) : (0u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u)) ? (2u) : (0u));
- uint v_6 = ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)) ? (1u) : (0u));
- int res = int(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + (((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (1u) : (0u))));
+ uint v_2 = mix(0u, 16u, ((v_1 & 65535u) == 0u));
+ uint v_3 = mix(0u, 8u, (((v_1 >> v_2) & 255u) == 0u));
+ uint v_4 = mix(0u, 4u, ((((v_1 >> v_2) >> v_3) & 15u) == 0u));
+ uint v_5 = mix(0u, 2u, (((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u));
+ uint v_6 = mix(0u, 1u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u));
+ int res = int(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(0u, 1u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -53,12 +53,12 @@
int countTrailingZeros_42fed6() {
int arg_0 = 1;
uint v = uint(arg_0);
- uint v_1 = ((((v & 65535u) == 0u)) ? (16u) : (0u));
- uint v_2 = (((((v >> v_1) & 255u) == 0u)) ? (8u) : (0u));
- uint v_3 = ((((((v >> v_1) >> v_2) & 15u) == 0u)) ? (4u) : (0u));
- uint v_4 = (((((((v >> v_1) >> v_2) >> v_3) & 3u) == 0u)) ? (2u) : (0u));
- uint v_5 = ((((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 1u) == 0u)) ? (1u) : (0u));
- int res = int(((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + (((((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u)) ? (1u) : (0u))));
+ uint v_1 = mix(0u, 16u, ((v & 65535u) == 0u));
+ uint v_2 = mix(0u, 8u, (((v >> v_1) & 255u) == 0u));
+ uint v_3 = mix(0u, 4u, ((((v >> v_1) >> v_2) & 15u) == 0u));
+ uint v_4 = mix(0u, 2u, (((((v >> v_1) >> v_2) >> v_3) & 3u) == 0u));
+ uint v_5 = mix(0u, 1u, ((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 1u) == 0u));
+ int res = int(((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + mix(0u, 1u, (((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u))));
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl
index 511111e..5b9d17b 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_count_trailing_zeros(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_count_trailing_zeros(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_count_trailing_zeros(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.ir.glsl
index f50815e..f0e4b60 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.ir.glsl
@@ -9,30 +9,12 @@
uvec3 countTrailingZeros_8ed26f() {
uvec3 arg_0 = uvec3(1u);
uvec3 v_1 = arg_0;
- bvec3 v_2 = equal((v_1 & uvec3(65535u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(255u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(15u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(3u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(1u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_24 = ((v_22.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 res = ((v_5 | (v_9 | (v_13 | (v_17 | v_21)))) + uvec3(v_23, v_24, ((v_22.z) ? (uvec3(1u).z) : (uvec3(0u).z))));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), equal((v_1 & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), equal(((v_1 >> v_2) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), equal((((v_1 >> v_2) >> v_3) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(1u)), uvec3(0u)));
+ uvec3 res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec3(0u), uvec3(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u))));
return res;
}
void main() {
@@ -47,30 +29,12 @@
uvec3 countTrailingZeros_8ed26f() {
uvec3 arg_0 = uvec3(1u);
uvec3 v_1 = arg_0;
- bvec3 v_2 = equal((v_1 & uvec3(65535u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(255u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(15u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(3u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(1u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_24 = ((v_22.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 res = ((v_5 | (v_9 | (v_13 | (v_17 | v_21)))) + uvec3(v_23, v_24, ((v_22.z) ? (uvec3(1u).z) : (uvec3(0u).z))));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), equal((v_1 & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), equal(((v_1 >> v_2) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), equal((((v_1 >> v_2) >> v_3) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(1u)), uvec3(0u)));
+ uvec3 res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec3(0u), uvec3(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -89,30 +53,12 @@
uvec3 countTrailingZeros_8ed26f() {
uvec3 arg_0 = uvec3(1u);
uvec3 v = arg_0;
- bvec3 v_1 = equal((v & uvec3(65535u)), uvec3(0u));
- uint v_2 = ((v_1.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_3 = ((v_1.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_4 = uvec3(v_2, v_3, ((v_1.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_5 = equal(((v >> v_4) & uvec3(255u)), uvec3(0u));
- uint v_6 = ((v_5.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_7 = ((v_5.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_8 = uvec3(v_6, v_7, ((v_5.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_9 = equal((((v >> v_4) >> v_8) & uvec3(15u)), uvec3(0u));
- uint v_10 = ((v_9.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_11 = ((v_9.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_12 = uvec3(v_10, v_11, ((v_9.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_13 = equal(((((v >> v_4) >> v_8) >> v_12) & uvec3(3u)), uvec3(0u));
- uint v_14 = ((v_13.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_15 = ((v_13.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_16 = uvec3(v_14, v_15, ((v_13.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_17 = equal((((((v >> v_4) >> v_8) >> v_12) >> v_16) & uvec3(1u)), uvec3(0u));
- uint v_18 = ((v_17.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_19 = ((v_17.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_20 = uvec3(v_18, v_19, ((v_17.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_21 = equal(((((v >> v_4) >> v_8) >> v_12) >> v_16), uvec3(0u));
- uint v_22 = ((v_21.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_23 = ((v_21.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 res = ((v_4 | (v_8 | (v_12 | (v_16 | v_20)))) + uvec3(v_22, v_23, ((v_21.z) ? (uvec3(1u).z) : (uvec3(0u).z))));
+ uvec3 v_1 = mix(uvec3(0u), uvec3(16u), equal((v & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(8u), equal(((v >> v_1) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(4u), equal((((v >> v_1) >> v_2) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec3(1u)), uvec3(0u)));
+ uvec3 res = ((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + mix(uvec3(0u), uvec3(1u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec3(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -122,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_24 = vertex_main_inner();
- gl_Position = v_24.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_24.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl
index 04063c3..ad0f795 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_count_trailing_zeros(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_count_trailing_zeros(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_count_trailing_zeros(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.ir.glsl
index 0c13b2d..cfde182 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.ir.glsl
@@ -9,30 +9,12 @@
ivec3 countTrailingZeros_acfacb() {
ivec3 arg_0 = ivec3(1);
uvec3 v_1 = uvec3(arg_0);
- bvec3 v_2 = equal((v_1 & uvec3(65535u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(255u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(15u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(3u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(1u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_24 = ((v_22.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- ivec3 res = ivec3(((v_5 | (v_9 | (v_13 | (v_17 | v_21)))) + uvec3(v_23, v_24, ((v_22.z) ? (uvec3(1u).z) : (uvec3(0u).z)))));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), equal((v_1 & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), equal(((v_1 >> v_2) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), equal((((v_1 >> v_2) >> v_3) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(1u)), uvec3(0u)));
+ ivec3 res = ivec3(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec3(0u), uvec3(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u)))));
return res;
}
void main() {
@@ -47,30 +29,12 @@
ivec3 countTrailingZeros_acfacb() {
ivec3 arg_0 = ivec3(1);
uvec3 v_1 = uvec3(arg_0);
- bvec3 v_2 = equal((v_1 & uvec3(65535u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(255u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(15u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(3u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(1u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_24 = ((v_22.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- ivec3 res = ivec3(((v_5 | (v_9 | (v_13 | (v_17 | v_21)))) + uvec3(v_23, v_24, ((v_22.z) ? (uvec3(1u).z) : (uvec3(0u).z)))));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), equal((v_1 & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), equal(((v_1 >> v_2) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), equal((((v_1 >> v_2) >> v_3) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_6 = mix(uvec3(0u), uvec3(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(1u)), uvec3(0u)));
+ ivec3 res = ivec3(((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec3(0u), uvec3(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u)))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -89,30 +53,12 @@
ivec3 countTrailingZeros_acfacb() {
ivec3 arg_0 = ivec3(1);
uvec3 v = uvec3(arg_0);
- bvec3 v_1 = equal((v & uvec3(65535u)), uvec3(0u));
- uint v_2 = ((v_1.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_3 = ((v_1.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_4 = uvec3(v_2, v_3, ((v_1.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_5 = equal(((v >> v_4) & uvec3(255u)), uvec3(0u));
- uint v_6 = ((v_5.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_7 = ((v_5.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_8 = uvec3(v_6, v_7, ((v_5.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_9 = equal((((v >> v_4) >> v_8) & uvec3(15u)), uvec3(0u));
- uint v_10 = ((v_9.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_11 = ((v_9.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_12 = uvec3(v_10, v_11, ((v_9.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_13 = equal(((((v >> v_4) >> v_8) >> v_12) & uvec3(3u)), uvec3(0u));
- uint v_14 = ((v_13.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_15 = ((v_13.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_16 = uvec3(v_14, v_15, ((v_13.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_17 = equal((((((v >> v_4) >> v_8) >> v_12) >> v_16) & uvec3(1u)), uvec3(0u));
- uint v_18 = ((v_17.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_19 = ((v_17.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_20 = uvec3(v_18, v_19, ((v_17.z) ? (uvec3(1u).z) : (uvec3(0u).z)));
- bvec3 v_21 = equal(((((v >> v_4) >> v_8) >> v_12) >> v_16), uvec3(0u));
- uint v_22 = ((v_21.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_23 = ((v_21.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- ivec3 res = ivec3(((v_4 | (v_8 | (v_12 | (v_16 | v_20)))) + uvec3(v_22, v_23, ((v_21.z) ? (uvec3(1u).z) : (uvec3(0u).z)))));
+ uvec3 v_1 = mix(uvec3(0u), uvec3(16u), equal((v & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(8u), equal(((v >> v_1) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(4u), equal((((v >> v_1) >> v_2) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec3(1u)), uvec3(0u)));
+ ivec3 res = ivec3(((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + mix(uvec3(0u), uvec3(1u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec3(0u)))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -122,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_24 = vertex_main_inner();
- gl_Position = v_24.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_24.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl
index 69ea721..09cf553 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_count_trailing_zeros(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_count_trailing_zeros(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_count_trailing_zeros(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.ir.glsl
index a7bc735..ec5127d 100644
--- a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.ir.glsl
@@ -9,36 +9,12 @@
uvec4 countTrailingZeros_d2b4a0() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
- bvec4 v_2 = equal((v_1 & uvec4(65535u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(255u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(15u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(3u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(1u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_29 = ((v_27.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_30 = ((v_27.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 res = ((v_6 | (v_11 | (v_16 | (v_21 | v_26)))) + uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(1u).w) : (uvec4(0u).w))));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), equal((v_1 & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), equal(((v_1 >> v_2) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), equal((((v_1 >> v_2) >> v_3) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(1u)), uvec4(0u)));
+ uvec4 res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec4(0u), uvec4(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u))));
return res;
}
void main() {
@@ -53,36 +29,12 @@
uvec4 countTrailingZeros_d2b4a0() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
- bvec4 v_2 = equal((v_1 & uvec4(65535u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(255u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(15u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(3u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(1u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_29 = ((v_27.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_30 = ((v_27.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 res = ((v_6 | (v_11 | (v_16 | (v_21 | v_26)))) + uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(1u).w) : (uvec4(0u).w))));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), equal((v_1 & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), equal(((v_1 >> v_2) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), equal((((v_1 >> v_2) >> v_3) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_6 = mix(uvec4(0u), uvec4(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(1u)), uvec4(0u)));
+ uvec4 res = ((v_2 | (v_3 | (v_4 | (v_5 | v_6)))) + mix(uvec4(0u), uvec4(1u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -101,36 +53,12 @@
uvec4 countTrailingZeros_d2b4a0() {
uvec4 arg_0 = uvec4(1u);
uvec4 v = arg_0;
- bvec4 v_1 = equal((v & uvec4(65535u)), uvec4(0u));
- uint v_2 = ((v_1.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_3 = ((v_1.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_4 = ((v_1.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_5 = uvec4(v_2, v_3, v_4, ((v_1.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_6 = equal(((v >> v_5) & uvec4(255u)), uvec4(0u));
- uint v_7 = ((v_6.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_8 = ((v_6.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_9 = ((v_6.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_10 = uvec4(v_7, v_8, v_9, ((v_6.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_11 = equal((((v >> v_5) >> v_10) & uvec4(15u)), uvec4(0u));
- uint v_12 = ((v_11.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_13 = ((v_11.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_14 = ((v_11.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_15 = uvec4(v_12, v_13, v_14, ((v_11.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_16 = equal(((((v >> v_5) >> v_10) >> v_15) & uvec4(3u)), uvec4(0u));
- uint v_17 = ((v_16.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_18 = ((v_16.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_19 = ((v_16.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_20 = uvec4(v_17, v_18, v_19, ((v_16.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_21 = equal((((((v >> v_5) >> v_10) >> v_15) >> v_20) & uvec4(1u)), uvec4(0u));
- uint v_22 = ((v_21.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_23 = ((v_21.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_24 = ((v_21.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_25 = uvec4(v_22, v_23, v_24, ((v_21.w) ? (uvec4(1u).w) : (uvec4(0u).w)));
- bvec4 v_26 = equal(((((v >> v_5) >> v_10) >> v_15) >> v_20), uvec4(0u));
- uint v_27 = ((v_26.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_28 = ((v_26.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_29 = ((v_26.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 res = ((v_5 | (v_10 | (v_15 | (v_20 | v_25)))) + uvec4(v_27, v_28, v_29, ((v_26.w) ? (uvec4(1u).w) : (uvec4(0u).w))));
+ uvec4 v_1 = mix(uvec4(0u), uvec4(16u), equal((v & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(8u), equal(((v >> v_1) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(4u), equal((((v >> v_1) >> v_2) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec4(1u)), uvec4(0u)));
+ uvec4 res = ((v_1 | (v_2 | (v_3 | (v_4 | v_5)))) + mix(uvec4(0u), uvec4(1u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec4(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -140,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_30 = vertex_main_inner();
- gl_Position = v_30.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_30.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl
index 708ba02..83b644a 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_first_leading_bit(uvec4 v) {
uvec4 x = v;
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_first_leading_bit(uvec4 v) {
uvec4 x = v;
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_first_leading_bit(uvec4 v) {
uvec4 x = v;
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.ir.glsl
index 3e6abcc..b326ab3 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.ir.glsl
@@ -9,36 +9,12 @@
uvec4 firstLeadingBit_000ff3() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
- bvec4 v_2 = equal((v_1 & uvec4(4294901760u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(0u).x) : (uvec4(16u).x));
- uint v_4 = ((v_2.y) ? (uvec4(0u).y) : (uvec4(16u).y));
- uint v_5 = ((v_2.z) ? (uvec4(0u).z) : (uvec4(16u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(0u).w) : (uvec4(16u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(65280u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(0u).x) : (uvec4(8u).x));
- uint v_9 = ((v_7.y) ? (uvec4(0u).y) : (uvec4(8u).y));
- uint v_10 = ((v_7.z) ? (uvec4(0u).z) : (uvec4(8u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(0u).w) : (uvec4(8u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(240u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(0u).x) : (uvec4(4u).x));
- uint v_14 = ((v_12.y) ? (uvec4(0u).y) : (uvec4(4u).y));
- uint v_15 = ((v_12.z) ? (uvec4(0u).z) : (uvec4(4u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(0u).w) : (uvec4(4u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(12u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(0u).x) : (uvec4(2u).x));
- uint v_19 = ((v_17.y) ? (uvec4(0u).y) : (uvec4(2u).y));
- uint v_20 = ((v_17.z) ? (uvec4(0u).z) : (uvec4(2u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(0u).w) : (uvec4(2u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(2u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(0u).x) : (uvec4(1u).x));
- uint v_24 = ((v_22.y) ? (uvec4(0u).y) : (uvec4(1u).y));
- uint v_25 = ((v_22.z) ? (uvec4(0u).z) : (uvec4(1u).z));
- uvec4 v_26 = (v_6 | (v_11 | (v_16 | (v_21 | uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(0u).w) : (uvec4(1u).w)))))));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(4294967295u).x) : (v_26.x));
- uint v_29 = ((v_27.y) ? (uvec4(4294967295u).y) : (v_26.y));
- uint v_30 = ((v_27.z) ? (uvec4(4294967295u).z) : (v_26.z));
- uvec4 res = uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(4294967295u).w) : (v_26.w)));
+ uvec4 v_2 = mix(uvec4(16u), uvec4(0u), equal((v_1 & uvec4(4294901760u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(8u), uvec4(0u), equal(((v_1 >> v_2) & uvec4(65280u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(4u), uvec4(0u), equal((((v_1 >> v_2) >> v_3) & uvec4(240u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(2u), uvec4(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(12u)), uvec4(0u)));
+ uvec4 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec4(1u), uvec4(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(2u)), uvec4(0u)))))));
+ uvec4 res = mix(v_6, uvec4(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u)));
return res;
}
void main() {
@@ -53,36 +29,12 @@
uvec4 firstLeadingBit_000ff3() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
- bvec4 v_2 = equal((v_1 & uvec4(4294901760u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(0u).x) : (uvec4(16u).x));
- uint v_4 = ((v_2.y) ? (uvec4(0u).y) : (uvec4(16u).y));
- uint v_5 = ((v_2.z) ? (uvec4(0u).z) : (uvec4(16u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(0u).w) : (uvec4(16u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(65280u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(0u).x) : (uvec4(8u).x));
- uint v_9 = ((v_7.y) ? (uvec4(0u).y) : (uvec4(8u).y));
- uint v_10 = ((v_7.z) ? (uvec4(0u).z) : (uvec4(8u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(0u).w) : (uvec4(8u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(240u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(0u).x) : (uvec4(4u).x));
- uint v_14 = ((v_12.y) ? (uvec4(0u).y) : (uvec4(4u).y));
- uint v_15 = ((v_12.z) ? (uvec4(0u).z) : (uvec4(4u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(0u).w) : (uvec4(4u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(12u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(0u).x) : (uvec4(2u).x));
- uint v_19 = ((v_17.y) ? (uvec4(0u).y) : (uvec4(2u).y));
- uint v_20 = ((v_17.z) ? (uvec4(0u).z) : (uvec4(2u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(0u).w) : (uvec4(2u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(2u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(0u).x) : (uvec4(1u).x));
- uint v_24 = ((v_22.y) ? (uvec4(0u).y) : (uvec4(1u).y));
- uint v_25 = ((v_22.z) ? (uvec4(0u).z) : (uvec4(1u).z));
- uvec4 v_26 = (v_6 | (v_11 | (v_16 | (v_21 | uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(0u).w) : (uvec4(1u).w)))))));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(4294967295u).x) : (v_26.x));
- uint v_29 = ((v_27.y) ? (uvec4(4294967295u).y) : (v_26.y));
- uint v_30 = ((v_27.z) ? (uvec4(4294967295u).z) : (v_26.z));
- uvec4 res = uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(4294967295u).w) : (v_26.w)));
+ uvec4 v_2 = mix(uvec4(16u), uvec4(0u), equal((v_1 & uvec4(4294901760u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(8u), uvec4(0u), equal(((v_1 >> v_2) & uvec4(65280u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(4u), uvec4(0u), equal((((v_1 >> v_2) >> v_3) & uvec4(240u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(2u), uvec4(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(12u)), uvec4(0u)));
+ uvec4 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec4(1u), uvec4(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(2u)), uvec4(0u)))))));
+ uvec4 res = mix(v_6, uvec4(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -101,36 +53,12 @@
uvec4 firstLeadingBit_000ff3() {
uvec4 arg_0 = uvec4(1u);
uvec4 v = arg_0;
- bvec4 v_1 = equal((v & uvec4(4294901760u)), uvec4(0u));
- uint v_2 = ((v_1.x) ? (uvec4(0u).x) : (uvec4(16u).x));
- uint v_3 = ((v_1.y) ? (uvec4(0u).y) : (uvec4(16u).y));
- uint v_4 = ((v_1.z) ? (uvec4(0u).z) : (uvec4(16u).z));
- uvec4 v_5 = uvec4(v_2, v_3, v_4, ((v_1.w) ? (uvec4(0u).w) : (uvec4(16u).w)));
- bvec4 v_6 = equal(((v >> v_5) & uvec4(65280u)), uvec4(0u));
- uint v_7 = ((v_6.x) ? (uvec4(0u).x) : (uvec4(8u).x));
- uint v_8 = ((v_6.y) ? (uvec4(0u).y) : (uvec4(8u).y));
- uint v_9 = ((v_6.z) ? (uvec4(0u).z) : (uvec4(8u).z));
- uvec4 v_10 = uvec4(v_7, v_8, v_9, ((v_6.w) ? (uvec4(0u).w) : (uvec4(8u).w)));
- bvec4 v_11 = equal((((v >> v_5) >> v_10) & uvec4(240u)), uvec4(0u));
- uint v_12 = ((v_11.x) ? (uvec4(0u).x) : (uvec4(4u).x));
- uint v_13 = ((v_11.y) ? (uvec4(0u).y) : (uvec4(4u).y));
- uint v_14 = ((v_11.z) ? (uvec4(0u).z) : (uvec4(4u).z));
- uvec4 v_15 = uvec4(v_12, v_13, v_14, ((v_11.w) ? (uvec4(0u).w) : (uvec4(4u).w)));
- bvec4 v_16 = equal(((((v >> v_5) >> v_10) >> v_15) & uvec4(12u)), uvec4(0u));
- uint v_17 = ((v_16.x) ? (uvec4(0u).x) : (uvec4(2u).x));
- uint v_18 = ((v_16.y) ? (uvec4(0u).y) : (uvec4(2u).y));
- uint v_19 = ((v_16.z) ? (uvec4(0u).z) : (uvec4(2u).z));
- uvec4 v_20 = uvec4(v_17, v_18, v_19, ((v_16.w) ? (uvec4(0u).w) : (uvec4(2u).w)));
- bvec4 v_21 = equal((((((v >> v_5) >> v_10) >> v_15) >> v_20) & uvec4(2u)), uvec4(0u));
- uint v_22 = ((v_21.x) ? (uvec4(0u).x) : (uvec4(1u).x));
- uint v_23 = ((v_21.y) ? (uvec4(0u).y) : (uvec4(1u).y));
- uint v_24 = ((v_21.z) ? (uvec4(0u).z) : (uvec4(1u).z));
- uvec4 v_25 = (v_5 | (v_10 | (v_15 | (v_20 | uvec4(v_22, v_23, v_24, ((v_21.w) ? (uvec4(0u).w) : (uvec4(1u).w)))))));
- bvec4 v_26 = equal(((((v >> v_5) >> v_10) >> v_15) >> v_20), uvec4(0u));
- uint v_27 = ((v_26.x) ? (uvec4(4294967295u).x) : (v_25.x));
- uint v_28 = ((v_26.y) ? (uvec4(4294967295u).y) : (v_25.y));
- uint v_29 = ((v_26.z) ? (uvec4(4294967295u).z) : (v_25.z));
- uvec4 res = uvec4(v_27, v_28, v_29, ((v_26.w) ? (uvec4(4294967295u).w) : (v_25.w)));
+ uvec4 v_1 = mix(uvec4(16u), uvec4(0u), equal((v & uvec4(4294901760u)), uvec4(0u)));
+ uvec4 v_2 = mix(uvec4(8u), uvec4(0u), equal(((v >> v_1) & uvec4(65280u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(4u), uvec4(0u), equal((((v >> v_1) >> v_2) & uvec4(240u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(2u), uvec4(0u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec4(12u)), uvec4(0u)));
+ uvec4 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec4(1u), uvec4(0u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec4(2u)), uvec4(0u)))))));
+ uvec4 res = mix(v_5, uvec4(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec4(0u)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -140,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_30 = vertex_main_inner();
- gl_Position = v_30.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_30.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl
index c6d4972..e4a1746 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_first_leading_bit(ivec3 v) {
- uvec3 x = tint_select(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_first_leading_bit(ivec3 v) {
- uvec3 x = tint_select(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_first_leading_bit(ivec3 v) {
- uvec3 x = tint_select(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.ir.glsl
index 9a9ea4c..37ba426 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.ir.glsl
@@ -9,34 +9,13 @@
ivec3 firstLeadingBit_35053e() {
ivec3 arg_0 = ivec3(1);
uvec3 v_1 = uvec3(arg_0);
- bvec3 v_2 = lessThan(v_1, uvec3(2147483648u));
- uint v_3 = ((v_2.x) ? (v_1.x) : (~(v_1).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (~(v_1).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (~(v_1).z)));
- bvec3 v_6 = equal((v_5 & uvec3(4294901760u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(0u).x) : (uvec3(16u).x));
- uint v_8 = ((v_6.y) ? (uvec3(0u).y) : (uvec3(16u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(0u).z) : (uvec3(16u).z)));
- bvec3 v_10 = equal(((v_5 >> v_9) & uvec3(65280u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(0u).x) : (uvec3(8u).x));
- uint v_12 = ((v_10.y) ? (uvec3(0u).y) : (uvec3(8u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(0u).z) : (uvec3(8u).z)));
- bvec3 v_14 = equal((((v_5 >> v_9) >> v_13) & uvec3(240u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(0u).x) : (uvec3(4u).x));
- uint v_16 = ((v_14.y) ? (uvec3(0u).y) : (uvec3(4u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(0u).z) : (uvec3(4u).z)));
- bvec3 v_18 = equal(((((v_5 >> v_9) >> v_13) >> v_17) & uvec3(12u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(0u).x) : (uvec3(2u).x));
- uint v_20 = ((v_18.y) ? (uvec3(0u).y) : (uvec3(2u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(0u).z) : (uvec3(2u).z)));
- bvec3 v_22 = equal((((((v_5 >> v_9) >> v_13) >> v_17) >> v_21) & uvec3(2u)), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(0u).x) : (uvec3(1u).x));
- uint v_24 = ((v_22.y) ? (uvec3(0u).y) : (uvec3(1u).y));
- uvec3 v_25 = (v_9 | (v_13 | (v_17 | (v_21 | uvec3(v_23, v_24, ((v_22.z) ? (uvec3(0u).z) : (uvec3(1u).z)))))));
- bvec3 v_26 = equal(((((v_5 >> v_9) >> v_13) >> v_17) >> v_21), uvec3(0u));
- uint v_27 = ((v_26.x) ? (uvec3(4294967295u).x) : (v_25.x));
- uint v_28 = ((v_26.y) ? (uvec3(4294967295u).y) : (v_25.y));
- ivec3 res = ivec3(uvec3(v_27, v_28, ((v_26.z) ? (uvec3(4294967295u).z) : (v_25.z))));
+ uvec3 v_2 = mix(~(v_1), v_1, lessThan(v_1, uvec3(2147483648u)));
+ uvec3 v_3 = mix(uvec3(16u), uvec3(0u), equal((v_2 & uvec3(4294901760u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(8u), uvec3(0u), equal(((v_2 >> v_3) & uvec3(65280u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(4u), uvec3(0u), equal((((v_2 >> v_3) >> v_4) & uvec3(240u)), uvec3(0u)));
+ uvec3 v_6 = mix(uvec3(2u), uvec3(0u), equal(((((v_2 >> v_3) >> v_4) >> v_5) & uvec3(12u)), uvec3(0u)));
+ uvec3 v_7 = (v_3 | (v_4 | (v_5 | (v_6 | mix(uvec3(1u), uvec3(0u), equal((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & uvec3(2u)), uvec3(0u)))))));
+ ivec3 res = ivec3(mix(v_7, uvec3(4294967295u), equal(((((v_2 >> v_3) >> v_4) >> v_5) >> v_6), uvec3(0u))));
return res;
}
void main() {
@@ -51,34 +30,13 @@
ivec3 firstLeadingBit_35053e() {
ivec3 arg_0 = ivec3(1);
uvec3 v_1 = uvec3(arg_0);
- bvec3 v_2 = lessThan(v_1, uvec3(2147483648u));
- uint v_3 = ((v_2.x) ? (v_1.x) : (~(v_1).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (~(v_1).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (~(v_1).z)));
- bvec3 v_6 = equal((v_5 & uvec3(4294901760u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(0u).x) : (uvec3(16u).x));
- uint v_8 = ((v_6.y) ? (uvec3(0u).y) : (uvec3(16u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(0u).z) : (uvec3(16u).z)));
- bvec3 v_10 = equal(((v_5 >> v_9) & uvec3(65280u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(0u).x) : (uvec3(8u).x));
- uint v_12 = ((v_10.y) ? (uvec3(0u).y) : (uvec3(8u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(0u).z) : (uvec3(8u).z)));
- bvec3 v_14 = equal((((v_5 >> v_9) >> v_13) & uvec3(240u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(0u).x) : (uvec3(4u).x));
- uint v_16 = ((v_14.y) ? (uvec3(0u).y) : (uvec3(4u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(0u).z) : (uvec3(4u).z)));
- bvec3 v_18 = equal(((((v_5 >> v_9) >> v_13) >> v_17) & uvec3(12u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(0u).x) : (uvec3(2u).x));
- uint v_20 = ((v_18.y) ? (uvec3(0u).y) : (uvec3(2u).y));
- uvec3 v_21 = uvec3(v_19, v_20, ((v_18.z) ? (uvec3(0u).z) : (uvec3(2u).z)));
- bvec3 v_22 = equal((((((v_5 >> v_9) >> v_13) >> v_17) >> v_21) & uvec3(2u)), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(0u).x) : (uvec3(1u).x));
- uint v_24 = ((v_22.y) ? (uvec3(0u).y) : (uvec3(1u).y));
- uvec3 v_25 = (v_9 | (v_13 | (v_17 | (v_21 | uvec3(v_23, v_24, ((v_22.z) ? (uvec3(0u).z) : (uvec3(1u).z)))))));
- bvec3 v_26 = equal(((((v_5 >> v_9) >> v_13) >> v_17) >> v_21), uvec3(0u));
- uint v_27 = ((v_26.x) ? (uvec3(4294967295u).x) : (v_25.x));
- uint v_28 = ((v_26.y) ? (uvec3(4294967295u).y) : (v_25.y));
- ivec3 res = ivec3(uvec3(v_27, v_28, ((v_26.z) ? (uvec3(4294967295u).z) : (v_25.z))));
+ uvec3 v_2 = mix(~(v_1), v_1, lessThan(v_1, uvec3(2147483648u)));
+ uvec3 v_3 = mix(uvec3(16u), uvec3(0u), equal((v_2 & uvec3(4294901760u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(8u), uvec3(0u), equal(((v_2 >> v_3) & uvec3(65280u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(4u), uvec3(0u), equal((((v_2 >> v_3) >> v_4) & uvec3(240u)), uvec3(0u)));
+ uvec3 v_6 = mix(uvec3(2u), uvec3(0u), equal(((((v_2 >> v_3) >> v_4) >> v_5) & uvec3(12u)), uvec3(0u)));
+ uvec3 v_7 = (v_3 | (v_4 | (v_5 | (v_6 | mix(uvec3(1u), uvec3(0u), equal((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & uvec3(2u)), uvec3(0u)))))));
+ ivec3 res = ivec3(mix(v_7, uvec3(4294967295u), equal(((((v_2 >> v_3) >> v_4) >> v_5) >> v_6), uvec3(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -97,34 +55,13 @@
ivec3 firstLeadingBit_35053e() {
ivec3 arg_0 = ivec3(1);
uvec3 v = uvec3(arg_0);
- bvec3 v_1 = lessThan(v, uvec3(2147483648u));
- uint v_2 = ((v_1.x) ? (v.x) : (~(v).x));
- uint v_3 = ((v_1.y) ? (v.y) : (~(v).y));
- uvec3 v_4 = uvec3(v_2, v_3, ((v_1.z) ? (v.z) : (~(v).z)));
- bvec3 v_5 = equal((v_4 & uvec3(4294901760u)), uvec3(0u));
- uint v_6 = ((v_5.x) ? (uvec3(0u).x) : (uvec3(16u).x));
- uint v_7 = ((v_5.y) ? (uvec3(0u).y) : (uvec3(16u).y));
- uvec3 v_8 = uvec3(v_6, v_7, ((v_5.z) ? (uvec3(0u).z) : (uvec3(16u).z)));
- bvec3 v_9 = equal(((v_4 >> v_8) & uvec3(65280u)), uvec3(0u));
- uint v_10 = ((v_9.x) ? (uvec3(0u).x) : (uvec3(8u).x));
- uint v_11 = ((v_9.y) ? (uvec3(0u).y) : (uvec3(8u).y));
- uvec3 v_12 = uvec3(v_10, v_11, ((v_9.z) ? (uvec3(0u).z) : (uvec3(8u).z)));
- bvec3 v_13 = equal((((v_4 >> v_8) >> v_12) & uvec3(240u)), uvec3(0u));
- uint v_14 = ((v_13.x) ? (uvec3(0u).x) : (uvec3(4u).x));
- uint v_15 = ((v_13.y) ? (uvec3(0u).y) : (uvec3(4u).y));
- uvec3 v_16 = uvec3(v_14, v_15, ((v_13.z) ? (uvec3(0u).z) : (uvec3(4u).z)));
- bvec3 v_17 = equal(((((v_4 >> v_8) >> v_12) >> v_16) & uvec3(12u)), uvec3(0u));
- uint v_18 = ((v_17.x) ? (uvec3(0u).x) : (uvec3(2u).x));
- uint v_19 = ((v_17.y) ? (uvec3(0u).y) : (uvec3(2u).y));
- uvec3 v_20 = uvec3(v_18, v_19, ((v_17.z) ? (uvec3(0u).z) : (uvec3(2u).z)));
- bvec3 v_21 = equal((((((v_4 >> v_8) >> v_12) >> v_16) >> v_20) & uvec3(2u)), uvec3(0u));
- uint v_22 = ((v_21.x) ? (uvec3(0u).x) : (uvec3(1u).x));
- uint v_23 = ((v_21.y) ? (uvec3(0u).y) : (uvec3(1u).y));
- uvec3 v_24 = (v_8 | (v_12 | (v_16 | (v_20 | uvec3(v_22, v_23, ((v_21.z) ? (uvec3(0u).z) : (uvec3(1u).z)))))));
- bvec3 v_25 = equal(((((v_4 >> v_8) >> v_12) >> v_16) >> v_20), uvec3(0u));
- uint v_26 = ((v_25.x) ? (uvec3(4294967295u).x) : (v_24.x));
- uint v_27 = ((v_25.y) ? (uvec3(4294967295u).y) : (v_24.y));
- ivec3 res = ivec3(uvec3(v_26, v_27, ((v_25.z) ? (uvec3(4294967295u).z) : (v_24.z))));
+ uvec3 v_1 = mix(~(v), v, lessThan(v, uvec3(2147483648u)));
+ uvec3 v_2 = mix(uvec3(16u), uvec3(0u), equal((v_1 & uvec3(4294901760u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(8u), uvec3(0u), equal(((v_1 >> v_2) & uvec3(65280u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(4u), uvec3(0u), equal((((v_1 >> v_2) >> v_3) & uvec3(240u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(2u), uvec3(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(12u)), uvec3(0u)));
+ uvec3 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec3(1u), uvec3(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(2u)), uvec3(0u)))))));
+ ivec3 res = ivec3(mix(v_6, uvec3(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -134,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_28 = vertex_main_inner();
- gl_Position = v_28.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_28.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl
index d757957..7d8edf0 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_first_leading_bit(uvec3 v) {
uvec3 x = v;
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_first_leading_bit(uvec3 v) {
uvec3 x = v;
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_first_leading_bit(uvec3 v) {
uvec3 x = v;
- uvec3 b16 = tint_select(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.ir.glsl
index 284ff61..124870a 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.ir.glsl
@@ -9,30 +9,12 @@
uvec3 firstLeadingBit_3fd7d0() {
uvec3 arg_0 = uvec3(1u);
uvec3 v_1 = arg_0;
- bvec3 v_2 = equal((v_1 & uvec3(4294901760u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(0u).x) : (uvec3(16u).x));
- uint v_4 = ((v_2.y) ? (uvec3(0u).y) : (uvec3(16u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(0u).z) : (uvec3(16u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(65280u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(0u).x) : (uvec3(8u).x));
- uint v_8 = ((v_6.y) ? (uvec3(0u).y) : (uvec3(8u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(0u).z) : (uvec3(8u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(240u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(0u).x) : (uvec3(4u).x));
- uint v_12 = ((v_10.y) ? (uvec3(0u).y) : (uvec3(4u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(0u).z) : (uvec3(4u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(12u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(0u).x) : (uvec3(2u).x));
- uint v_16 = ((v_14.y) ? (uvec3(0u).y) : (uvec3(2u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(0u).z) : (uvec3(2u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(2u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(0u).x) : (uvec3(1u).x));
- uint v_20 = ((v_18.y) ? (uvec3(0u).y) : (uvec3(1u).y));
- uvec3 v_21 = (v_5 | (v_9 | (v_13 | (v_17 | uvec3(v_19, v_20, ((v_18.z) ? (uvec3(0u).z) : (uvec3(1u).z)))))));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(4294967295u).x) : (v_21.x));
- uint v_24 = ((v_22.y) ? (uvec3(4294967295u).y) : (v_21.y));
- uvec3 res = uvec3(v_23, v_24, ((v_22.z) ? (uvec3(4294967295u).z) : (v_21.z)));
+ uvec3 v_2 = mix(uvec3(16u), uvec3(0u), equal((v_1 & uvec3(4294901760u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(8u), uvec3(0u), equal(((v_1 >> v_2) & uvec3(65280u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(4u), uvec3(0u), equal((((v_1 >> v_2) >> v_3) & uvec3(240u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(2u), uvec3(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(12u)), uvec3(0u)));
+ uvec3 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec3(1u), uvec3(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(2u)), uvec3(0u)))))));
+ uvec3 res = mix(v_6, uvec3(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u)));
return res;
}
void main() {
@@ -47,30 +29,12 @@
uvec3 firstLeadingBit_3fd7d0() {
uvec3 arg_0 = uvec3(1u);
uvec3 v_1 = arg_0;
- bvec3 v_2 = equal((v_1 & uvec3(4294901760u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(0u).x) : (uvec3(16u).x));
- uint v_4 = ((v_2.y) ? (uvec3(0u).y) : (uvec3(16u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(0u).z) : (uvec3(16u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(65280u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(0u).x) : (uvec3(8u).x));
- uint v_8 = ((v_6.y) ? (uvec3(0u).y) : (uvec3(8u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(0u).z) : (uvec3(8u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(240u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(0u).x) : (uvec3(4u).x));
- uint v_12 = ((v_10.y) ? (uvec3(0u).y) : (uvec3(4u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(0u).z) : (uvec3(4u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(12u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(0u).x) : (uvec3(2u).x));
- uint v_16 = ((v_14.y) ? (uvec3(0u).y) : (uvec3(2u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(0u).z) : (uvec3(2u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(2u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(0u).x) : (uvec3(1u).x));
- uint v_20 = ((v_18.y) ? (uvec3(0u).y) : (uvec3(1u).y));
- uvec3 v_21 = (v_5 | (v_9 | (v_13 | (v_17 | uvec3(v_19, v_20, ((v_18.z) ? (uvec3(0u).z) : (uvec3(1u).z)))))));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(4294967295u).x) : (v_21.x));
- uint v_24 = ((v_22.y) ? (uvec3(4294967295u).y) : (v_21.y));
- uvec3 res = uvec3(v_23, v_24, ((v_22.z) ? (uvec3(4294967295u).z) : (v_21.z)));
+ uvec3 v_2 = mix(uvec3(16u), uvec3(0u), equal((v_1 & uvec3(4294901760u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(8u), uvec3(0u), equal(((v_1 >> v_2) & uvec3(65280u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(4u), uvec3(0u), equal((((v_1 >> v_2) >> v_3) & uvec3(240u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(2u), uvec3(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(12u)), uvec3(0u)));
+ uvec3 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec3(1u), uvec3(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(2u)), uvec3(0u)))))));
+ uvec3 res = mix(v_6, uvec3(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -89,30 +53,12 @@
uvec3 firstLeadingBit_3fd7d0() {
uvec3 arg_0 = uvec3(1u);
uvec3 v = arg_0;
- bvec3 v_1 = equal((v & uvec3(4294901760u)), uvec3(0u));
- uint v_2 = ((v_1.x) ? (uvec3(0u).x) : (uvec3(16u).x));
- uint v_3 = ((v_1.y) ? (uvec3(0u).y) : (uvec3(16u).y));
- uvec3 v_4 = uvec3(v_2, v_3, ((v_1.z) ? (uvec3(0u).z) : (uvec3(16u).z)));
- bvec3 v_5 = equal(((v >> v_4) & uvec3(65280u)), uvec3(0u));
- uint v_6 = ((v_5.x) ? (uvec3(0u).x) : (uvec3(8u).x));
- uint v_7 = ((v_5.y) ? (uvec3(0u).y) : (uvec3(8u).y));
- uvec3 v_8 = uvec3(v_6, v_7, ((v_5.z) ? (uvec3(0u).z) : (uvec3(8u).z)));
- bvec3 v_9 = equal((((v >> v_4) >> v_8) & uvec3(240u)), uvec3(0u));
- uint v_10 = ((v_9.x) ? (uvec3(0u).x) : (uvec3(4u).x));
- uint v_11 = ((v_9.y) ? (uvec3(0u).y) : (uvec3(4u).y));
- uvec3 v_12 = uvec3(v_10, v_11, ((v_9.z) ? (uvec3(0u).z) : (uvec3(4u).z)));
- bvec3 v_13 = equal(((((v >> v_4) >> v_8) >> v_12) & uvec3(12u)), uvec3(0u));
- uint v_14 = ((v_13.x) ? (uvec3(0u).x) : (uvec3(2u).x));
- uint v_15 = ((v_13.y) ? (uvec3(0u).y) : (uvec3(2u).y));
- uvec3 v_16 = uvec3(v_14, v_15, ((v_13.z) ? (uvec3(0u).z) : (uvec3(2u).z)));
- bvec3 v_17 = equal((((((v >> v_4) >> v_8) >> v_12) >> v_16) & uvec3(2u)), uvec3(0u));
- uint v_18 = ((v_17.x) ? (uvec3(0u).x) : (uvec3(1u).x));
- uint v_19 = ((v_17.y) ? (uvec3(0u).y) : (uvec3(1u).y));
- uvec3 v_20 = (v_4 | (v_8 | (v_12 | (v_16 | uvec3(v_18, v_19, ((v_17.z) ? (uvec3(0u).z) : (uvec3(1u).z)))))));
- bvec3 v_21 = equal(((((v >> v_4) >> v_8) >> v_12) >> v_16), uvec3(0u));
- uint v_22 = ((v_21.x) ? (uvec3(4294967295u).x) : (v_20.x));
- uint v_23 = ((v_21.y) ? (uvec3(4294967295u).y) : (v_20.y));
- uvec3 res = uvec3(v_22, v_23, ((v_21.z) ? (uvec3(4294967295u).z) : (v_20.z)));
+ uvec3 v_1 = mix(uvec3(16u), uvec3(0u), equal((v & uvec3(4294901760u)), uvec3(0u)));
+ uvec3 v_2 = mix(uvec3(8u), uvec3(0u), equal(((v >> v_1) & uvec3(65280u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(4u), uvec3(0u), equal((((v >> v_1) >> v_2) & uvec3(240u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(2u), uvec3(0u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec3(12u)), uvec3(0u)));
+ uvec3 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec3(1u), uvec3(0u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec3(2u)), uvec3(0u)))))));
+ uvec3 res = mix(v_5, uvec3(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec3(0u)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -122,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_24 = vertex_main_inner();
- gl_Position = v_24.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_24.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl
index 0f06b26..059153f 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl
@@ -3,17 +3,17 @@
precision highp int;
int tint_first_leading_bit(int v) {
- uint x = ((v < 0) ? uint(~(v)) : uint(v));
- uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ uint x = mix(uint(v), uint(~(v)), (v < 0));
+ uint b16 = mix(0u, 16u, bool((x & 4294901760u)));
x = (x >> b16);
- uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, bool((x & 65280u)));
x = (x >> b8);
- uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, bool((x & 240u)));
x = (x >> b4);
- uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, bool((x & 12u)));
x = (x >> b2);
- uint b1 = (bool((x & 2u)) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(0u, 1u, bool((x & 2u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -43,17 +43,17 @@
#version 310 es
int tint_first_leading_bit(int v) {
- uint x = ((v < 0) ? uint(~(v)) : uint(v));
- uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ uint x = mix(uint(v), uint(~(v)), (v < 0));
+ uint b16 = mix(0u, 16u, bool((x & 4294901760u)));
x = (x >> b16);
- uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, bool((x & 65280u)));
x = (x >> b8);
- uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, bool((x & 240u)));
x = (x >> b4);
- uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, bool((x & 12u)));
x = (x >> b2);
- uint b1 = (bool((x & 2u)) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(0u, 1u, bool((x & 2u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -84,17 +84,17 @@
#version 310 es
int tint_first_leading_bit(int v) {
- uint x = ((v < 0) ? uint(~(v)) : uint(v));
- uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ uint x = mix(uint(v), uint(~(v)), (v < 0));
+ uint b16 = mix(0u, 16u, bool((x & 4294901760u)));
x = (x >> b16);
- uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, bool((x & 65280u)));
x = (x >> b8);
- uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, bool((x & 240u)));
x = (x >> b4);
- uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, bool((x & 12u)));
x = (x >> b2);
- uint b1 = (bool((x & 2u)) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(0u, 1u, bool((x & 2u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.ir.glsl
index 2a5a733..cf3fc5c 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.ir.glsl
@@ -9,12 +9,12 @@
int firstLeadingBit_57a1a3() {
int arg_0 = 1;
uint v_1 = uint(arg_0);
- uint v_2 = (((v_1 < 2147483648u)) ? (v_1) : (~(v_1)));
- uint v_3 = ((((v_2 & 4294901760u) == 0u)) ? (0u) : (16u));
- uint v_4 = (((((v_2 >> v_3) & 65280u) == 0u)) ? (0u) : (8u));
- uint v_5 = ((((((v_2 >> v_3) >> v_4) & 240u) == 0u)) ? (0u) : (4u));
- uint v_6 = (((((((v_2 >> v_3) >> v_4) >> v_5) & 12u) == 0u)) ? (0u) : (2u));
- int res = int((((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) == 0u)) ? (4294967295u) : ((v_3 | (v_4 | (v_5 | (v_6 | ((((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & 2u) == 0u)) ? (0u) : (1u)))))))));
+ uint v_2 = mix(~(v_1), v_1, (v_1 < 2147483648u));
+ uint v_3 = mix(16u, 0u, ((v_2 & 4294901760u) == 0u));
+ uint v_4 = mix(8u, 0u, (((v_2 >> v_3) & 65280u) == 0u));
+ uint v_5 = mix(4u, 0u, ((((v_2 >> v_3) >> v_4) & 240u) == 0u));
+ uint v_6 = mix(2u, 0u, (((((v_2 >> v_3) >> v_4) >> v_5) & 12u) == 0u));
+ int res = int(mix((v_3 | (v_4 | (v_5 | (v_6 | mix(1u, 0u, ((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & 2u) == 0u)))))), 4294967295u, (((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) == 0u)));
return res;
}
void main() {
@@ -29,12 +29,12 @@
int firstLeadingBit_57a1a3() {
int arg_0 = 1;
uint v_1 = uint(arg_0);
- uint v_2 = (((v_1 < 2147483648u)) ? (v_1) : (~(v_1)));
- uint v_3 = ((((v_2 & 4294901760u) == 0u)) ? (0u) : (16u));
- uint v_4 = (((((v_2 >> v_3) & 65280u) == 0u)) ? (0u) : (8u));
- uint v_5 = ((((((v_2 >> v_3) >> v_4) & 240u) == 0u)) ? (0u) : (4u));
- uint v_6 = (((((((v_2 >> v_3) >> v_4) >> v_5) & 12u) == 0u)) ? (0u) : (2u));
- int res = int((((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) == 0u)) ? (4294967295u) : ((v_3 | (v_4 | (v_5 | (v_6 | ((((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & 2u) == 0u)) ? (0u) : (1u)))))))));
+ uint v_2 = mix(~(v_1), v_1, (v_1 < 2147483648u));
+ uint v_3 = mix(16u, 0u, ((v_2 & 4294901760u) == 0u));
+ uint v_4 = mix(8u, 0u, (((v_2 >> v_3) & 65280u) == 0u));
+ uint v_5 = mix(4u, 0u, ((((v_2 >> v_3) >> v_4) & 240u) == 0u));
+ uint v_6 = mix(2u, 0u, (((((v_2 >> v_3) >> v_4) >> v_5) & 12u) == 0u));
+ int res = int(mix((v_3 | (v_4 | (v_5 | (v_6 | mix(1u, 0u, ((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & 2u) == 0u)))))), 4294967295u, (((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) == 0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -53,12 +53,12 @@
int firstLeadingBit_57a1a3() {
int arg_0 = 1;
uint v = uint(arg_0);
- uint v_1 = (((v < 2147483648u)) ? (v) : (~(v)));
- uint v_2 = ((((v_1 & 4294901760u) == 0u)) ? (0u) : (16u));
- uint v_3 = (((((v_1 >> v_2) & 65280u) == 0u)) ? (0u) : (8u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 240u) == 0u)) ? (0u) : (4u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 12u) == 0u)) ? (0u) : (2u));
- int res = int((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (4294967295u) : ((v_2 | (v_3 | (v_4 | (v_5 | ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 2u) == 0u)) ? (0u) : (1u)))))))));
+ uint v_1 = mix(~(v), v, (v < 2147483648u));
+ uint v_2 = mix(16u, 0u, ((v_1 & 4294901760u) == 0u));
+ uint v_3 = mix(8u, 0u, (((v_1 >> v_2) & 65280u) == 0u));
+ uint v_4 = mix(4u, 0u, ((((v_1 >> v_2) >> v_3) & 240u) == 0u));
+ uint v_5 = mix(2u, 0u, (((((v_1 >> v_2) >> v_3) >> v_4) & 12u) == 0u));
+ int res = int(mix((v_2 | (v_3 | (v_4 | (v_5 | mix(1u, 0u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 2u) == 0u)))))), 4294967295u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)));
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl
index 2b257ab..2829f54a 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_first_leading_bit(uvec2 v) {
uvec2 x = v;
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_first_leading_bit(uvec2 v) {
uvec2 x = v;
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_first_leading_bit(uvec2 v) {
uvec2 x = v;
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.ir.glsl
index 2b993e9..2123eb2 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.ir.glsl
@@ -9,24 +9,12 @@
uvec2 firstLeadingBit_6fe804() {
uvec2 arg_0 = uvec2(1u);
uvec2 v_1 = arg_0;
- bvec2 v_2 = equal((v_1 & uvec2(4294901760u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(0u).x) : (uvec2(16u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(0u).y) : (uvec2(16u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(65280u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(0u).x) : (uvec2(8u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(0u).y) : (uvec2(8u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(240u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(0u).x) : (uvec2(4u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(0u).y) : (uvec2(4u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(12u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(0u).x) : (uvec2(2u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(0u).y) : (uvec2(2u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(2u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(0u).x) : (uvec2(1u).x));
- uvec2 v_16 = (v_4 | (v_7 | (v_10 | (v_13 | uvec2(v_15, ((v_14.y) ? (uvec2(0u).y) : (uvec2(1u).y)))))));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(4294967295u).x) : (v_16.x));
- uvec2 res = uvec2(v_18, ((v_17.y) ? (uvec2(4294967295u).y) : (v_16.y)));
+ uvec2 v_2 = mix(uvec2(16u), uvec2(0u), equal((v_1 & uvec2(4294901760u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(8u), uvec2(0u), equal(((v_1 >> v_2) & uvec2(65280u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(4u), uvec2(0u), equal((((v_1 >> v_2) >> v_3) & uvec2(240u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(2u), uvec2(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(12u)), uvec2(0u)));
+ uvec2 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec2(1u), uvec2(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(2u)), uvec2(0u)))))));
+ uvec2 res = mix(v_6, uvec2(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u)));
return res;
}
void main() {
@@ -41,24 +29,12 @@
uvec2 firstLeadingBit_6fe804() {
uvec2 arg_0 = uvec2(1u);
uvec2 v_1 = arg_0;
- bvec2 v_2 = equal((v_1 & uvec2(4294901760u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(0u).x) : (uvec2(16u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(0u).y) : (uvec2(16u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(65280u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(0u).x) : (uvec2(8u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(0u).y) : (uvec2(8u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(240u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(0u).x) : (uvec2(4u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(0u).y) : (uvec2(4u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(12u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(0u).x) : (uvec2(2u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(0u).y) : (uvec2(2u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(2u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(0u).x) : (uvec2(1u).x));
- uvec2 v_16 = (v_4 | (v_7 | (v_10 | (v_13 | uvec2(v_15, ((v_14.y) ? (uvec2(0u).y) : (uvec2(1u).y)))))));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(4294967295u).x) : (v_16.x));
- uvec2 res = uvec2(v_18, ((v_17.y) ? (uvec2(4294967295u).y) : (v_16.y)));
+ uvec2 v_2 = mix(uvec2(16u), uvec2(0u), equal((v_1 & uvec2(4294901760u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(8u), uvec2(0u), equal(((v_1 >> v_2) & uvec2(65280u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(4u), uvec2(0u), equal((((v_1 >> v_2) >> v_3) & uvec2(240u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(2u), uvec2(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(12u)), uvec2(0u)));
+ uvec2 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec2(1u), uvec2(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(2u)), uvec2(0u)))))));
+ uvec2 res = mix(v_6, uvec2(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -77,24 +53,12 @@
uvec2 firstLeadingBit_6fe804() {
uvec2 arg_0 = uvec2(1u);
uvec2 v = arg_0;
- bvec2 v_1 = equal((v & uvec2(4294901760u)), uvec2(0u));
- uint v_2 = ((v_1.x) ? (uvec2(0u).x) : (uvec2(16u).x));
- uvec2 v_3 = uvec2(v_2, ((v_1.y) ? (uvec2(0u).y) : (uvec2(16u).y)));
- bvec2 v_4 = equal(((v >> v_3) & uvec2(65280u)), uvec2(0u));
- uint v_5 = ((v_4.x) ? (uvec2(0u).x) : (uvec2(8u).x));
- uvec2 v_6 = uvec2(v_5, ((v_4.y) ? (uvec2(0u).y) : (uvec2(8u).y)));
- bvec2 v_7 = equal((((v >> v_3) >> v_6) & uvec2(240u)), uvec2(0u));
- uint v_8 = ((v_7.x) ? (uvec2(0u).x) : (uvec2(4u).x));
- uvec2 v_9 = uvec2(v_8, ((v_7.y) ? (uvec2(0u).y) : (uvec2(4u).y)));
- bvec2 v_10 = equal(((((v >> v_3) >> v_6) >> v_9) & uvec2(12u)), uvec2(0u));
- uint v_11 = ((v_10.x) ? (uvec2(0u).x) : (uvec2(2u).x));
- uvec2 v_12 = uvec2(v_11, ((v_10.y) ? (uvec2(0u).y) : (uvec2(2u).y)));
- bvec2 v_13 = equal((((((v >> v_3) >> v_6) >> v_9) >> v_12) & uvec2(2u)), uvec2(0u));
- uint v_14 = ((v_13.x) ? (uvec2(0u).x) : (uvec2(1u).x));
- uvec2 v_15 = (v_3 | (v_6 | (v_9 | (v_12 | uvec2(v_14, ((v_13.y) ? (uvec2(0u).y) : (uvec2(1u).y)))))));
- bvec2 v_16 = equal(((((v >> v_3) >> v_6) >> v_9) >> v_12), uvec2(0u));
- uint v_17 = ((v_16.x) ? (uvec2(4294967295u).x) : (v_15.x));
- uvec2 res = uvec2(v_17, ((v_16.y) ? (uvec2(4294967295u).y) : (v_15.y)));
+ uvec2 v_1 = mix(uvec2(16u), uvec2(0u), equal((v & uvec2(4294901760u)), uvec2(0u)));
+ uvec2 v_2 = mix(uvec2(8u), uvec2(0u), equal(((v >> v_1) & uvec2(65280u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(4u), uvec2(0u), equal((((v >> v_1) >> v_2) & uvec2(240u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(2u), uvec2(0u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec2(12u)), uvec2(0u)));
+ uvec2 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec2(1u), uvec2(0u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec2(2u)), uvec2(0u)))))));
+ uvec2 res = mix(v_5, uvec2(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec2(0u)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -104,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_18 = vertex_main_inner();
- gl_Position = v_18.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_18.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl
index 713d464..247f17f 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_first_leading_bit(ivec2 v) {
- uvec2 x = tint_select(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_first_leading_bit(ivec2 v) {
- uvec2 x = tint_select(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_first_leading_bit(ivec2 v) {
- uvec2 x = tint_select(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
- uvec2 b16 = tint_select(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.ir.glsl
index f163d01..aab5850 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.ir.glsl
@@ -9,27 +9,13 @@
ivec2 firstLeadingBit_a622c2() {
ivec2 arg_0 = ivec2(1);
uvec2 v_1 = uvec2(arg_0);
- bvec2 v_2 = lessThan(v_1, uvec2(2147483648u));
- uint v_3 = ((v_2.x) ? (v_1.x) : (~(v_1).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (v_1.y) : (~(v_1).y)));
- bvec2 v_5 = equal((v_4 & uvec2(4294901760u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(0u).x) : (uvec2(16u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(0u).y) : (uvec2(16u).y)));
- bvec2 v_8 = equal(((v_4 >> v_7) & uvec2(65280u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(0u).x) : (uvec2(8u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(0u).y) : (uvec2(8u).y)));
- bvec2 v_11 = equal((((v_4 >> v_7) >> v_10) & uvec2(240u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(0u).x) : (uvec2(4u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(0u).y) : (uvec2(4u).y)));
- bvec2 v_14 = equal(((((v_4 >> v_7) >> v_10) >> v_13) & uvec2(12u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(0u).x) : (uvec2(2u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(0u).y) : (uvec2(2u).y)));
- bvec2 v_17 = equal((((((v_4 >> v_7) >> v_10) >> v_13) >> v_16) & uvec2(2u)), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(0u).x) : (uvec2(1u).x));
- uvec2 v_19 = (v_7 | (v_10 | (v_13 | (v_16 | uvec2(v_18, ((v_17.y) ? (uvec2(0u).y) : (uvec2(1u).y)))))));
- bvec2 v_20 = equal(((((v_4 >> v_7) >> v_10) >> v_13) >> v_16), uvec2(0u));
- uint v_21 = ((v_20.x) ? (uvec2(4294967295u).x) : (v_19.x));
- ivec2 res = ivec2(uvec2(v_21, ((v_20.y) ? (uvec2(4294967295u).y) : (v_19.y))));
+ uvec2 v_2 = mix(~(v_1), v_1, lessThan(v_1, uvec2(2147483648u)));
+ uvec2 v_3 = mix(uvec2(16u), uvec2(0u), equal((v_2 & uvec2(4294901760u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(8u), uvec2(0u), equal(((v_2 >> v_3) & uvec2(65280u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(4u), uvec2(0u), equal((((v_2 >> v_3) >> v_4) & uvec2(240u)), uvec2(0u)));
+ uvec2 v_6 = mix(uvec2(2u), uvec2(0u), equal(((((v_2 >> v_3) >> v_4) >> v_5) & uvec2(12u)), uvec2(0u)));
+ uvec2 v_7 = (v_3 | (v_4 | (v_5 | (v_6 | mix(uvec2(1u), uvec2(0u), equal((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & uvec2(2u)), uvec2(0u)))))));
+ ivec2 res = ivec2(mix(v_7, uvec2(4294967295u), equal(((((v_2 >> v_3) >> v_4) >> v_5) >> v_6), uvec2(0u))));
return res;
}
void main() {
@@ -44,27 +30,13 @@
ivec2 firstLeadingBit_a622c2() {
ivec2 arg_0 = ivec2(1);
uvec2 v_1 = uvec2(arg_0);
- bvec2 v_2 = lessThan(v_1, uvec2(2147483648u));
- uint v_3 = ((v_2.x) ? (v_1.x) : (~(v_1).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (v_1.y) : (~(v_1).y)));
- bvec2 v_5 = equal((v_4 & uvec2(4294901760u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(0u).x) : (uvec2(16u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(0u).y) : (uvec2(16u).y)));
- bvec2 v_8 = equal(((v_4 >> v_7) & uvec2(65280u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(0u).x) : (uvec2(8u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(0u).y) : (uvec2(8u).y)));
- bvec2 v_11 = equal((((v_4 >> v_7) >> v_10) & uvec2(240u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(0u).x) : (uvec2(4u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(0u).y) : (uvec2(4u).y)));
- bvec2 v_14 = equal(((((v_4 >> v_7) >> v_10) >> v_13) & uvec2(12u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(0u).x) : (uvec2(2u).x));
- uvec2 v_16 = uvec2(v_15, ((v_14.y) ? (uvec2(0u).y) : (uvec2(2u).y)));
- bvec2 v_17 = equal((((((v_4 >> v_7) >> v_10) >> v_13) >> v_16) & uvec2(2u)), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(0u).x) : (uvec2(1u).x));
- uvec2 v_19 = (v_7 | (v_10 | (v_13 | (v_16 | uvec2(v_18, ((v_17.y) ? (uvec2(0u).y) : (uvec2(1u).y)))))));
- bvec2 v_20 = equal(((((v_4 >> v_7) >> v_10) >> v_13) >> v_16), uvec2(0u));
- uint v_21 = ((v_20.x) ? (uvec2(4294967295u).x) : (v_19.x));
- ivec2 res = ivec2(uvec2(v_21, ((v_20.y) ? (uvec2(4294967295u).y) : (v_19.y))));
+ uvec2 v_2 = mix(~(v_1), v_1, lessThan(v_1, uvec2(2147483648u)));
+ uvec2 v_3 = mix(uvec2(16u), uvec2(0u), equal((v_2 & uvec2(4294901760u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(8u), uvec2(0u), equal(((v_2 >> v_3) & uvec2(65280u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(4u), uvec2(0u), equal((((v_2 >> v_3) >> v_4) & uvec2(240u)), uvec2(0u)));
+ uvec2 v_6 = mix(uvec2(2u), uvec2(0u), equal(((((v_2 >> v_3) >> v_4) >> v_5) & uvec2(12u)), uvec2(0u)));
+ uvec2 v_7 = (v_3 | (v_4 | (v_5 | (v_6 | mix(uvec2(1u), uvec2(0u), equal((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & uvec2(2u)), uvec2(0u)))))));
+ ivec2 res = ivec2(mix(v_7, uvec2(4294967295u), equal(((((v_2 >> v_3) >> v_4) >> v_5) >> v_6), uvec2(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -83,27 +55,13 @@
ivec2 firstLeadingBit_a622c2() {
ivec2 arg_0 = ivec2(1);
uvec2 v = uvec2(arg_0);
- bvec2 v_1 = lessThan(v, uvec2(2147483648u));
- uint v_2 = ((v_1.x) ? (v.x) : (~(v).x));
- uvec2 v_3 = uvec2(v_2, ((v_1.y) ? (v.y) : (~(v).y)));
- bvec2 v_4 = equal((v_3 & uvec2(4294901760u)), uvec2(0u));
- uint v_5 = ((v_4.x) ? (uvec2(0u).x) : (uvec2(16u).x));
- uvec2 v_6 = uvec2(v_5, ((v_4.y) ? (uvec2(0u).y) : (uvec2(16u).y)));
- bvec2 v_7 = equal(((v_3 >> v_6) & uvec2(65280u)), uvec2(0u));
- uint v_8 = ((v_7.x) ? (uvec2(0u).x) : (uvec2(8u).x));
- uvec2 v_9 = uvec2(v_8, ((v_7.y) ? (uvec2(0u).y) : (uvec2(8u).y)));
- bvec2 v_10 = equal((((v_3 >> v_6) >> v_9) & uvec2(240u)), uvec2(0u));
- uint v_11 = ((v_10.x) ? (uvec2(0u).x) : (uvec2(4u).x));
- uvec2 v_12 = uvec2(v_11, ((v_10.y) ? (uvec2(0u).y) : (uvec2(4u).y)));
- bvec2 v_13 = equal(((((v_3 >> v_6) >> v_9) >> v_12) & uvec2(12u)), uvec2(0u));
- uint v_14 = ((v_13.x) ? (uvec2(0u).x) : (uvec2(2u).x));
- uvec2 v_15 = uvec2(v_14, ((v_13.y) ? (uvec2(0u).y) : (uvec2(2u).y)));
- bvec2 v_16 = equal((((((v_3 >> v_6) >> v_9) >> v_12) >> v_15) & uvec2(2u)), uvec2(0u));
- uint v_17 = ((v_16.x) ? (uvec2(0u).x) : (uvec2(1u).x));
- uvec2 v_18 = (v_6 | (v_9 | (v_12 | (v_15 | uvec2(v_17, ((v_16.y) ? (uvec2(0u).y) : (uvec2(1u).y)))))));
- bvec2 v_19 = equal(((((v_3 >> v_6) >> v_9) >> v_12) >> v_15), uvec2(0u));
- uint v_20 = ((v_19.x) ? (uvec2(4294967295u).x) : (v_18.x));
- ivec2 res = ivec2(uvec2(v_20, ((v_19.y) ? (uvec2(4294967295u).y) : (v_18.y))));
+ uvec2 v_1 = mix(~(v), v, lessThan(v, uvec2(2147483648u)));
+ uvec2 v_2 = mix(uvec2(16u), uvec2(0u), equal((v_1 & uvec2(4294901760u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(8u), uvec2(0u), equal(((v_1 >> v_2) & uvec2(65280u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(4u), uvec2(0u), equal((((v_1 >> v_2) >> v_3) & uvec2(240u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(2u), uvec2(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(12u)), uvec2(0u)));
+ uvec2 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec2(1u), uvec2(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(2u)), uvec2(0u)))))));
+ ivec2 res = ivec2(mix(v_6, uvec2(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -113,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_21 = vertex_main_inner();
- gl_Position = v_21.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_21.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl
index ff0ec74..9b9bb16 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_first_leading_bit(ivec4 v) {
- uvec4 x = tint_select(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_first_leading_bit(ivec4 v) {
- uvec4 x = tint_select(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_first_leading_bit(ivec4 v) {
- uvec4 x = tint_select(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
- uvec4 b16 = tint_select(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.ir.glsl
index d469c05..b561a13 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.ir.glsl
@@ -9,41 +9,13 @@
ivec4 firstLeadingBit_c1f940() {
ivec4 arg_0 = ivec4(1);
uvec4 v_1 = uvec4(arg_0);
- bvec4 v_2 = lessThan(v_1, uvec4(2147483648u));
- uint v_3 = ((v_2.x) ? (v_1.x) : (~(v_1).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (~(v_1).y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (~(v_1).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (~(v_1).w)));
- bvec4 v_7 = equal((v_6 & uvec4(4294901760u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(0u).x) : (uvec4(16u).x));
- uint v_9 = ((v_7.y) ? (uvec4(0u).y) : (uvec4(16u).y));
- uint v_10 = ((v_7.z) ? (uvec4(0u).z) : (uvec4(16u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(0u).w) : (uvec4(16u).w)));
- bvec4 v_12 = equal(((v_6 >> v_11) & uvec4(65280u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(0u).x) : (uvec4(8u).x));
- uint v_14 = ((v_12.y) ? (uvec4(0u).y) : (uvec4(8u).y));
- uint v_15 = ((v_12.z) ? (uvec4(0u).z) : (uvec4(8u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(0u).w) : (uvec4(8u).w)));
- bvec4 v_17 = equal((((v_6 >> v_11) >> v_16) & uvec4(240u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(0u).x) : (uvec4(4u).x));
- uint v_19 = ((v_17.y) ? (uvec4(0u).y) : (uvec4(4u).y));
- uint v_20 = ((v_17.z) ? (uvec4(0u).z) : (uvec4(4u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(0u).w) : (uvec4(4u).w)));
- bvec4 v_22 = equal(((((v_6 >> v_11) >> v_16) >> v_21) & uvec4(12u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(0u).x) : (uvec4(2u).x));
- uint v_24 = ((v_22.y) ? (uvec4(0u).y) : (uvec4(2u).y));
- uint v_25 = ((v_22.z) ? (uvec4(0u).z) : (uvec4(2u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(0u).w) : (uvec4(2u).w)));
- bvec4 v_27 = equal((((((v_6 >> v_11) >> v_16) >> v_21) >> v_26) & uvec4(2u)), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(0u).x) : (uvec4(1u).x));
- uint v_29 = ((v_27.y) ? (uvec4(0u).y) : (uvec4(1u).y));
- uint v_30 = ((v_27.z) ? (uvec4(0u).z) : (uvec4(1u).z));
- uvec4 v_31 = (v_11 | (v_16 | (v_21 | (v_26 | uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(0u).w) : (uvec4(1u).w)))))));
- bvec4 v_32 = equal(((((v_6 >> v_11) >> v_16) >> v_21) >> v_26), uvec4(0u));
- uint v_33 = ((v_32.x) ? (uvec4(4294967295u).x) : (v_31.x));
- uint v_34 = ((v_32.y) ? (uvec4(4294967295u).y) : (v_31.y));
- uint v_35 = ((v_32.z) ? (uvec4(4294967295u).z) : (v_31.z));
- ivec4 res = ivec4(uvec4(v_33, v_34, v_35, ((v_32.w) ? (uvec4(4294967295u).w) : (v_31.w))));
+ uvec4 v_2 = mix(~(v_1), v_1, lessThan(v_1, uvec4(2147483648u)));
+ uvec4 v_3 = mix(uvec4(16u), uvec4(0u), equal((v_2 & uvec4(4294901760u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(8u), uvec4(0u), equal(((v_2 >> v_3) & uvec4(65280u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(4u), uvec4(0u), equal((((v_2 >> v_3) >> v_4) & uvec4(240u)), uvec4(0u)));
+ uvec4 v_6 = mix(uvec4(2u), uvec4(0u), equal(((((v_2 >> v_3) >> v_4) >> v_5) & uvec4(12u)), uvec4(0u)));
+ uvec4 v_7 = (v_3 | (v_4 | (v_5 | (v_6 | mix(uvec4(1u), uvec4(0u), equal((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & uvec4(2u)), uvec4(0u)))))));
+ ivec4 res = ivec4(mix(v_7, uvec4(4294967295u), equal(((((v_2 >> v_3) >> v_4) >> v_5) >> v_6), uvec4(0u))));
return res;
}
void main() {
@@ -58,41 +30,13 @@
ivec4 firstLeadingBit_c1f940() {
ivec4 arg_0 = ivec4(1);
uvec4 v_1 = uvec4(arg_0);
- bvec4 v_2 = lessThan(v_1, uvec4(2147483648u));
- uint v_3 = ((v_2.x) ? (v_1.x) : (~(v_1).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (~(v_1).y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (~(v_1).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (~(v_1).w)));
- bvec4 v_7 = equal((v_6 & uvec4(4294901760u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(0u).x) : (uvec4(16u).x));
- uint v_9 = ((v_7.y) ? (uvec4(0u).y) : (uvec4(16u).y));
- uint v_10 = ((v_7.z) ? (uvec4(0u).z) : (uvec4(16u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(0u).w) : (uvec4(16u).w)));
- bvec4 v_12 = equal(((v_6 >> v_11) & uvec4(65280u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(0u).x) : (uvec4(8u).x));
- uint v_14 = ((v_12.y) ? (uvec4(0u).y) : (uvec4(8u).y));
- uint v_15 = ((v_12.z) ? (uvec4(0u).z) : (uvec4(8u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(0u).w) : (uvec4(8u).w)));
- bvec4 v_17 = equal((((v_6 >> v_11) >> v_16) & uvec4(240u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(0u).x) : (uvec4(4u).x));
- uint v_19 = ((v_17.y) ? (uvec4(0u).y) : (uvec4(4u).y));
- uint v_20 = ((v_17.z) ? (uvec4(0u).z) : (uvec4(4u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(0u).w) : (uvec4(4u).w)));
- bvec4 v_22 = equal(((((v_6 >> v_11) >> v_16) >> v_21) & uvec4(12u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(0u).x) : (uvec4(2u).x));
- uint v_24 = ((v_22.y) ? (uvec4(0u).y) : (uvec4(2u).y));
- uint v_25 = ((v_22.z) ? (uvec4(0u).z) : (uvec4(2u).z));
- uvec4 v_26 = uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(0u).w) : (uvec4(2u).w)));
- bvec4 v_27 = equal((((((v_6 >> v_11) >> v_16) >> v_21) >> v_26) & uvec4(2u)), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(0u).x) : (uvec4(1u).x));
- uint v_29 = ((v_27.y) ? (uvec4(0u).y) : (uvec4(1u).y));
- uint v_30 = ((v_27.z) ? (uvec4(0u).z) : (uvec4(1u).z));
- uvec4 v_31 = (v_11 | (v_16 | (v_21 | (v_26 | uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(0u).w) : (uvec4(1u).w)))))));
- bvec4 v_32 = equal(((((v_6 >> v_11) >> v_16) >> v_21) >> v_26), uvec4(0u));
- uint v_33 = ((v_32.x) ? (uvec4(4294967295u).x) : (v_31.x));
- uint v_34 = ((v_32.y) ? (uvec4(4294967295u).y) : (v_31.y));
- uint v_35 = ((v_32.z) ? (uvec4(4294967295u).z) : (v_31.z));
- ivec4 res = ivec4(uvec4(v_33, v_34, v_35, ((v_32.w) ? (uvec4(4294967295u).w) : (v_31.w))));
+ uvec4 v_2 = mix(~(v_1), v_1, lessThan(v_1, uvec4(2147483648u)));
+ uvec4 v_3 = mix(uvec4(16u), uvec4(0u), equal((v_2 & uvec4(4294901760u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(8u), uvec4(0u), equal(((v_2 >> v_3) & uvec4(65280u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(4u), uvec4(0u), equal((((v_2 >> v_3) >> v_4) & uvec4(240u)), uvec4(0u)));
+ uvec4 v_6 = mix(uvec4(2u), uvec4(0u), equal(((((v_2 >> v_3) >> v_4) >> v_5) & uvec4(12u)), uvec4(0u)));
+ uvec4 v_7 = (v_3 | (v_4 | (v_5 | (v_6 | mix(uvec4(1u), uvec4(0u), equal((((((v_2 >> v_3) >> v_4) >> v_5) >> v_6) & uvec4(2u)), uvec4(0u)))))));
+ ivec4 res = ivec4(mix(v_7, uvec4(4294967295u), equal(((((v_2 >> v_3) >> v_4) >> v_5) >> v_6), uvec4(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -111,41 +55,13 @@
ivec4 firstLeadingBit_c1f940() {
ivec4 arg_0 = ivec4(1);
uvec4 v = uvec4(arg_0);
- bvec4 v_1 = lessThan(v, uvec4(2147483648u));
- uint v_2 = ((v_1.x) ? (v.x) : (~(v).x));
- uint v_3 = ((v_1.y) ? (v.y) : (~(v).y));
- uint v_4 = ((v_1.z) ? (v.z) : (~(v).z));
- uvec4 v_5 = uvec4(v_2, v_3, v_4, ((v_1.w) ? (v.w) : (~(v).w)));
- bvec4 v_6 = equal((v_5 & uvec4(4294901760u)), uvec4(0u));
- uint v_7 = ((v_6.x) ? (uvec4(0u).x) : (uvec4(16u).x));
- uint v_8 = ((v_6.y) ? (uvec4(0u).y) : (uvec4(16u).y));
- uint v_9 = ((v_6.z) ? (uvec4(0u).z) : (uvec4(16u).z));
- uvec4 v_10 = uvec4(v_7, v_8, v_9, ((v_6.w) ? (uvec4(0u).w) : (uvec4(16u).w)));
- bvec4 v_11 = equal(((v_5 >> v_10) & uvec4(65280u)), uvec4(0u));
- uint v_12 = ((v_11.x) ? (uvec4(0u).x) : (uvec4(8u).x));
- uint v_13 = ((v_11.y) ? (uvec4(0u).y) : (uvec4(8u).y));
- uint v_14 = ((v_11.z) ? (uvec4(0u).z) : (uvec4(8u).z));
- uvec4 v_15 = uvec4(v_12, v_13, v_14, ((v_11.w) ? (uvec4(0u).w) : (uvec4(8u).w)));
- bvec4 v_16 = equal((((v_5 >> v_10) >> v_15) & uvec4(240u)), uvec4(0u));
- uint v_17 = ((v_16.x) ? (uvec4(0u).x) : (uvec4(4u).x));
- uint v_18 = ((v_16.y) ? (uvec4(0u).y) : (uvec4(4u).y));
- uint v_19 = ((v_16.z) ? (uvec4(0u).z) : (uvec4(4u).z));
- uvec4 v_20 = uvec4(v_17, v_18, v_19, ((v_16.w) ? (uvec4(0u).w) : (uvec4(4u).w)));
- bvec4 v_21 = equal(((((v_5 >> v_10) >> v_15) >> v_20) & uvec4(12u)), uvec4(0u));
- uint v_22 = ((v_21.x) ? (uvec4(0u).x) : (uvec4(2u).x));
- uint v_23 = ((v_21.y) ? (uvec4(0u).y) : (uvec4(2u).y));
- uint v_24 = ((v_21.z) ? (uvec4(0u).z) : (uvec4(2u).z));
- uvec4 v_25 = uvec4(v_22, v_23, v_24, ((v_21.w) ? (uvec4(0u).w) : (uvec4(2u).w)));
- bvec4 v_26 = equal((((((v_5 >> v_10) >> v_15) >> v_20) >> v_25) & uvec4(2u)), uvec4(0u));
- uint v_27 = ((v_26.x) ? (uvec4(0u).x) : (uvec4(1u).x));
- uint v_28 = ((v_26.y) ? (uvec4(0u).y) : (uvec4(1u).y));
- uint v_29 = ((v_26.z) ? (uvec4(0u).z) : (uvec4(1u).z));
- uvec4 v_30 = (v_10 | (v_15 | (v_20 | (v_25 | uvec4(v_27, v_28, v_29, ((v_26.w) ? (uvec4(0u).w) : (uvec4(1u).w)))))));
- bvec4 v_31 = equal(((((v_5 >> v_10) >> v_15) >> v_20) >> v_25), uvec4(0u));
- uint v_32 = ((v_31.x) ? (uvec4(4294967295u).x) : (v_30.x));
- uint v_33 = ((v_31.y) ? (uvec4(4294967295u).y) : (v_30.y));
- uint v_34 = ((v_31.z) ? (uvec4(4294967295u).z) : (v_30.z));
- ivec4 res = ivec4(uvec4(v_32, v_33, v_34, ((v_31.w) ? (uvec4(4294967295u).w) : (v_30.w))));
+ uvec4 v_1 = mix(~(v), v, lessThan(v, uvec4(2147483648u)));
+ uvec4 v_2 = mix(uvec4(16u), uvec4(0u), equal((v_1 & uvec4(4294901760u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(8u), uvec4(0u), equal(((v_1 >> v_2) & uvec4(65280u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(4u), uvec4(0u), equal((((v_1 >> v_2) >> v_3) & uvec4(240u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(2u), uvec4(0u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(12u)), uvec4(0u)));
+ uvec4 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec4(1u), uvec4(0u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(2u)), uvec4(0u)))))));
+ ivec4 res = ivec4(mix(v_6, uvec4(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -155,10 +71,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_35 = vertex_main_inner();
- gl_Position = v_35.pos;
+ VertexOutput v_7 = vertex_main_inner();
+ gl_Position = v_7.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_35.prevent_dce;
+ vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl
index ec28f67..e639743 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl
@@ -4,16 +4,16 @@
uint tint_first_leading_bit(uint v) {
uint x = v;
- uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, bool((x & 4294901760u)));
x = (x >> b16);
- uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, bool((x & 65280u)));
x = (x >> b8);
- uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, bool((x & 240u)));
x = (x >> b4);
- uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, bool((x & 12u)));
x = (x >> b2);
- uint b1 = (bool((x & 2u)) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(0u, 1u, bool((x & 2u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -44,16 +44,16 @@
uint tint_first_leading_bit(uint v) {
uint x = v;
- uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, bool((x & 4294901760u)));
x = (x >> b16);
- uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, bool((x & 65280u)));
x = (x >> b8);
- uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, bool((x & 240u)));
x = (x >> b4);
- uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, bool((x & 12u)));
x = (x >> b2);
- uint b1 = (bool((x & 2u)) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(0u, 1u, bool((x & 2u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -85,16 +85,16 @@
uint tint_first_leading_bit(uint v) {
uint x = v;
- uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ uint b16 = mix(0u, 16u, bool((x & 4294901760u)));
x = (x >> b16);
- uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ uint b8 = mix(0u, 8u, bool((x & 65280u)));
x = (x >> b8);
- uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ uint b4 = mix(0u, 4u, bool((x & 240u)));
x = (x >> b4);
- uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ uint b2 = mix(0u, 2u, bool((x & 12u)));
x = (x >> b2);
- uint b1 = (bool((x & 2u)) ? 1u : 0u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(0u, 1u, bool((x & 2u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.ir.glsl
index 00648d7..ff68b21 100644
--- a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.ir.glsl
@@ -9,11 +9,11 @@
uint firstLeadingBit_f0779d() {
uint arg_0 = 1u;
uint v_1 = arg_0;
- uint v_2 = ((((v_1 & 4294901760u) == 0u)) ? (0u) : (16u));
- uint v_3 = (((((v_1 >> v_2) & 65280u) == 0u)) ? (0u) : (8u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 240u) == 0u)) ? (0u) : (4u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 12u) == 0u)) ? (0u) : (2u));
- uint res = (((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (4294967295u) : ((v_2 | (v_3 | (v_4 | (v_5 | ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 2u) == 0u)) ? (0u) : (1u))))))));
+ uint v_2 = mix(16u, 0u, ((v_1 & 4294901760u) == 0u));
+ uint v_3 = mix(8u, 0u, (((v_1 >> v_2) & 65280u) == 0u));
+ uint v_4 = mix(4u, 0u, ((((v_1 >> v_2) >> v_3) & 240u) == 0u));
+ uint v_5 = mix(2u, 0u, (((((v_1 >> v_2) >> v_3) >> v_4) & 12u) == 0u));
+ uint res = mix((v_2 | (v_3 | (v_4 | (v_5 | mix(1u, 0u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 2u) == 0u)))))), 4294967295u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u));
return res;
}
void main() {
@@ -28,11 +28,11 @@
uint firstLeadingBit_f0779d() {
uint arg_0 = 1u;
uint v_1 = arg_0;
- uint v_2 = ((((v_1 & 4294901760u) == 0u)) ? (0u) : (16u));
- uint v_3 = (((((v_1 >> v_2) & 65280u) == 0u)) ? (0u) : (8u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 240u) == 0u)) ? (0u) : (4u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 12u) == 0u)) ? (0u) : (2u));
- uint res = (((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (4294967295u) : ((v_2 | (v_3 | (v_4 | (v_5 | ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 2u) == 0u)) ? (0u) : (1u))))))));
+ uint v_2 = mix(16u, 0u, ((v_1 & 4294901760u) == 0u));
+ uint v_3 = mix(8u, 0u, (((v_1 >> v_2) & 65280u) == 0u));
+ uint v_4 = mix(4u, 0u, ((((v_1 >> v_2) >> v_3) & 240u) == 0u));
+ uint v_5 = mix(2u, 0u, (((((v_1 >> v_2) >> v_3) >> v_4) & 12u) == 0u));
+ uint res = mix((v_2 | (v_3 | (v_4 | (v_5 | mix(1u, 0u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 2u) == 0u)))))), 4294967295u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -51,11 +51,11 @@
uint firstLeadingBit_f0779d() {
uint arg_0 = 1u;
uint v = arg_0;
- uint v_1 = ((((v & 4294901760u) == 0u)) ? (0u) : (16u));
- uint v_2 = (((((v >> v_1) & 65280u) == 0u)) ? (0u) : (8u));
- uint v_3 = ((((((v >> v_1) >> v_2) & 240u) == 0u)) ? (0u) : (4u));
- uint v_4 = (((((((v >> v_1) >> v_2) >> v_3) & 12u) == 0u)) ? (0u) : (2u));
- uint res = (((((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u)) ? (4294967295u) : ((v_1 | (v_2 | (v_3 | (v_4 | ((((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 2u) == 0u)) ? (0u) : (1u))))))));
+ uint v_1 = mix(16u, 0u, ((v & 4294901760u) == 0u));
+ uint v_2 = mix(8u, 0u, (((v >> v_1) & 65280u) == 0u));
+ uint v_3 = mix(4u, 0u, ((((v >> v_1) >> v_2) & 240u) == 0u));
+ uint v_4 = mix(2u, 0u, (((((v >> v_1) >> v_2) >> v_3) & 12u) == 0u));
+ uint res = mix((v_1 | (v_2 | (v_3 | (v_4 | mix(1u, 0u, ((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 2u) == 0u)))))), 4294967295u, (((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u));
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl
index 0633252..015b4b6 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_first_trailing_bit(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_first_trailing_bit(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
uvec4 tint_first_trailing_bit(uvec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.ir.glsl
index e149c71..85362b3 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.ir.glsl
@@ -9,36 +9,12 @@
uvec4 firstTrailingBit_110f2c() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
- bvec4 v_2 = equal((v_1 & uvec4(65535u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(255u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(15u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(3u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(1u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = (v_6 | (v_11 | (v_16 | (v_21 | uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)))))));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(4294967295u).x) : (v_26.x));
- uint v_29 = ((v_27.y) ? (uvec4(4294967295u).y) : (v_26.y));
- uint v_30 = ((v_27.z) ? (uvec4(4294967295u).z) : (v_26.z));
- uvec4 res = uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(4294967295u).w) : (v_26.w)));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), equal((v_1 & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), equal(((v_1 >> v_2) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), equal((((v_1 >> v_2) >> v_3) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec4(0u), uvec4(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(1u)), uvec4(0u)))))));
+ uvec4 res = mix(v_6, uvec4(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u)));
return res;
}
void main() {
@@ -53,36 +29,12 @@
uvec4 firstTrailingBit_110f2c() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
- bvec4 v_2 = equal((v_1 & uvec4(65535u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(255u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(15u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(3u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(1u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = (v_6 | (v_11 | (v_16 | (v_21 | uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)))))));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(4294967295u).x) : (v_26.x));
- uint v_29 = ((v_27.y) ? (uvec4(4294967295u).y) : (v_26.y));
- uint v_30 = ((v_27.z) ? (uvec4(4294967295u).z) : (v_26.z));
- uvec4 res = uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(4294967295u).w) : (v_26.w)));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), equal((v_1 & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), equal(((v_1 >> v_2) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), equal((((v_1 >> v_2) >> v_3) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec4(0u), uvec4(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(1u)), uvec4(0u)))))));
+ uvec4 res = mix(v_6, uvec4(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -101,36 +53,12 @@
uvec4 firstTrailingBit_110f2c() {
uvec4 arg_0 = uvec4(1u);
uvec4 v = arg_0;
- bvec4 v_1 = equal((v & uvec4(65535u)), uvec4(0u));
- uint v_2 = ((v_1.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_3 = ((v_1.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_4 = ((v_1.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_5 = uvec4(v_2, v_3, v_4, ((v_1.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_6 = equal(((v >> v_5) & uvec4(255u)), uvec4(0u));
- uint v_7 = ((v_6.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_8 = ((v_6.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_9 = ((v_6.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_10 = uvec4(v_7, v_8, v_9, ((v_6.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_11 = equal((((v >> v_5) >> v_10) & uvec4(15u)), uvec4(0u));
- uint v_12 = ((v_11.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_13 = ((v_11.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_14 = ((v_11.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_15 = uvec4(v_12, v_13, v_14, ((v_11.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_16 = equal(((((v >> v_5) >> v_10) >> v_15) & uvec4(3u)), uvec4(0u));
- uint v_17 = ((v_16.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_18 = ((v_16.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_19 = ((v_16.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_20 = uvec4(v_17, v_18, v_19, ((v_16.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_21 = equal((((((v >> v_5) >> v_10) >> v_15) >> v_20) & uvec4(1u)), uvec4(0u));
- uint v_22 = ((v_21.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_23 = ((v_21.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_24 = ((v_21.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_25 = (v_5 | (v_10 | (v_15 | (v_20 | uvec4(v_22, v_23, v_24, ((v_21.w) ? (uvec4(1u).w) : (uvec4(0u).w)))))));
- bvec4 v_26 = equal(((((v >> v_5) >> v_10) >> v_15) >> v_20), uvec4(0u));
- uint v_27 = ((v_26.x) ? (uvec4(4294967295u).x) : (v_25.x));
- uint v_28 = ((v_26.y) ? (uvec4(4294967295u).y) : (v_25.y));
- uint v_29 = ((v_26.z) ? (uvec4(4294967295u).z) : (v_25.z));
- uvec4 res = uvec4(v_27, v_28, v_29, ((v_26.w) ? (uvec4(4294967295u).w) : (v_25.w)));
+ uvec4 v_1 = mix(uvec4(0u), uvec4(16u), equal((v & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(8u), equal(((v >> v_1) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(4u), equal((((v >> v_1) >> v_2) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec4(0u), uvec4(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec4(1u)), uvec4(0u)))))));
+ uvec4 res = mix(v_5, uvec4(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec4(0u)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -140,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_30 = vertex_main_inner();
- gl_Position = v_30.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_30.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl
index ad1f80f..2e1c0ca 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl
@@ -4,16 +4,16 @@
int tint_first_trailing_bit(int v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -44,16 +44,16 @@
int tint_first_trailing_bit(int v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -85,16 +85,16 @@
int tint_first_trailing_bit(int v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.ir.glsl
index 231d07f..e08eadb 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.ir.glsl
@@ -9,11 +9,11 @@
int firstTrailingBit_3a2acc() {
int arg_0 = 1;
uint v_1 = uint(arg_0);
- uint v_2 = ((((v_1 & 65535u) == 0u)) ? (16u) : (0u));
- uint v_3 = (((((v_1 >> v_2) & 255u) == 0u)) ? (8u) : (0u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 15u) == 0u)) ? (4u) : (0u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u)) ? (2u) : (0u));
- int res = int((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (4294967295u) : ((v_2 | (v_3 | (v_4 | (v_5 | ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)) ? (1u) : (0u)))))))));
+ uint v_2 = mix(0u, 16u, ((v_1 & 65535u) == 0u));
+ uint v_3 = mix(0u, 8u, (((v_1 >> v_2) & 255u) == 0u));
+ uint v_4 = mix(0u, 4u, ((((v_1 >> v_2) >> v_3) & 15u) == 0u));
+ uint v_5 = mix(0u, 2u, (((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u));
+ int res = int(mix((v_2 | (v_3 | (v_4 | (v_5 | mix(0u, 1u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)))))), 4294967295u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)));
return res;
}
void main() {
@@ -28,11 +28,11 @@
int firstTrailingBit_3a2acc() {
int arg_0 = 1;
uint v_1 = uint(arg_0);
- uint v_2 = ((((v_1 & 65535u) == 0u)) ? (16u) : (0u));
- uint v_3 = (((((v_1 >> v_2) & 255u) == 0u)) ? (8u) : (0u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 15u) == 0u)) ? (4u) : (0u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u)) ? (2u) : (0u));
- int res = int((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (4294967295u) : ((v_2 | (v_3 | (v_4 | (v_5 | ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)) ? (1u) : (0u)))))))));
+ uint v_2 = mix(0u, 16u, ((v_1 & 65535u) == 0u));
+ uint v_3 = mix(0u, 8u, (((v_1 >> v_2) & 255u) == 0u));
+ uint v_4 = mix(0u, 4u, ((((v_1 >> v_2) >> v_3) & 15u) == 0u));
+ uint v_5 = mix(0u, 2u, (((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u));
+ int res = int(mix((v_2 | (v_3 | (v_4 | (v_5 | mix(0u, 1u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)))))), 4294967295u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -51,11 +51,11 @@
int firstTrailingBit_3a2acc() {
int arg_0 = 1;
uint v = uint(arg_0);
- uint v_1 = ((((v & 65535u) == 0u)) ? (16u) : (0u));
- uint v_2 = (((((v >> v_1) & 255u) == 0u)) ? (8u) : (0u));
- uint v_3 = ((((((v >> v_1) >> v_2) & 15u) == 0u)) ? (4u) : (0u));
- uint v_4 = (((((((v >> v_1) >> v_2) >> v_3) & 3u) == 0u)) ? (2u) : (0u));
- int res = int((((((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u)) ? (4294967295u) : ((v_1 | (v_2 | (v_3 | (v_4 | ((((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 1u) == 0u)) ? (1u) : (0u)))))))));
+ uint v_1 = mix(0u, 16u, ((v & 65535u) == 0u));
+ uint v_2 = mix(0u, 8u, (((v >> v_1) & 255u) == 0u));
+ uint v_3 = mix(0u, 4u, ((((v >> v_1) >> v_2) & 15u) == 0u));
+ uint v_4 = mix(0u, 2u, (((((v >> v_1) >> v_2) >> v_3) & 3u) == 0u));
+ int res = int(mix((v_1 | (v_2 | (v_3 | (v_4 | mix(0u, 1u, ((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 1u) == 0u)))))), 4294967295u, (((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u)));
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl
index 032ae87..a730247 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_first_trailing_bit(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_first_trailing_bit(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
uvec2 tint_first_trailing_bit(uvec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.ir.glsl
index f2cd89d..4adf174 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.ir.glsl
@@ -9,24 +9,12 @@
uvec2 firstTrailingBit_45eb10() {
uvec2 arg_0 = uvec2(1u);
uvec2 v_1 = arg_0;
- bvec2 v_2 = equal((v_1 & uvec2(65535u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(255u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(15u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(3u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(1u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = (v_4 | (v_7 | (v_10 | (v_13 | uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)))))));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(4294967295u).x) : (v_16.x));
- uvec2 res = uvec2(v_18, ((v_17.y) ? (uvec2(4294967295u).y) : (v_16.y)));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), equal((v_1 & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), equal(((v_1 >> v_2) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), equal((((v_1 >> v_2) >> v_3) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec2(0u), uvec2(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(1u)), uvec2(0u)))))));
+ uvec2 res = mix(v_6, uvec2(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u)));
return res;
}
void main() {
@@ -41,24 +29,12 @@
uvec2 firstTrailingBit_45eb10() {
uvec2 arg_0 = uvec2(1u);
uvec2 v_1 = arg_0;
- bvec2 v_2 = equal((v_1 & uvec2(65535u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(255u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(15u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(3u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(1u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = (v_4 | (v_7 | (v_10 | (v_13 | uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)))))));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(4294967295u).x) : (v_16.x));
- uvec2 res = uvec2(v_18, ((v_17.y) ? (uvec2(4294967295u).y) : (v_16.y)));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), equal((v_1 & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), equal(((v_1 >> v_2) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), equal((((v_1 >> v_2) >> v_3) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec2(0u), uvec2(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(1u)), uvec2(0u)))))));
+ uvec2 res = mix(v_6, uvec2(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -77,24 +53,12 @@
uvec2 firstTrailingBit_45eb10() {
uvec2 arg_0 = uvec2(1u);
uvec2 v = arg_0;
- bvec2 v_1 = equal((v & uvec2(65535u)), uvec2(0u));
- uint v_2 = ((v_1.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_3 = uvec2(v_2, ((v_1.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_4 = equal(((v >> v_3) & uvec2(255u)), uvec2(0u));
- uint v_5 = ((v_4.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_6 = uvec2(v_5, ((v_4.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_7 = equal((((v >> v_3) >> v_6) & uvec2(15u)), uvec2(0u));
- uint v_8 = ((v_7.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_9 = uvec2(v_8, ((v_7.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_10 = equal(((((v >> v_3) >> v_6) >> v_9) & uvec2(3u)), uvec2(0u));
- uint v_11 = ((v_10.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_12 = uvec2(v_11, ((v_10.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_13 = equal((((((v >> v_3) >> v_6) >> v_9) >> v_12) & uvec2(1u)), uvec2(0u));
- uint v_14 = ((v_13.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_15 = (v_3 | (v_6 | (v_9 | (v_12 | uvec2(v_14, ((v_13.y) ? (uvec2(1u).y) : (uvec2(0u).y)))))));
- bvec2 v_16 = equal(((((v >> v_3) >> v_6) >> v_9) >> v_12), uvec2(0u));
- uint v_17 = ((v_16.x) ? (uvec2(4294967295u).x) : (v_15.x));
- uvec2 res = uvec2(v_17, ((v_16.y) ? (uvec2(4294967295u).y) : (v_15.y)));
+ uvec2 v_1 = mix(uvec2(0u), uvec2(16u), equal((v & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(8u), equal(((v >> v_1) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(4u), equal((((v >> v_1) >> v_2) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec2(0u), uvec2(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec2(1u)), uvec2(0u)))))));
+ uvec2 res = mix(v_5, uvec2(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec2(0u)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -104,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_18 = vertex_main_inner();
- gl_Position = v_18.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_18.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl
index 5a51cc3..8741e4a 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl
@@ -4,16 +4,16 @@
uint tint_first_trailing_bit(uint v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -44,16 +44,16 @@
uint tint_first_trailing_bit(uint v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -85,16 +85,16 @@
uint tint_first_trailing_bit(uint v) {
uint x = uint(v);
- uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ uint b16 = mix(16u, 0u, bool((x & 65535u)));
x = (x >> b16);
- uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ uint b8 = mix(8u, 0u, bool((x & 255u)));
x = (x >> b8);
- uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ uint b4 = mix(4u, 0u, bool((x & 15u)));
x = (x >> b4);
- uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ uint b2 = mix(2u, 0u, bool((x & 3u)));
x = (x >> b2);
- uint b1 = (bool((x & 1u)) ? 0u : 1u);
- uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ uint b1 = mix(1u, 0u, bool((x & 1u)));
+ uint is_zero = mix(0u, 4294967295u, (x == 0u));
return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.ir.glsl
index a6e9582..4b4645e 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.ir.glsl
@@ -9,11 +9,11 @@
uint firstTrailingBit_47d475() {
uint arg_0 = 1u;
uint v_1 = arg_0;
- uint v_2 = ((((v_1 & 65535u) == 0u)) ? (16u) : (0u));
- uint v_3 = (((((v_1 >> v_2) & 255u) == 0u)) ? (8u) : (0u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 15u) == 0u)) ? (4u) : (0u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u)) ? (2u) : (0u));
- uint res = (((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (4294967295u) : ((v_2 | (v_3 | (v_4 | (v_5 | ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)) ? (1u) : (0u))))))));
+ uint v_2 = mix(0u, 16u, ((v_1 & 65535u) == 0u));
+ uint v_3 = mix(0u, 8u, (((v_1 >> v_2) & 255u) == 0u));
+ uint v_4 = mix(0u, 4u, ((((v_1 >> v_2) >> v_3) & 15u) == 0u));
+ uint v_5 = mix(0u, 2u, (((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u));
+ uint res = mix((v_2 | (v_3 | (v_4 | (v_5 | mix(0u, 1u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)))))), 4294967295u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u));
return res;
}
void main() {
@@ -28,11 +28,11 @@
uint firstTrailingBit_47d475() {
uint arg_0 = 1u;
uint v_1 = arg_0;
- uint v_2 = ((((v_1 & 65535u) == 0u)) ? (16u) : (0u));
- uint v_3 = (((((v_1 >> v_2) & 255u) == 0u)) ? (8u) : (0u));
- uint v_4 = ((((((v_1 >> v_2) >> v_3) & 15u) == 0u)) ? (4u) : (0u));
- uint v_5 = (((((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u)) ? (2u) : (0u));
- uint res = (((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u)) ? (4294967295u) : ((v_2 | (v_3 | (v_4 | (v_5 | ((((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)) ? (1u) : (0u))))))));
+ uint v_2 = mix(0u, 16u, ((v_1 & 65535u) == 0u));
+ uint v_3 = mix(0u, 8u, (((v_1 >> v_2) & 255u) == 0u));
+ uint v_4 = mix(0u, 4u, ((((v_1 >> v_2) >> v_3) & 15u) == 0u));
+ uint v_5 = mix(0u, 2u, (((((v_1 >> v_2) >> v_3) >> v_4) & 3u) == 0u));
+ uint res = mix((v_2 | (v_3 | (v_4 | (v_5 | mix(0u, 1u, ((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & 1u) == 0u)))))), 4294967295u, (((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) == 0u));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -51,11 +51,11 @@
uint firstTrailingBit_47d475() {
uint arg_0 = 1u;
uint v = arg_0;
- uint v_1 = ((((v & 65535u) == 0u)) ? (16u) : (0u));
- uint v_2 = (((((v >> v_1) & 255u) == 0u)) ? (8u) : (0u));
- uint v_3 = ((((((v >> v_1) >> v_2) & 15u) == 0u)) ? (4u) : (0u));
- uint v_4 = (((((((v >> v_1) >> v_2) >> v_3) & 3u) == 0u)) ? (2u) : (0u));
- uint res = (((((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u)) ? (4294967295u) : ((v_1 | (v_2 | (v_3 | (v_4 | ((((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 1u) == 0u)) ? (1u) : (0u))))))));
+ uint v_1 = mix(0u, 16u, ((v & 65535u) == 0u));
+ uint v_2 = mix(0u, 8u, (((v >> v_1) & 255u) == 0u));
+ uint v_3 = mix(0u, 4u, ((((v >> v_1) >> v_2) & 15u) == 0u));
+ uint v_4 = mix(0u, 2u, (((((v >> v_1) >> v_2) >> v_3) & 3u) == 0u));
+ uint res = mix((v_1 | (v_2 | (v_3 | (v_4 | mix(0u, 1u, ((((((v >> v_1) >> v_2) >> v_3) >> v_4) & 1u) == 0u)))))), 4294967295u, (((((v >> v_1) >> v_2) >> v_3) >> v_4) == 0u));
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl
index 620bb9c..3a35836 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_first_trailing_bit(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_first_trailing_bit(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
ivec2 tint_first_trailing_bit(ivec2 v) {
uvec2 x = uvec2(v);
- uvec2 b16 = tint_select(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
x = (x >> b16);
- uvec2 b8 = tint_select(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
x = (x >> b8);
- uvec2 b4 = tint_select(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
x = (x >> b4);
- uvec2 b2 = tint_select(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
x = (x >> b2);
- uvec2 b1 = tint_select(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
- uvec2 is_zero = tint_select(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.ir.glsl
index 391f426..22c6a4f 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.ir.glsl
@@ -9,24 +9,12 @@
ivec2 firstTrailingBit_50c072() {
ivec2 arg_0 = ivec2(1);
uvec2 v_1 = uvec2(arg_0);
- bvec2 v_2 = equal((v_1 & uvec2(65535u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(255u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(15u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(3u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(1u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = (v_4 | (v_7 | (v_10 | (v_13 | uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)))))));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(4294967295u).x) : (v_16.x));
- ivec2 res = ivec2(uvec2(v_18, ((v_17.y) ? (uvec2(4294967295u).y) : (v_16.y))));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), equal((v_1 & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), equal(((v_1 >> v_2) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), equal((((v_1 >> v_2) >> v_3) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec2(0u), uvec2(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(1u)), uvec2(0u)))))));
+ ivec2 res = ivec2(mix(v_6, uvec2(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u))));
return res;
}
void main() {
@@ -41,24 +29,12 @@
ivec2 firstTrailingBit_50c072() {
ivec2 arg_0 = ivec2(1);
uvec2 v_1 = uvec2(arg_0);
- bvec2 v_2 = equal((v_1 & uvec2(65535u)), uvec2(0u));
- uint v_3 = ((v_2.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_5 = equal(((v_1 >> v_4) & uvec2(255u)), uvec2(0u));
- uint v_6 = ((v_5.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_7 = uvec2(v_6, ((v_5.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_8 = equal((((v_1 >> v_4) >> v_7) & uvec2(15u)), uvec2(0u));
- uint v_9 = ((v_8.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_10 = uvec2(v_9, ((v_8.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_11 = equal(((((v_1 >> v_4) >> v_7) >> v_10) & uvec2(3u)), uvec2(0u));
- uint v_12 = ((v_11.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_13 = uvec2(v_12, ((v_11.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_14 = equal((((((v_1 >> v_4) >> v_7) >> v_10) >> v_13) & uvec2(1u)), uvec2(0u));
- uint v_15 = ((v_14.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_16 = (v_4 | (v_7 | (v_10 | (v_13 | uvec2(v_15, ((v_14.y) ? (uvec2(1u).y) : (uvec2(0u).y)))))));
- bvec2 v_17 = equal(((((v_1 >> v_4) >> v_7) >> v_10) >> v_13), uvec2(0u));
- uint v_18 = ((v_17.x) ? (uvec2(4294967295u).x) : (v_16.x));
- ivec2 res = ivec2(uvec2(v_18, ((v_17.y) ? (uvec2(4294967295u).y) : (v_16.y))));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(16u), equal((v_1 & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(8u), equal(((v_1 >> v_2) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(4u), equal((((v_1 >> v_2) >> v_3) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_5 = mix(uvec2(0u), uvec2(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec2(0u), uvec2(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec2(1u)), uvec2(0u)))))));
+ ivec2 res = ivec2(mix(v_6, uvec2(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec2(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -77,24 +53,12 @@
ivec2 firstTrailingBit_50c072() {
ivec2 arg_0 = ivec2(1);
uvec2 v = uvec2(arg_0);
- bvec2 v_1 = equal((v & uvec2(65535u)), uvec2(0u));
- uint v_2 = ((v_1.x) ? (uvec2(16u).x) : (uvec2(0u).x));
- uvec2 v_3 = uvec2(v_2, ((v_1.y) ? (uvec2(16u).y) : (uvec2(0u).y)));
- bvec2 v_4 = equal(((v >> v_3) & uvec2(255u)), uvec2(0u));
- uint v_5 = ((v_4.x) ? (uvec2(8u).x) : (uvec2(0u).x));
- uvec2 v_6 = uvec2(v_5, ((v_4.y) ? (uvec2(8u).y) : (uvec2(0u).y)));
- bvec2 v_7 = equal((((v >> v_3) >> v_6) & uvec2(15u)), uvec2(0u));
- uint v_8 = ((v_7.x) ? (uvec2(4u).x) : (uvec2(0u).x));
- uvec2 v_9 = uvec2(v_8, ((v_7.y) ? (uvec2(4u).y) : (uvec2(0u).y)));
- bvec2 v_10 = equal(((((v >> v_3) >> v_6) >> v_9) & uvec2(3u)), uvec2(0u));
- uint v_11 = ((v_10.x) ? (uvec2(2u).x) : (uvec2(0u).x));
- uvec2 v_12 = uvec2(v_11, ((v_10.y) ? (uvec2(2u).y) : (uvec2(0u).y)));
- bvec2 v_13 = equal((((((v >> v_3) >> v_6) >> v_9) >> v_12) & uvec2(1u)), uvec2(0u));
- uint v_14 = ((v_13.x) ? (uvec2(1u).x) : (uvec2(0u).x));
- uvec2 v_15 = (v_3 | (v_6 | (v_9 | (v_12 | uvec2(v_14, ((v_13.y) ? (uvec2(1u).y) : (uvec2(0u).y)))))));
- bvec2 v_16 = equal(((((v >> v_3) >> v_6) >> v_9) >> v_12), uvec2(0u));
- uint v_17 = ((v_16.x) ? (uvec2(4294967295u).x) : (v_15.x));
- ivec2 res = ivec2(uvec2(v_17, ((v_16.y) ? (uvec2(4294967295u).y) : (v_15.y))));
+ uvec2 v_1 = mix(uvec2(0u), uvec2(16u), equal((v & uvec2(65535u)), uvec2(0u)));
+ uvec2 v_2 = mix(uvec2(0u), uvec2(8u), equal(((v >> v_1) & uvec2(255u)), uvec2(0u)));
+ uvec2 v_3 = mix(uvec2(0u), uvec2(4u), equal((((v >> v_1) >> v_2) & uvec2(15u)), uvec2(0u)));
+ uvec2 v_4 = mix(uvec2(0u), uvec2(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec2(3u)), uvec2(0u)));
+ uvec2 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec2(0u), uvec2(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec2(1u)), uvec2(0u)))))));
+ ivec2 res = ivec2(mix(v_5, uvec2(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec2(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -104,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_18 = vertex_main_inner();
- gl_Position = v_18.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_18.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl
index 49c7e44..46efde9 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_first_trailing_bit(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_first_trailing_bit(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_first_trailing_bit(ivec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.ir.glsl
index 2514f92..7fcbb8d 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.ir.glsl
@@ -9,30 +9,12 @@
ivec3 firstTrailingBit_7496d6() {
ivec3 arg_0 = ivec3(1);
uvec3 v_1 = uvec3(arg_0);
- bvec3 v_2 = equal((v_1 & uvec3(65535u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(255u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(15u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(3u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(1u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = (v_5 | (v_9 | (v_13 | (v_17 | uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)))))));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(4294967295u).x) : (v_21.x));
- uint v_24 = ((v_22.y) ? (uvec3(4294967295u).y) : (v_21.y));
- ivec3 res = ivec3(uvec3(v_23, v_24, ((v_22.z) ? (uvec3(4294967295u).z) : (v_21.z))));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), equal((v_1 & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), equal(((v_1 >> v_2) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), equal((((v_1 >> v_2) >> v_3) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec3(0u), uvec3(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(1u)), uvec3(0u)))))));
+ ivec3 res = ivec3(mix(v_6, uvec3(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u))));
return res;
}
void main() {
@@ -47,30 +29,12 @@
ivec3 firstTrailingBit_7496d6() {
ivec3 arg_0 = ivec3(1);
uvec3 v_1 = uvec3(arg_0);
- bvec3 v_2 = equal((v_1 & uvec3(65535u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(255u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(15u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(3u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(1u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = (v_5 | (v_9 | (v_13 | (v_17 | uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)))))));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(4294967295u).x) : (v_21.x));
- uint v_24 = ((v_22.y) ? (uvec3(4294967295u).y) : (v_21.y));
- ivec3 res = ivec3(uvec3(v_23, v_24, ((v_22.z) ? (uvec3(4294967295u).z) : (v_21.z))));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), equal((v_1 & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), equal(((v_1 >> v_2) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), equal((((v_1 >> v_2) >> v_3) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec3(0u), uvec3(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(1u)), uvec3(0u)))))));
+ ivec3 res = ivec3(mix(v_6, uvec3(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -89,30 +53,12 @@
ivec3 firstTrailingBit_7496d6() {
ivec3 arg_0 = ivec3(1);
uvec3 v = uvec3(arg_0);
- bvec3 v_1 = equal((v & uvec3(65535u)), uvec3(0u));
- uint v_2 = ((v_1.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_3 = ((v_1.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_4 = uvec3(v_2, v_3, ((v_1.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_5 = equal(((v >> v_4) & uvec3(255u)), uvec3(0u));
- uint v_6 = ((v_5.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_7 = ((v_5.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_8 = uvec3(v_6, v_7, ((v_5.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_9 = equal((((v >> v_4) >> v_8) & uvec3(15u)), uvec3(0u));
- uint v_10 = ((v_9.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_11 = ((v_9.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_12 = uvec3(v_10, v_11, ((v_9.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_13 = equal(((((v >> v_4) >> v_8) >> v_12) & uvec3(3u)), uvec3(0u));
- uint v_14 = ((v_13.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_15 = ((v_13.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_16 = uvec3(v_14, v_15, ((v_13.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_17 = equal((((((v >> v_4) >> v_8) >> v_12) >> v_16) & uvec3(1u)), uvec3(0u));
- uint v_18 = ((v_17.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_19 = ((v_17.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_20 = (v_4 | (v_8 | (v_12 | (v_16 | uvec3(v_18, v_19, ((v_17.z) ? (uvec3(1u).z) : (uvec3(0u).z)))))));
- bvec3 v_21 = equal(((((v >> v_4) >> v_8) >> v_12) >> v_16), uvec3(0u));
- uint v_22 = ((v_21.x) ? (uvec3(4294967295u).x) : (v_20.x));
- uint v_23 = ((v_21.y) ? (uvec3(4294967295u).y) : (v_20.y));
- ivec3 res = ivec3(uvec3(v_22, v_23, ((v_21.z) ? (uvec3(4294967295u).z) : (v_20.z))));
+ uvec3 v_1 = mix(uvec3(0u), uvec3(16u), equal((v & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(8u), equal(((v >> v_1) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(4u), equal((((v >> v_1) >> v_2) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec3(0u), uvec3(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec3(1u)), uvec3(0u)))))));
+ ivec3 res = ivec3(mix(v_5, uvec3(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec3(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -122,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_24 = vertex_main_inner();
- gl_Position = v_24.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_24.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl
index 4ae8342..ec3ccd2 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_first_trailing_bit(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_first_trailing_bit(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
ivec4 tint_first_trailing_bit(ivec4 v) {
uvec4 x = uvec4(v);
- uvec4 b16 = tint_select(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
x = (x >> b16);
- uvec4 b8 = tint_select(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
x = (x >> b8);
- uvec4 b4 = tint_select(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
x = (x >> b4);
- uvec4 b2 = tint_select(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
x = (x >> b2);
- uvec4 b1 = tint_select(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
- uvec4 is_zero = tint_select(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.ir.glsl
index fb52ed0..1011749 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.ir.glsl
@@ -9,36 +9,12 @@
ivec4 firstTrailingBit_86551b() {
ivec4 arg_0 = ivec4(1);
uvec4 v_1 = uvec4(arg_0);
- bvec4 v_2 = equal((v_1 & uvec4(65535u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(255u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(15u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(3u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(1u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = (v_6 | (v_11 | (v_16 | (v_21 | uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)))))));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(4294967295u).x) : (v_26.x));
- uint v_29 = ((v_27.y) ? (uvec4(4294967295u).y) : (v_26.y));
- uint v_30 = ((v_27.z) ? (uvec4(4294967295u).z) : (v_26.z));
- ivec4 res = ivec4(uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(4294967295u).w) : (v_26.w))));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), equal((v_1 & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), equal(((v_1 >> v_2) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), equal((((v_1 >> v_2) >> v_3) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec4(0u), uvec4(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(1u)), uvec4(0u)))))));
+ ivec4 res = ivec4(mix(v_6, uvec4(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u))));
return res;
}
void main() {
@@ -53,36 +29,12 @@
ivec4 firstTrailingBit_86551b() {
ivec4 arg_0 = ivec4(1);
uvec4 v_1 = uvec4(arg_0);
- bvec4 v_2 = equal((v_1 & uvec4(65535u)), uvec4(0u));
- uint v_3 = ((v_2.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_7 = equal(((v_1 >> v_6) & uvec4(255u)), uvec4(0u));
- uint v_8 = ((v_7.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_9 = ((v_7.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_10 = ((v_7.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_11 = uvec4(v_8, v_9, v_10, ((v_7.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_12 = equal((((v_1 >> v_6) >> v_11) & uvec4(15u)), uvec4(0u));
- uint v_13 = ((v_12.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_14 = ((v_12.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_15 = ((v_12.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_16 = uvec4(v_13, v_14, v_15, ((v_12.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_17 = equal(((((v_1 >> v_6) >> v_11) >> v_16) & uvec4(3u)), uvec4(0u));
- uint v_18 = ((v_17.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_19 = ((v_17.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_20 = ((v_17.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_21 = uvec4(v_18, v_19, v_20, ((v_17.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_22 = equal((((((v_1 >> v_6) >> v_11) >> v_16) >> v_21) & uvec4(1u)), uvec4(0u));
- uint v_23 = ((v_22.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_24 = ((v_22.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_25 = ((v_22.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_26 = (v_6 | (v_11 | (v_16 | (v_21 | uvec4(v_23, v_24, v_25, ((v_22.w) ? (uvec4(1u).w) : (uvec4(0u).w)))))));
- bvec4 v_27 = equal(((((v_1 >> v_6) >> v_11) >> v_16) >> v_21), uvec4(0u));
- uint v_28 = ((v_27.x) ? (uvec4(4294967295u).x) : (v_26.x));
- uint v_29 = ((v_27.y) ? (uvec4(4294967295u).y) : (v_26.y));
- uint v_30 = ((v_27.z) ? (uvec4(4294967295u).z) : (v_26.z));
- ivec4 res = ivec4(uvec4(v_28, v_29, v_30, ((v_27.w) ? (uvec4(4294967295u).w) : (v_26.w))));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(16u), equal((v_1 & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(8u), equal(((v_1 >> v_2) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(4u), equal((((v_1 >> v_2) >> v_3) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_5 = mix(uvec4(0u), uvec4(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec4(0u), uvec4(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec4(1u)), uvec4(0u)))))));
+ ivec4 res = ivec4(mix(v_6, uvec4(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec4(0u))));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -101,36 +53,12 @@
ivec4 firstTrailingBit_86551b() {
ivec4 arg_0 = ivec4(1);
uvec4 v = uvec4(arg_0);
- bvec4 v_1 = equal((v & uvec4(65535u)), uvec4(0u));
- uint v_2 = ((v_1.x) ? (uvec4(16u).x) : (uvec4(0u).x));
- uint v_3 = ((v_1.y) ? (uvec4(16u).y) : (uvec4(0u).y));
- uint v_4 = ((v_1.z) ? (uvec4(16u).z) : (uvec4(0u).z));
- uvec4 v_5 = uvec4(v_2, v_3, v_4, ((v_1.w) ? (uvec4(16u).w) : (uvec4(0u).w)));
- bvec4 v_6 = equal(((v >> v_5) & uvec4(255u)), uvec4(0u));
- uint v_7 = ((v_6.x) ? (uvec4(8u).x) : (uvec4(0u).x));
- uint v_8 = ((v_6.y) ? (uvec4(8u).y) : (uvec4(0u).y));
- uint v_9 = ((v_6.z) ? (uvec4(8u).z) : (uvec4(0u).z));
- uvec4 v_10 = uvec4(v_7, v_8, v_9, ((v_6.w) ? (uvec4(8u).w) : (uvec4(0u).w)));
- bvec4 v_11 = equal((((v >> v_5) >> v_10) & uvec4(15u)), uvec4(0u));
- uint v_12 = ((v_11.x) ? (uvec4(4u).x) : (uvec4(0u).x));
- uint v_13 = ((v_11.y) ? (uvec4(4u).y) : (uvec4(0u).y));
- uint v_14 = ((v_11.z) ? (uvec4(4u).z) : (uvec4(0u).z));
- uvec4 v_15 = uvec4(v_12, v_13, v_14, ((v_11.w) ? (uvec4(4u).w) : (uvec4(0u).w)));
- bvec4 v_16 = equal(((((v >> v_5) >> v_10) >> v_15) & uvec4(3u)), uvec4(0u));
- uint v_17 = ((v_16.x) ? (uvec4(2u).x) : (uvec4(0u).x));
- uint v_18 = ((v_16.y) ? (uvec4(2u).y) : (uvec4(0u).y));
- uint v_19 = ((v_16.z) ? (uvec4(2u).z) : (uvec4(0u).z));
- uvec4 v_20 = uvec4(v_17, v_18, v_19, ((v_16.w) ? (uvec4(2u).w) : (uvec4(0u).w)));
- bvec4 v_21 = equal((((((v >> v_5) >> v_10) >> v_15) >> v_20) & uvec4(1u)), uvec4(0u));
- uint v_22 = ((v_21.x) ? (uvec4(1u).x) : (uvec4(0u).x));
- uint v_23 = ((v_21.y) ? (uvec4(1u).y) : (uvec4(0u).y));
- uint v_24 = ((v_21.z) ? (uvec4(1u).z) : (uvec4(0u).z));
- uvec4 v_25 = (v_5 | (v_10 | (v_15 | (v_20 | uvec4(v_22, v_23, v_24, ((v_21.w) ? (uvec4(1u).w) : (uvec4(0u).w)))))));
- bvec4 v_26 = equal(((((v >> v_5) >> v_10) >> v_15) >> v_20), uvec4(0u));
- uint v_27 = ((v_26.x) ? (uvec4(4294967295u).x) : (v_25.x));
- uint v_28 = ((v_26.y) ? (uvec4(4294967295u).y) : (v_25.y));
- uint v_29 = ((v_26.z) ? (uvec4(4294967295u).z) : (v_25.z));
- ivec4 res = ivec4(uvec4(v_27, v_28, v_29, ((v_26.w) ? (uvec4(4294967295u).w) : (v_25.w))));
+ uvec4 v_1 = mix(uvec4(0u), uvec4(16u), equal((v & uvec4(65535u)), uvec4(0u)));
+ uvec4 v_2 = mix(uvec4(0u), uvec4(8u), equal(((v >> v_1) & uvec4(255u)), uvec4(0u)));
+ uvec4 v_3 = mix(uvec4(0u), uvec4(4u), equal((((v >> v_1) >> v_2) & uvec4(15u)), uvec4(0u)));
+ uvec4 v_4 = mix(uvec4(0u), uvec4(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec4(3u)), uvec4(0u)));
+ uvec4 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec4(0u), uvec4(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec4(1u)), uvec4(0u)))))));
+ ivec4 res = ivec4(mix(v_5, uvec4(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec4(0u))));
return res;
}
VertexOutput vertex_main_inner() {
@@ -140,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_30 = vertex_main_inner();
- gl_Position = v_30.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_30.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl
index 97fd236..5d9293f 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl
@@ -2,23 +2,18 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_first_trailing_bit(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -47,23 +42,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_first_trailing_bit(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
@@ -93,23 +83,18 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_first_trailing_bit(uvec3 v) {
uvec3 x = uvec3(v);
- uvec3 b16 = tint_select(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
x = (x >> b16);
- uvec3 b8 = tint_select(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
x = (x >> b8);
- uvec3 b4 = tint_select(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
x = (x >> b4);
- uvec3 b2 = tint_select(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
x = (x >> b2);
- uvec3 b1 = tint_select(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
- uvec3 is_zero = tint_select(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.ir.glsl
index 9aa9660..17ecc0b 100644
--- a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.ir.glsl
@@ -9,30 +9,12 @@
uvec3 firstTrailingBit_cb51ce() {
uvec3 arg_0 = uvec3(1u);
uvec3 v_1 = arg_0;
- bvec3 v_2 = equal((v_1 & uvec3(65535u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(255u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(15u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(3u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(1u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = (v_5 | (v_9 | (v_13 | (v_17 | uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)))))));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(4294967295u).x) : (v_21.x));
- uint v_24 = ((v_22.y) ? (uvec3(4294967295u).y) : (v_21.y));
- uvec3 res = uvec3(v_23, v_24, ((v_22.z) ? (uvec3(4294967295u).z) : (v_21.z)));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), equal((v_1 & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), equal(((v_1 >> v_2) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), equal((((v_1 >> v_2) >> v_3) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec3(0u), uvec3(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(1u)), uvec3(0u)))))));
+ uvec3 res = mix(v_6, uvec3(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u)));
return res;
}
void main() {
@@ -47,30 +29,12 @@
uvec3 firstTrailingBit_cb51ce() {
uvec3 arg_0 = uvec3(1u);
uvec3 v_1 = arg_0;
- bvec3 v_2 = equal((v_1 & uvec3(65535u)), uvec3(0u));
- uint v_3 = ((v_2.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_6 = equal(((v_1 >> v_5) & uvec3(255u)), uvec3(0u));
- uint v_7 = ((v_6.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_8 = ((v_6.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_9 = uvec3(v_7, v_8, ((v_6.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_10 = equal((((v_1 >> v_5) >> v_9) & uvec3(15u)), uvec3(0u));
- uint v_11 = ((v_10.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_12 = ((v_10.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_13 = uvec3(v_11, v_12, ((v_10.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_14 = equal(((((v_1 >> v_5) >> v_9) >> v_13) & uvec3(3u)), uvec3(0u));
- uint v_15 = ((v_14.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_16 = ((v_14.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_17 = uvec3(v_15, v_16, ((v_14.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_18 = equal((((((v_1 >> v_5) >> v_9) >> v_13) >> v_17) & uvec3(1u)), uvec3(0u));
- uint v_19 = ((v_18.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_20 = ((v_18.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_21 = (v_5 | (v_9 | (v_13 | (v_17 | uvec3(v_19, v_20, ((v_18.z) ? (uvec3(1u).z) : (uvec3(0u).z)))))));
- bvec3 v_22 = equal(((((v_1 >> v_5) >> v_9) >> v_13) >> v_17), uvec3(0u));
- uint v_23 = ((v_22.x) ? (uvec3(4294967295u).x) : (v_21.x));
- uint v_24 = ((v_22.y) ? (uvec3(4294967295u).y) : (v_21.y));
- uvec3 res = uvec3(v_23, v_24, ((v_22.z) ? (uvec3(4294967295u).z) : (v_21.z)));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(16u), equal((v_1 & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(8u), equal(((v_1 >> v_2) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(4u), equal((((v_1 >> v_2) >> v_3) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_5 = mix(uvec3(0u), uvec3(2u), equal(((((v_1 >> v_2) >> v_3) >> v_4) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_6 = (v_2 | (v_3 | (v_4 | (v_5 | mix(uvec3(0u), uvec3(1u), equal((((((v_1 >> v_2) >> v_3) >> v_4) >> v_5) & uvec3(1u)), uvec3(0u)))))));
+ uvec3 res = mix(v_6, uvec3(4294967295u), equal(((((v_1 >> v_2) >> v_3) >> v_4) >> v_5), uvec3(0u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -89,30 +53,12 @@
uvec3 firstTrailingBit_cb51ce() {
uvec3 arg_0 = uvec3(1u);
uvec3 v = arg_0;
- bvec3 v_1 = equal((v & uvec3(65535u)), uvec3(0u));
- uint v_2 = ((v_1.x) ? (uvec3(16u).x) : (uvec3(0u).x));
- uint v_3 = ((v_1.y) ? (uvec3(16u).y) : (uvec3(0u).y));
- uvec3 v_4 = uvec3(v_2, v_3, ((v_1.z) ? (uvec3(16u).z) : (uvec3(0u).z)));
- bvec3 v_5 = equal(((v >> v_4) & uvec3(255u)), uvec3(0u));
- uint v_6 = ((v_5.x) ? (uvec3(8u).x) : (uvec3(0u).x));
- uint v_7 = ((v_5.y) ? (uvec3(8u).y) : (uvec3(0u).y));
- uvec3 v_8 = uvec3(v_6, v_7, ((v_5.z) ? (uvec3(8u).z) : (uvec3(0u).z)));
- bvec3 v_9 = equal((((v >> v_4) >> v_8) & uvec3(15u)), uvec3(0u));
- uint v_10 = ((v_9.x) ? (uvec3(4u).x) : (uvec3(0u).x));
- uint v_11 = ((v_9.y) ? (uvec3(4u).y) : (uvec3(0u).y));
- uvec3 v_12 = uvec3(v_10, v_11, ((v_9.z) ? (uvec3(4u).z) : (uvec3(0u).z)));
- bvec3 v_13 = equal(((((v >> v_4) >> v_8) >> v_12) & uvec3(3u)), uvec3(0u));
- uint v_14 = ((v_13.x) ? (uvec3(2u).x) : (uvec3(0u).x));
- uint v_15 = ((v_13.y) ? (uvec3(2u).y) : (uvec3(0u).y));
- uvec3 v_16 = uvec3(v_14, v_15, ((v_13.z) ? (uvec3(2u).z) : (uvec3(0u).z)));
- bvec3 v_17 = equal((((((v >> v_4) >> v_8) >> v_12) >> v_16) & uvec3(1u)), uvec3(0u));
- uint v_18 = ((v_17.x) ? (uvec3(1u).x) : (uvec3(0u).x));
- uint v_19 = ((v_17.y) ? (uvec3(1u).y) : (uvec3(0u).y));
- uvec3 v_20 = (v_4 | (v_8 | (v_12 | (v_16 | uvec3(v_18, v_19, ((v_17.z) ? (uvec3(1u).z) : (uvec3(0u).z)))))));
- bvec3 v_21 = equal(((((v >> v_4) >> v_8) >> v_12) >> v_16), uvec3(0u));
- uint v_22 = ((v_21.x) ? (uvec3(4294967295u).x) : (v_20.x));
- uint v_23 = ((v_21.y) ? (uvec3(4294967295u).y) : (v_20.y));
- uvec3 res = uvec3(v_22, v_23, ((v_21.z) ? (uvec3(4294967295u).z) : (v_20.z)));
+ uvec3 v_1 = mix(uvec3(0u), uvec3(16u), equal((v & uvec3(65535u)), uvec3(0u)));
+ uvec3 v_2 = mix(uvec3(0u), uvec3(8u), equal(((v >> v_1) & uvec3(255u)), uvec3(0u)));
+ uvec3 v_3 = mix(uvec3(0u), uvec3(4u), equal((((v >> v_1) >> v_2) & uvec3(15u)), uvec3(0u)));
+ uvec3 v_4 = mix(uvec3(0u), uvec3(2u), equal(((((v >> v_1) >> v_2) >> v_3) & uvec3(3u)), uvec3(0u)));
+ uvec3 v_5 = (v_1 | (v_2 | (v_3 | (v_4 | mix(uvec3(0u), uvec3(1u), equal((((((v >> v_1) >> v_2) >> v_3) >> v_4) & uvec3(1u)), uvec3(0u)))))));
+ uvec3 res = mix(v_5, uvec3(4294967295u), equal(((((v >> v_1) >> v_2) >> v_3) >> v_4), uvec3(0u)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -122,10 +68,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_24 = vertex_main_inner();
- gl_Position = v_24.pos;
+ VertexOutput v_6 = vertex_main_inner();
+ gl_Position = v_6.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_24.prevent_dce;
+ vertex_main_loc0_Output = v_6.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl
index d86aadc..5b0be43 100644
--- a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-ivec2 tint_select(ivec2 param_0, ivec2 param_1, bvec2 param_2) {
- return ivec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
ivec2 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bvec2 arg_2 = bvec2(true);
- ivec2 res = tint_select(arg_0, arg_1, arg_2);
+ ivec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-ivec2 tint_select(ivec2 param_0, ivec2 param_1, bvec2 param_2) {
- return ivec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
ivec2 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bvec2 arg_2 = bvec2(true);
- ivec2 res = tint_select(arg_0, arg_1, arg_2);
+ ivec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-ivec2 tint_select(ivec2 param_0, ivec2 param_1, bvec2 param_2) {
- return ivec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(location = 0) flat out ivec2 prevent_dce_1;
ivec2 select_00b848() {
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bvec2 arg_2 = bvec2(true);
- ivec2 res = tint_select(arg_0, arg_1, arg_2);
+ ivec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.ir.glsl
index 3362043..7a1f5da 100644
--- a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.ir.glsl
@@ -10,11 +10,7 @@
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bvec2 arg_2 = bvec2(true);
- ivec2 v_1 = arg_0;
- ivec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- ivec2 res = ivec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ ivec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -30,11 +26,7 @@
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bvec2 arg_2 = bvec2(true);
- ivec2 v_1 = arg_0;
- ivec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- ivec2 res = ivec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ ivec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -54,11 +46,7 @@
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bvec2 arg_2 = bvec2(true);
- ivec2 v = arg_0;
- ivec2 v_1 = arg_1;
- bvec2 v_2 = arg_2;
- int v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- ivec2 res = ivec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
+ ivec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -68,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl
index 79c1e6e..e800f37 100644
--- a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
ivec3 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bvec3 arg_2 = bvec3(true);
- ivec3 res = tint_select(arg_0, arg_1, arg_2);
+ ivec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
ivec3 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bvec3 arg_2 = bvec3(true);
- ivec3 res = tint_select(arg_0, arg_1, arg_2);
+ ivec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(location = 0) flat out ivec3 prevent_dce_1;
ivec3 select_01e2cd() {
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bvec3 arg_2 = bvec3(true);
- ivec3 res = tint_select(arg_0, arg_1, arg_2);
+ ivec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.ir.glsl
index 0adac56..dc1c560 100644
--- a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.ir.glsl
@@ -10,12 +10,7 @@
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bvec3 arg_2 = bvec3(true);
- ivec3 v_1 = arg_0;
- ivec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- int v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- ivec3 res = ivec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ ivec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -31,12 +26,7 @@
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bvec3 arg_2 = bvec3(true);
- ivec3 v_1 = arg_0;
- ivec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- int v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- ivec3 res = ivec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ ivec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -56,12 +46,7 @@
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bvec3 arg_2 = bvec3(true);
- ivec3 v = arg_0;
- ivec3 v_1 = arg_1;
- bvec3 v_2 = arg_2;
- int v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- int v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- ivec3 res = ivec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
+ ivec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -71,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl
index 9d44351..e4d3f73 100644
--- a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl
@@ -10,7 +10,7 @@
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bool arg_2 = true;
- uvec4 res = (arg_2 ? arg_1 : arg_0);
+ uvec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
@@ -37,7 +37,7 @@
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bool arg_2 = true;
- uvec4 res = (arg_2 ? arg_1 : arg_0);
+ uvec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
@@ -62,7 +62,7 @@
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bool arg_2 = true;
- uvec4 res = (arg_2 ? arg_1 : arg_0);
+ uvec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.ir.glsl
index 8021ef0..85ee644 100644
--- a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,23 +12,12 @@
bool arg_2 = true;
uvec4 v_1 = arg_0;
uvec4 v_2 = arg_1;
- bool v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uint v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- uint v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- uvec4 res = uvec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ uvec4 res = mix(v_1, v_2, bvec4(arg_2));
return res;
}
void main() {
v.tint_symbol = select_087ea4();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -43,24 +30,13 @@
bool arg_2 = true;
uvec4 v_1 = arg_0;
uvec4 v_2 = arg_1;
- bool v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uint v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- uint v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- uvec4 res = uvec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ uvec4 res = mix(v_1, v_2, bvec4(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_087ea4();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -76,11 +52,7 @@
bool arg_2 = true;
uvec4 v = arg_0;
uvec4 v_1 = arg_1;
- bool v_2 = arg_2;
- uint v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- uvec4 res = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
+ uvec4 res = mix(v, v_1, bvec4(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -90,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/089657.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/089657.wgsl.expected.glsl
index 4c05108..2ed4047 100644
--- a/test/tint/builtins/gen/var/select/089657.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/089657.wgsl.expected.glsl
@@ -4,7 +4,7 @@
void select_089657() {
bool arg_2 = true;
- vec3 res = (arg_2 ? vec3(1.0f) : vec3(1.0f));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(arg_2));
}
struct VertexOutput {
@@ -23,7 +23,7 @@
void select_089657() {
bool arg_2 = true;
- vec3 res = (arg_2 ? vec3(1.0f) : vec3(1.0f));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(arg_2));
}
struct VertexOutput {
@@ -43,7 +43,7 @@
void select_089657() {
bool arg_2 = true;
- vec3 res = (arg_2 ? vec3(1.0f) : vec3(1.0f));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(arg_2));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/089657.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/089657.wgsl.expected.ir.glsl
index bd0cf82..08405b9 100644
--- a/test/tint/builtins/gen/var/select/089657.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/089657.wgsl.expected.ir.glsl
@@ -1,46 +1,24 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
void select_089657() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec3(1.0f).x) : (vec3(1.0f).x));
- float v_2 = ((v.y) ? (vec3(1.0f).y) : (vec3(1.0f).y));
- vec3 res = vec3(v_1, v_2, ((v.z) ? (vec3(1.0f).z) : (vec3(1.0f).z)));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(arg_2));
}
void main() {
select_089657();
}
-error: Error parsing GLSL shader:
-ERROR: 0:8: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:8: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
void select_089657() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec3(1.0f).x) : (vec3(1.0f).x));
- float v_2 = ((v.y) ? (vec3(1.0f).y) : (vec3(1.0f).y));
- vec3 res = vec3(v_1, v_2, ((v.z) ? (vec3(1.0f).z) : (vec3(1.0f).z)));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(arg_2));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
select_089657();
}
-error: Error parsing GLSL shader:
-ERROR: 0:6: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:6: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -50,10 +28,7 @@
void select_089657() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec3(1.0f).x) : (vec3(1.0f).x));
- float v_2 = ((v.y) ? (vec3(1.0f).y) : (vec3(1.0f).y));
- vec3 res = vec3(v_1, v_2, ((v.z) ? (vec3(1.0f).z) : (vec3(1.0f).z)));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(arg_2));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
@@ -67,12 +42,3 @@
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:11: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl
index cc9777b..7ef188e 100644
--- a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl
@@ -11,7 +11,7 @@
float16_t arg_0 = 1.0hf;
float16_t arg_1 = 1.0hf;
bool arg_2 = true;
- float16_t res = (arg_2 ? arg_1 : arg_0);
+ float16_t res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -39,7 +39,7 @@
float16_t arg_0 = 1.0hf;
float16_t arg_1 = 1.0hf;
bool arg_2 = true;
- float16_t res = (arg_2 ? arg_1 : arg_0);
+ float16_t res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -65,7 +65,7 @@
float16_t arg_0 = 1.0hf;
float16_t arg_1 = 1.0hf;
bool arg_2 = true;
- float16_t res = (arg_2 ? arg_1 : arg_0);
+ float16_t res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.ir.glsl
index 68a6ea8..52d7287 100644
--- a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.ir.glsl
@@ -11,7 +11,7 @@
float16_t arg_0 = 1.0hf;
float16_t arg_1 = 1.0hf;
bool arg_2 = true;
- float16_t res = ((arg_2) ? (arg_1) : (arg_0));
+ float16_t res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -28,7 +28,7 @@
float16_t arg_0 = 1.0hf;
float16_t arg_1 = 1.0hf;
bool arg_2 = true;
- float16_t res = ((arg_2) ? (arg_1) : (arg_0));
+ float16_t res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -49,7 +49,7 @@
float16_t arg_0 = 1.0hf;
float16_t arg_1 = 1.0hf;
bool arg_2 = true;
- float16_t res = ((arg_2) ? (arg_1) : (arg_0));
+ float16_t res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/select/17441a.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/17441a.wgsl.expected.glsl
index 6b26bb6..244097f 100644
--- a/test/tint/builtins/gen/var/select/17441a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/17441a.wgsl.expected.glsl
@@ -4,7 +4,7 @@
void select_17441a() {
bool arg_2 = true;
- vec4 res = (arg_2 ? vec4(1.0f) : vec4(1.0f));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(arg_2));
}
struct VertexOutput {
@@ -23,7 +23,7 @@
void select_17441a() {
bool arg_2 = true;
- vec4 res = (arg_2 ? vec4(1.0f) : vec4(1.0f));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(arg_2));
}
struct VertexOutput {
@@ -43,7 +43,7 @@
void select_17441a() {
bool arg_2 = true;
- vec4 res = (arg_2 ? vec4(1.0f) : vec4(1.0f));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(arg_2));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/17441a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/17441a.wgsl.expected.ir.glsl
index 01de8e5..1b81099 100644
--- a/test/tint/builtins/gen/var/select/17441a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/17441a.wgsl.expected.ir.glsl
@@ -1,48 +1,24 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
void select_17441a() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec4(1.0f).x) : (vec4(1.0f).x));
- float v_2 = ((v.y) ? (vec4(1.0f).y) : (vec4(1.0f).y));
- float v_3 = ((v.z) ? (vec4(1.0f).z) : (vec4(1.0f).z));
- vec4 res = vec4(v_1, v_2, v_3, ((v.w) ? (vec4(1.0f).w) : (vec4(1.0f).w)));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(arg_2));
}
void main() {
select_17441a();
}
-error: Error parsing GLSL shader:
-ERROR: 0:8: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:8: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
void select_17441a() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec4(1.0f).x) : (vec4(1.0f).x));
- float v_2 = ((v.y) ? (vec4(1.0f).y) : (vec4(1.0f).y));
- float v_3 = ((v.z) ? (vec4(1.0f).z) : (vec4(1.0f).z));
- vec4 res = vec4(v_1, v_2, v_3, ((v.w) ? (vec4(1.0f).w) : (vec4(1.0f).w)));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(arg_2));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
select_17441a();
}
-error: Error parsing GLSL shader:
-ERROR: 0:6: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:6: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -52,11 +28,7 @@
void select_17441a() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec4(1.0f).x) : (vec4(1.0f).x));
- float v_2 = ((v.y) ? (vec4(1.0f).y) : (vec4(1.0f).y));
- float v_3 = ((v.z) ? (vec4(1.0f).z) : (vec4(1.0f).z));
- vec4 res = vec4(v_1, v_2, v_3, ((v.w) ? (vec4(1.0f).w) : (vec4(1.0f).w)));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(arg_2));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
@@ -70,12 +42,3 @@
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:11: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl
index e19f735..ce7e253 100644
--- a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl
@@ -11,7 +11,7 @@
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bool arg_2 = true;
- f16vec3 res = (arg_2 ? arg_1 : arg_0);
+ f16vec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
@@ -39,7 +39,7 @@
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bool arg_2 = true;
- f16vec3 res = (arg_2 ? arg_1 : arg_0);
+ f16vec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
@@ -65,7 +65,7 @@
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bool arg_2 = true;
- f16vec3 res = (arg_2 ? arg_1 : arg_0);
+ f16vec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.ir.glsl
index 9bc6f09c..d166a80 100644
--- a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
precision highp float;
@@ -15,22 +13,12 @@
bool arg_2 = true;
f16vec3 v_1 = arg_0;
f16vec3 v_2 = arg_1;
- bool v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float16_t v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- f16vec3 res = f16vec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ f16vec3 res = mix(v_1, v_2, bvec3(arg_2));
return res;
}
void main() {
v.tint_symbol = select_1ada2a();
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
@@ -44,23 +32,13 @@
bool arg_2 = true;
f16vec3 v_1 = arg_0;
f16vec3 v_2 = arg_1;
- bool v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float16_t v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- f16vec3 res = f16vec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ f16vec3 res = mix(v_1, v_2, bvec3(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_1ada2a();
}
-error: Error parsing GLSL shader:
-ERROR: 0:15: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:15: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
@@ -77,10 +55,7 @@
bool arg_2 = true;
f16vec3 v = arg_0;
f16vec3 v_1 = arg_1;
- bool v_2 = arg_2;
- float16_t v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- float16_t v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- f16vec3 res = f16vec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
+ f16vec3 res = mix(v, v_1, bvec3(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -90,19 +65,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:18: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:18: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl
index 834ffc7..106c75d 100644
--- a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec2 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bvec2 arg_2 = bvec2(true);
- uvec2 res = tint_select(arg_0, arg_1, arg_2);
+ uvec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec2 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bvec2 arg_2 = bvec2(true);
- uvec2 res = tint_select(arg_0, arg_1, arg_2);
+ uvec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(location = 0) flat out uvec2 prevent_dce_1;
uvec2 select_1e960b() {
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bvec2 arg_2 = bvec2(true);
- uvec2 res = tint_select(arg_0, arg_1, arg_2);
+ uvec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.ir.glsl
index fa4be61..6ffcbac 100644
--- a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.ir.glsl
@@ -10,11 +10,7 @@
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bvec2 arg_2 = bvec2(true);
- uvec2 v_1 = arg_0;
- uvec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uvec2 res = uvec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ uvec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -30,11 +26,7 @@
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bvec2 arg_2 = bvec2(true);
- uvec2 v_1 = arg_0;
- uvec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uvec2 res = uvec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ uvec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -54,11 +46,7 @@
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bvec2 arg_2 = bvec2(true);
- uvec2 v = arg_0;
- uvec2 v_1 = arg_1;
- bvec2 v_2 = arg_2;
- uint v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- uvec2 res = uvec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
+ uvec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -68,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/1f4d93.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/1f4d93.wgsl.expected.glsl
index f4a59fa..558e388 100644
--- a/test/tint/builtins/gen/var/select/1f4d93.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/1f4d93.wgsl.expected.glsl
@@ -2,14 +2,9 @@
precision highp float;
precision highp int;
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
void select_1f4d93() {
bvec2 arg_2 = bvec2(true);
- vec2 res = tint_select(vec2(1.0f), vec2(1.0f), arg_2);
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), arg_2);
}
struct VertexOutput {
@@ -26,14 +21,9 @@
}
#version 310 es
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
void select_1f4d93() {
bvec2 arg_2 = bvec2(true);
- vec2 res = tint_select(vec2(1.0f), vec2(1.0f), arg_2);
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), arg_2);
}
struct VertexOutput {
@@ -51,14 +41,9 @@
}
#version 310 es
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
void select_1f4d93() {
bvec2 arg_2 = bvec2(true);
- vec2 res = tint_select(vec2(1.0f), vec2(1.0f), arg_2);
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), arg_2);
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/1f4d93.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/1f4d93.wgsl.expected.ir.glsl
index 2e4cbd5..24aa1f4 100644
--- a/test/tint/builtins/gen/var/select/1f4d93.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/1f4d93.wgsl.expected.ir.glsl
@@ -4,9 +4,7 @@
void select_1f4d93() {
bvec2 arg_2 = bvec2(true);
- bvec2 v = arg_2;
- float v_1 = ((v.x) ? (vec2(1.0f).x) : (vec2(1.0f).x));
- vec2 res = vec2(v_1, ((v.y) ? (vec2(1.0f).y) : (vec2(1.0f).y)));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), arg_2);
}
void main() {
select_1f4d93();
@@ -15,9 +13,7 @@
void select_1f4d93() {
bvec2 arg_2 = bvec2(true);
- bvec2 v = arg_2;
- float v_1 = ((v.x) ? (vec2(1.0f).x) : (vec2(1.0f).x));
- vec2 res = vec2(v_1, ((v.y) ? (vec2(1.0f).y) : (vec2(1.0f).y)));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), arg_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -32,9 +28,7 @@
void select_1f4d93() {
bvec2 arg_2 = bvec2(true);
- bvec2 v = arg_2;
- float v_1 = ((v.x) ? (vec2(1.0f).x) : (vec2(1.0f).x));
- vec2 res = vec2(v_1, ((v.y) ? (vec2(1.0f).y) : (vec2(1.0f).y)));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), arg_2);
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl
index 126d014..3e24102 100644
--- a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec2 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bvec2 arg_2 = bvec2(true);
- vec2 res = tint_select(arg_0, arg_1, arg_2);
+ vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec2 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bvec2 arg_2 = bvec2(true);
- vec2 res = tint_select(arg_0, arg_1, arg_2);
+ vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-vec2 tint_select(vec2 param_0, vec2 param_1, bvec2 param_2) {
- return vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(location = 0) flat out vec2 prevent_dce_1;
vec2 select_266aff() {
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bvec2 arg_2 = bvec2(true);
- vec2 res = tint_select(arg_0, arg_1, arg_2);
+ vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.ir.glsl
index e61ac69..0a81b0c 100644
--- a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.ir.glsl
@@ -10,11 +10,7 @@
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bvec2 arg_2 = bvec2(true);
- vec2 v_1 = arg_0;
- vec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- vec2 res = vec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -30,11 +26,7 @@
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bvec2 arg_2 = bvec2(true);
- vec2 v_1 = arg_0;
- vec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- vec2 res = vec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -54,11 +46,7 @@
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bvec2 arg_2 = bvec2(true);
- vec2 v = arg_0;
- vec2 v_1 = arg_1;
- bvec2 v_2 = arg_2;
- float v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- vec2 res = vec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
+ vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -68,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl
index 409adba..0b8b138 100644
--- a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec3 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bvec3 arg_2 = bvec3(true);
- uvec3 res = tint_select(arg_0, arg_1, arg_2);
+ uvec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec3 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bvec3 arg_2 = bvec3(true);
- uvec3 res = tint_select(arg_0, arg_1, arg_2);
+ uvec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(location = 0) flat out uvec3 prevent_dce_1;
uvec3 select_28a27e() {
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bvec3 arg_2 = bvec3(true);
- uvec3 res = tint_select(arg_0, arg_1, arg_2);
+ uvec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.ir.glsl
index d09432b..513b9e4 100644
--- a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.ir.glsl
@@ -10,12 +10,7 @@
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bvec3 arg_2 = bvec3(true);
- uvec3 v_1 = arg_0;
- uvec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uint v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- uvec3 res = uvec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ uvec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -31,12 +26,7 @@
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bvec3 arg_2 = bvec3(true);
- uvec3 v_1 = arg_0;
- uvec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uint v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- uvec3 res = uvec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ uvec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -56,12 +46,7 @@
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bvec3 arg_2 = bvec3(true);
- uvec3 v = arg_0;
- uvec3 v_1 = arg_1;
- bvec3 v_2 = arg_2;
- uint v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- uvec3 res = uvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
+ uvec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -71,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/2c96d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/2c96d4.wgsl.expected.glsl
index b97b7fe..fca1d44 100644
--- a/test/tint/builtins/gen/var/select/2c96d4.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/2c96d4.wgsl.expected.glsl
@@ -2,14 +2,9 @@
precision highp float;
precision highp int;
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
void select_2c96d4() {
bvec3 arg_2 = bvec3(true);
- vec3 res = tint_select(vec3(1.0f), vec3(1.0f), arg_2);
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), arg_2);
}
struct VertexOutput {
@@ -26,14 +21,9 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
void select_2c96d4() {
bvec3 arg_2 = bvec3(true);
- vec3 res = tint_select(vec3(1.0f), vec3(1.0f), arg_2);
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), arg_2);
}
struct VertexOutput {
@@ -51,14 +41,9 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
void select_2c96d4() {
bvec3 arg_2 = bvec3(true);
- vec3 res = tint_select(vec3(1.0f), vec3(1.0f), arg_2);
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), arg_2);
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/2c96d4.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/2c96d4.wgsl.expected.ir.glsl
index e49fe5f..64b345a 100644
--- a/test/tint/builtins/gen/var/select/2c96d4.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/2c96d4.wgsl.expected.ir.glsl
@@ -4,10 +4,7 @@
void select_2c96d4() {
bvec3 arg_2 = bvec3(true);
- bvec3 v = arg_2;
- float v_1 = ((v.x) ? (vec3(1.0f).x) : (vec3(1.0f).x));
- float v_2 = ((v.y) ? (vec3(1.0f).y) : (vec3(1.0f).y));
- vec3 res = vec3(v_1, v_2, ((v.z) ? (vec3(1.0f).z) : (vec3(1.0f).z)));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), arg_2);
}
void main() {
select_2c96d4();
@@ -16,10 +13,7 @@
void select_2c96d4() {
bvec3 arg_2 = bvec3(true);
- bvec3 v = arg_2;
- float v_1 = ((v.x) ? (vec3(1.0f).x) : (vec3(1.0f).x));
- float v_2 = ((v.y) ? (vec3(1.0f).y) : (vec3(1.0f).y));
- vec3 res = vec3(v_1, v_2, ((v.z) ? (vec3(1.0f).z) : (vec3(1.0f).z)));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), arg_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -34,10 +28,7 @@
void select_2c96d4() {
bvec3 arg_2 = bvec3(true);
- bvec3 v = arg_2;
- float v_1 = ((v.x) ? (vec3(1.0f).x) : (vec3(1.0f).x));
- float v_2 = ((v.y) ? (vec3(1.0f).y) : (vec3(1.0f).y));
- vec3 res = vec3(v_1, v_2, ((v.z) ? (vec3(1.0f).z) : (vec3(1.0f).z)));
+ vec3 res = mix(vec3(1.0f), vec3(1.0f), arg_2);
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
diff --git a/test/tint/builtins/gen/var/select/3a14be.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/3a14be.wgsl.expected.glsl
index b2949e9..5671e70 100644
--- a/test/tint/builtins/gen/var/select/3a14be.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/3a14be.wgsl.expected.glsl
@@ -4,7 +4,7 @@
void select_3a14be() {
bool arg_2 = true;
- ivec2 res = (arg_2 ? ivec2(1) : ivec2(1));
+ ivec2 res = mix(ivec2(1), ivec2(1), bvec2(arg_2));
}
struct VertexOutput {
@@ -23,7 +23,7 @@
void select_3a14be() {
bool arg_2 = true;
- ivec2 res = (arg_2 ? ivec2(1) : ivec2(1));
+ ivec2 res = mix(ivec2(1), ivec2(1), bvec2(arg_2));
}
struct VertexOutput {
@@ -43,7 +43,7 @@
void select_3a14be() {
bool arg_2 = true;
- ivec2 res = (arg_2 ? ivec2(1) : ivec2(1));
+ ivec2 res = mix(ivec2(1), ivec2(1), bvec2(arg_2));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/3a14be.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/3a14be.wgsl.expected.ir.glsl
index a7ac5eb..b829d73 100644
--- a/test/tint/builtins/gen/var/select/3a14be.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/3a14be.wgsl.expected.ir.glsl
@@ -1,44 +1,24 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
void select_3a14be() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec2(1).x) : (ivec2(1).x));
- ivec2 res = ivec2(v_1, ((v.y) ? (ivec2(1).y) : (ivec2(1).y)));
+ ivec2 res = mix(ivec2(1), ivec2(1), bvec2(arg_2));
}
void main() {
select_3a14be();
}
-error: Error parsing GLSL shader:
-ERROR: 0:8: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:8: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
void select_3a14be() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec2(1).x) : (ivec2(1).x));
- ivec2 res = ivec2(v_1, ((v.y) ? (ivec2(1).y) : (ivec2(1).y)));
+ ivec2 res = mix(ivec2(1), ivec2(1), bvec2(arg_2));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
select_3a14be();
}
-error: Error parsing GLSL shader:
-ERROR: 0:6: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:6: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -48,9 +28,7 @@
void select_3a14be() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec2(1).x) : (ivec2(1).x));
- ivec2 res = ivec2(v_1, ((v.y) ? (ivec2(1).y) : (ivec2(1).y)));
+ ivec2 res = mix(ivec2(1), ivec2(1), bvec2(arg_2));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
@@ -64,12 +42,3 @@
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:11: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl
index 5c1fa05..9cf66bc 100644
--- a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl
@@ -10,8 +10,8 @@
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bool arg_2 = true;
- bvec3 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ bvec3 res = mix(arg_0, arg_1, bvec3(arg_2));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
@@ -37,8 +37,8 @@
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bool arg_2 = true;
- bvec3 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ bvec3 res = mix(arg_0, arg_1, bvec3(arg_2));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
@@ -62,8 +62,8 @@
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bool arg_2 = true;
- bvec3 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ bvec3 res = mix(arg_0, arg_1, bvec3(arg_2));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.ir.glsl
index 48f0a85..79dc8b0 100644
--- a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,22 +12,12 @@
bool arg_2 = true;
bvec3 v_1 = arg_0;
bvec3 v_2 = arg_1;
- bool v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bool v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- bvec3 res = bvec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
- return ((all((res == bvec3(false)))) ? (1) : (0));
+ bvec3 res = mix(v_1, v_2, bvec3(arg_2));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
void main() {
v.tint_symbol = select_3c25ce();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -42,23 +30,13 @@
bool arg_2 = true;
bvec3 v_1 = arg_0;
bvec3 v_2 = arg_1;
- bool v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bool v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- bvec3 res = bvec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
- return ((all((res == bvec3(false)))) ? (1) : (0));
+ bvec3 res = mix(v_1, v_2, bvec3(arg_2));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_3c25ce();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -74,11 +52,8 @@
bool arg_2 = true;
bvec3 v = arg_0;
bvec3 v_1 = arg_1;
- bool v_2 = arg_2;
- bool v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- bool v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- bvec3 res = bvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
- return ((all((res == bvec3(false)))) ? (1) : (0));
+ bvec3 res = mix(v, v_1, bvec3(arg_2));
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
@@ -87,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl
index df8234a..70578ca 100644
--- a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl
@@ -10,7 +10,7 @@
float arg_0 = 1.0f;
float arg_1 = 1.0f;
bool arg_2 = true;
- float res = (arg_2 ? arg_1 : arg_0);
+ float res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -37,7 +37,7 @@
float arg_0 = 1.0f;
float arg_1 = 1.0f;
bool arg_2 = true;
- float res = (arg_2 ? arg_1 : arg_0);
+ float res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -62,7 +62,7 @@
float arg_0 = 1.0f;
float arg_1 = 1.0f;
bool arg_2 = true;
- float res = (arg_2 ? arg_1 : arg_0);
+ float res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.ir.glsl
index 6e71e60..bb179b4 100644
--- a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
float arg_0 = 1.0f;
float arg_1 = 1.0f;
bool arg_2 = true;
- float res = ((arg_2) ? (arg_1) : (arg_0));
+ float res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -26,7 +26,7 @@
float arg_0 = 1.0f;
float arg_1 = 1.0f;
bool arg_2 = true;
- float res = ((arg_2) ? (arg_1) : (arg_0));
+ float res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -46,7 +46,7 @@
float arg_0 = 1.0f;
float arg_1 = 1.0f;
bool arg_2 = true;
- float res = ((arg_2) ? (arg_1) : (arg_0));
+ float res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/select/431dfb.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/431dfb.wgsl.expected.glsl
index 6dc1ca6..00a386f 100644
--- a/test/tint/builtins/gen/var/select/431dfb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/431dfb.wgsl.expected.glsl
@@ -2,14 +2,9 @@
precision highp float;
precision highp int;
-ivec2 tint_select(ivec2 param_0, ivec2 param_1, bvec2 param_2) {
- return ivec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
void select_431dfb() {
bvec2 arg_2 = bvec2(true);
- ivec2 res = tint_select(ivec2(1), ivec2(1), arg_2);
+ ivec2 res = mix(ivec2(1), ivec2(1), arg_2);
}
struct VertexOutput {
@@ -26,14 +21,9 @@
}
#version 310 es
-ivec2 tint_select(ivec2 param_0, ivec2 param_1, bvec2 param_2) {
- return ivec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
void select_431dfb() {
bvec2 arg_2 = bvec2(true);
- ivec2 res = tint_select(ivec2(1), ivec2(1), arg_2);
+ ivec2 res = mix(ivec2(1), ivec2(1), arg_2);
}
struct VertexOutput {
@@ -51,14 +41,9 @@
}
#version 310 es
-ivec2 tint_select(ivec2 param_0, ivec2 param_1, bvec2 param_2) {
- return ivec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
void select_431dfb() {
bvec2 arg_2 = bvec2(true);
- ivec2 res = tint_select(ivec2(1), ivec2(1), arg_2);
+ ivec2 res = mix(ivec2(1), ivec2(1), arg_2);
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/431dfb.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/431dfb.wgsl.expected.ir.glsl
index 60740dd..384e29d 100644
--- a/test/tint/builtins/gen/var/select/431dfb.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/431dfb.wgsl.expected.ir.glsl
@@ -4,9 +4,7 @@
void select_431dfb() {
bvec2 arg_2 = bvec2(true);
- bvec2 v = arg_2;
- int v_1 = ((v.x) ? (ivec2(1).x) : (ivec2(1).x));
- ivec2 res = ivec2(v_1, ((v.y) ? (ivec2(1).y) : (ivec2(1).y)));
+ ivec2 res = mix(ivec2(1), ivec2(1), arg_2);
}
void main() {
select_431dfb();
@@ -15,9 +13,7 @@
void select_431dfb() {
bvec2 arg_2 = bvec2(true);
- bvec2 v = arg_2;
- int v_1 = ((v.x) ? (ivec2(1).x) : (ivec2(1).x));
- ivec2 res = ivec2(v_1, ((v.y) ? (ivec2(1).y) : (ivec2(1).y)));
+ ivec2 res = mix(ivec2(1), ivec2(1), arg_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -32,9 +28,7 @@
void select_431dfb() {
bvec2 arg_2 = bvec2(true);
- bvec2 v = arg_2;
- int v_1 = ((v.x) ? (ivec2(1).x) : (ivec2(1).x));
- ivec2 res = ivec2(v_1, ((v.y) ? (ivec2(1).y) : (ivec2(1).y)));
+ ivec2 res = mix(ivec2(1), ivec2(1), arg_2);
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
diff --git a/test/tint/builtins/gen/var/select/43741e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/43741e.wgsl.expected.glsl
index 8b630fa..b1fa9f4 100644
--- a/test/tint/builtins/gen/var/select/43741e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/43741e.wgsl.expected.glsl
@@ -2,14 +2,9 @@
precision highp float;
precision highp int;
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
void select_43741e() {
bvec4 arg_2 = bvec4(true);
- vec4 res = tint_select(vec4(1.0f), vec4(1.0f), arg_2);
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), arg_2);
}
struct VertexOutput {
@@ -26,14 +21,9 @@
}
#version 310 es
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
void select_43741e() {
bvec4 arg_2 = bvec4(true);
- vec4 res = tint_select(vec4(1.0f), vec4(1.0f), arg_2);
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), arg_2);
}
struct VertexOutput {
@@ -51,14 +41,9 @@
}
#version 310 es
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
void select_43741e() {
bvec4 arg_2 = bvec4(true);
- vec4 res = tint_select(vec4(1.0f), vec4(1.0f), arg_2);
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), arg_2);
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/43741e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/43741e.wgsl.expected.ir.glsl
index e86a886..9e01aaa 100644
--- a/test/tint/builtins/gen/var/select/43741e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/43741e.wgsl.expected.ir.glsl
@@ -4,11 +4,7 @@
void select_43741e() {
bvec4 arg_2 = bvec4(true);
- bvec4 v = arg_2;
- float v_1 = ((v.x) ? (vec4(1.0f).x) : (vec4(1.0f).x));
- float v_2 = ((v.y) ? (vec4(1.0f).y) : (vec4(1.0f).y));
- float v_3 = ((v.z) ? (vec4(1.0f).z) : (vec4(1.0f).z));
- vec4 res = vec4(v_1, v_2, v_3, ((v.w) ? (vec4(1.0f).w) : (vec4(1.0f).w)));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), arg_2);
}
void main() {
select_43741e();
@@ -17,11 +13,7 @@
void select_43741e() {
bvec4 arg_2 = bvec4(true);
- bvec4 v = arg_2;
- float v_1 = ((v.x) ? (vec4(1.0f).x) : (vec4(1.0f).x));
- float v_2 = ((v.y) ? (vec4(1.0f).y) : (vec4(1.0f).y));
- float v_3 = ((v.z) ? (vec4(1.0f).z) : (vec4(1.0f).z));
- vec4 res = vec4(v_1, v_2, v_3, ((v.w) ? (vec4(1.0f).w) : (vec4(1.0f).w)));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), arg_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -36,11 +28,7 @@
void select_43741e() {
bvec4 arg_2 = bvec4(true);
- bvec4 v = arg_2;
- float v_1 = ((v.x) ? (vec4(1.0f).x) : (vec4(1.0f).x));
- float v_2 = ((v.y) ? (vec4(1.0f).y) : (vec4(1.0f).y));
- float v_3 = ((v.z) ? (vec4(1.0f).z) : (vec4(1.0f).z));
- vec4 res = vec4(v_1, v_2, v_3, ((v.w) ? (vec4(1.0f).w) : (vec4(1.0f).w)));
+ vec4 res = mix(vec4(1.0f), vec4(1.0f), arg_2);
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
diff --git a/test/tint/builtins/gen/var/select/494051.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/494051.wgsl.expected.glsl
index 5be0c62..e0020a0 100644
--- a/test/tint/builtins/gen/var/select/494051.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/494051.wgsl.expected.glsl
@@ -4,7 +4,7 @@
void select_494051() {
bool arg_2 = true;
- float res = (arg_2 ? 1.0f : 1.0f);
+ float res = mix(1.0f, 1.0f, arg_2);
}
struct VertexOutput {
@@ -23,7 +23,7 @@
void select_494051() {
bool arg_2 = true;
- float res = (arg_2 ? 1.0f : 1.0f);
+ float res = mix(1.0f, 1.0f, arg_2);
}
struct VertexOutput {
@@ -43,7 +43,7 @@
void select_494051() {
bool arg_2 = true;
- float res = (arg_2 ? 1.0f : 1.0f);
+ float res = mix(1.0f, 1.0f, arg_2);
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/494051.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/494051.wgsl.expected.ir.glsl
index 9cdfaa0..c7b1c64 100644
--- a/test/tint/builtins/gen/var/select/494051.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/494051.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
void select_494051() {
bool arg_2 = true;
- float res = ((arg_2) ? (1.0f) : (1.0f));
+ float res = mix(1.0f, 1.0f, arg_2);
}
void main() {
select_494051();
@@ -13,7 +13,7 @@
void select_494051() {
bool arg_2 = true;
- float res = ((arg_2) ? (1.0f) : (1.0f));
+ float res = mix(1.0f, 1.0f, arg_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -28,7 +28,7 @@
void select_494051() {
bool arg_2 = true;
- float res = ((arg_2) ? (1.0f) : (1.0f));
+ float res = mix(1.0f, 1.0f, arg_2);
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
diff --git a/test/tint/builtins/gen/var/select/4c4738.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/4c4738.wgsl.expected.glsl
index f9f084d..276779c 100644
--- a/test/tint/builtins/gen/var/select/4c4738.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/4c4738.wgsl.expected.glsl
@@ -2,14 +2,9 @@
precision highp float;
precision highp int;
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
void select_4c4738() {
bvec4 arg_2 = bvec4(true);
- ivec4 res = tint_select(ivec4(1), ivec4(1), arg_2);
+ ivec4 res = mix(ivec4(1), ivec4(1), arg_2);
}
struct VertexOutput {
@@ -26,14 +21,9 @@
}
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
void select_4c4738() {
bvec4 arg_2 = bvec4(true);
- ivec4 res = tint_select(ivec4(1), ivec4(1), arg_2);
+ ivec4 res = mix(ivec4(1), ivec4(1), arg_2);
}
struct VertexOutput {
@@ -51,14 +41,9 @@
}
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
void select_4c4738() {
bvec4 arg_2 = bvec4(true);
- ivec4 res = tint_select(ivec4(1), ivec4(1), arg_2);
+ ivec4 res = mix(ivec4(1), ivec4(1), arg_2);
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/4c4738.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/4c4738.wgsl.expected.ir.glsl
index ee11d57..93d5598 100644
--- a/test/tint/builtins/gen/var/select/4c4738.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/4c4738.wgsl.expected.ir.glsl
@@ -4,11 +4,7 @@
void select_4c4738() {
bvec4 arg_2 = bvec4(true);
- bvec4 v = arg_2;
- int v_1 = ((v.x) ? (ivec4(1).x) : (ivec4(1).x));
- int v_2 = ((v.y) ? (ivec4(1).y) : (ivec4(1).y));
- int v_3 = ((v.z) ? (ivec4(1).z) : (ivec4(1).z));
- ivec4 res = ivec4(v_1, v_2, v_3, ((v.w) ? (ivec4(1).w) : (ivec4(1).w)));
+ ivec4 res = mix(ivec4(1), ivec4(1), arg_2);
}
void main() {
select_4c4738();
@@ -17,11 +13,7 @@
void select_4c4738() {
bvec4 arg_2 = bvec4(true);
- bvec4 v = arg_2;
- int v_1 = ((v.x) ? (ivec4(1).x) : (ivec4(1).x));
- int v_2 = ((v.y) ? (ivec4(1).y) : (ivec4(1).y));
- int v_3 = ((v.z) ? (ivec4(1).z) : (ivec4(1).z));
- ivec4 res = ivec4(v_1, v_2, v_3, ((v.w) ? (ivec4(1).w) : (ivec4(1).w)));
+ ivec4 res = mix(ivec4(1), ivec4(1), arg_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -36,11 +28,7 @@
void select_4c4738() {
bvec4 arg_2 = bvec4(true);
- bvec4 v = arg_2;
- int v_1 = ((v.x) ? (ivec4(1).x) : (ivec4(1).x));
- int v_2 = ((v.y) ? (ivec4(1).y) : (ivec4(1).y));
- int v_3 = ((v.z) ? (ivec4(1).z) : (ivec4(1).z));
- ivec4 res = ivec4(v_1, v_2, v_3, ((v.w) ? (ivec4(1).w) : (ivec4(1).w)));
+ ivec4 res = mix(ivec4(1), ivec4(1), arg_2);
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
diff --git a/test/tint/builtins/gen/var/select/4e60da.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/4e60da.wgsl.expected.glsl
index 65ce800..72461ca 100644
--- a/test/tint/builtins/gen/var/select/4e60da.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/4e60da.wgsl.expected.glsl
@@ -4,7 +4,7 @@
void select_4e60da() {
bool arg_2 = true;
- vec2 res = (arg_2 ? vec2(1.0f) : vec2(1.0f));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(arg_2));
}
struct VertexOutput {
@@ -23,7 +23,7 @@
void select_4e60da() {
bool arg_2 = true;
- vec2 res = (arg_2 ? vec2(1.0f) : vec2(1.0f));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(arg_2));
}
struct VertexOutput {
@@ -43,7 +43,7 @@
void select_4e60da() {
bool arg_2 = true;
- vec2 res = (arg_2 ? vec2(1.0f) : vec2(1.0f));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(arg_2));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/4e60da.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/4e60da.wgsl.expected.ir.glsl
index b554c50..66e661d 100644
--- a/test/tint/builtins/gen/var/select/4e60da.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/4e60da.wgsl.expected.ir.glsl
@@ -1,44 +1,24 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
void select_4e60da() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec2(1.0f).x) : (vec2(1.0f).x));
- vec2 res = vec2(v_1, ((v.y) ? (vec2(1.0f).y) : (vec2(1.0f).y)));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(arg_2));
}
void main() {
select_4e60da();
}
-error: Error parsing GLSL shader:
-ERROR: 0:8: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:8: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
void select_4e60da() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec2(1.0f).x) : (vec2(1.0f).x));
- vec2 res = vec2(v_1, ((v.y) ? (vec2(1.0f).y) : (vec2(1.0f).y)));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(arg_2));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
select_4e60da();
}
-error: Error parsing GLSL shader:
-ERROR: 0:6: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:6: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -48,9 +28,7 @@
void select_4e60da() {
bool arg_2 = true;
- bool v = arg_2;
- float v_1 = ((v.x) ? (vec2(1.0f).x) : (vec2(1.0f).x));
- vec2 res = vec2(v_1, ((v.y) ? (vec2(1.0f).y) : (vec2(1.0f).y)));
+ vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(arg_2));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
@@ -64,12 +42,3 @@
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:11: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl
index fe7347e..3aa19be 100644
--- a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl
@@ -10,7 +10,7 @@
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bool arg_2 = true;
- uvec2 res = (arg_2 ? arg_1 : arg_0);
+ uvec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
@@ -37,7 +37,7 @@
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bool arg_2 = true;
- uvec2 res = (arg_2 ? arg_1 : arg_0);
+ uvec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
@@ -62,7 +62,7 @@
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
bool arg_2 = true;
- uvec2 res = (arg_2 ? arg_1 : arg_0);
+ uvec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.ir.glsl
index 3006149..001d7b3 100644
--- a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,21 +12,12 @@
bool arg_2 = true;
uvec2 v_1 = arg_0;
uvec2 v_2 = arg_1;
- bool v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uvec2 res = uvec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ uvec2 res = mix(v_1, v_2, bvec2(arg_2));
return res;
}
void main() {
v.tint_symbol = select_51b047();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -41,22 +30,13 @@
bool arg_2 = true;
uvec2 v_1 = arg_0;
uvec2 v_2 = arg_1;
- bool v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uvec2 res = uvec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ uvec2 res = mix(v_1, v_2, bvec2(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_51b047();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -72,9 +52,7 @@
bool arg_2 = true;
uvec2 v = arg_0;
uvec2 v_1 = arg_1;
- bool v_2 = arg_2;
- uint v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- uvec2 res = uvec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
+ uvec2 res = mix(v, v_1, bvec2(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -84,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl
index 347f941..a57b4b6 100644
--- a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl
@@ -3,11 +3,6 @@
precision highp float;
precision highp int;
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec3 inner;
} prevent_dce;
@@ -16,7 +11,7 @@
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bvec3 arg_2 = bvec3(true);
- f16vec3 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -36,11 +31,6 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec3 inner;
} prevent_dce;
@@ -49,7 +39,7 @@
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bvec3 arg_2 = bvec3(true);
- f16vec3 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -70,17 +60,12 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_select(f16vec3 param_0, f16vec3 param_1, bvec3 param_2) {
- return f16vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(location = 0) flat out f16vec3 prevent_dce_1;
f16vec3 select_53d518() {
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bvec3 arg_2 = bvec3(true);
- f16vec3 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.ir.glsl
index 2d5095b..fc2b300 100644
--- a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.ir.glsl
@@ -11,12 +11,7 @@
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bvec3 arg_2 = bvec3(true);
- f16vec3 v_1 = arg_0;
- f16vec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float16_t v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- f16vec3 res = f16vec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ f16vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -33,12 +28,7 @@
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bvec3 arg_2 = bvec3(true);
- f16vec3 v_1 = arg_0;
- f16vec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float16_t v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- f16vec3 res = f16vec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ f16vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -59,12 +49,7 @@
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_1 = f16vec3(1.0hf);
bvec3 arg_2 = bvec3(true);
- f16vec3 v = arg_0;
- f16vec3 v_1 = arg_1;
- bvec3 v_2 = arg_2;
- float16_t v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- float16_t v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- f16vec3 res = f16vec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
+ f16vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -74,10 +59,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl
index b37361c..cb98faf 100644
--- a/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl
@@ -10,7 +10,7 @@
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bool arg_2 = true;
- vec4 res = (arg_2 ? arg_1 : arg_0);
+ vec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
@@ -37,7 +37,7 @@
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bool arg_2 = true;
- vec4 res = (arg_2 ? arg_1 : arg_0);
+ vec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
@@ -62,7 +62,7 @@
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bool arg_2 = true;
- vec4 res = (arg_2 ? arg_1 : arg_0);
+ vec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.ir.glsl
index 5e4a357..e691a51 100644
--- a/test/tint/builtins/gen/var/select/713567.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,23 +12,12 @@
bool arg_2 = true;
vec4 v_1 = arg_0;
vec4 v_2 = arg_1;
- bool v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- float v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- vec4 res = vec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ vec4 res = mix(v_1, v_2, bvec4(arg_2));
return res;
}
void main() {
v.tint_symbol = select_713567();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -43,24 +30,13 @@
bool arg_2 = true;
vec4 v_1 = arg_0;
vec4 v_2 = arg_1;
- bool v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- float v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- vec4 res = vec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ vec4 res = mix(v_1, v_2, bvec4(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_713567();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -76,11 +52,7 @@
bool arg_2 = true;
vec4 v = arg_0;
vec4 v_1 = arg_1;
- bool v_2 = arg_2;
- float v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- float v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- float v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- vec4 res = vec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
+ vec4 res = mix(v, v_1, bvec4(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -90,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl
index fa5e5bc..3269e38 100644
--- a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl
@@ -10,7 +10,7 @@
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bool arg_2 = true;
- vec3 res = (arg_2 ? arg_1 : arg_0);
+ vec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
@@ -37,7 +37,7 @@
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bool arg_2 = true;
- vec3 res = (arg_2 ? arg_1 : arg_0);
+ vec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
@@ -62,7 +62,7 @@
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bool arg_2 = true;
- vec3 res = (arg_2 ? arg_1 : arg_0);
+ vec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.ir.glsl
index a777673..3d787e6 100644
--- a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,22 +12,12 @@
bool arg_2 = true;
vec3 v_1 = arg_0;
vec3 v_2 = arg_1;
- bool v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- vec3 res = vec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ vec3 res = mix(v_1, v_2, bvec3(arg_2));
return res;
}
void main() {
v.tint_symbol = select_78be5f();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -42,23 +30,13 @@
bool arg_2 = true;
vec3 v_1 = arg_0;
vec3 v_2 = arg_1;
- bool v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- vec3 res = vec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ vec3 res = mix(v_1, v_2, bvec3(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_78be5f();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -74,10 +52,7 @@
bool arg_2 = true;
vec3 v = arg_0;
vec3 v_1 = arg_1;
- bool v_2 = arg_2;
- float v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- float v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- vec3 res = vec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
+ vec3 res = mix(v, v_1, bvec3(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -87,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl
index 52e3285..821d346 100644
--- a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-bvec3 tint_select(bvec3 param_0, bvec3 param_1, bvec3 param_2) {
- return bvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
int inner;
} prevent_dce;
@@ -15,8 +10,8 @@
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bvec3 arg_2 = bvec3(true);
- bvec3 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
@@ -34,11 +29,6 @@
}
#version 310 es
-bvec3 tint_select(bvec3 param_0, bvec3 param_1, bvec3 param_2) {
- return bvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
int inner;
} prevent_dce;
@@ -47,8 +37,8 @@
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bvec3 arg_2 = bvec3(true);
- bvec3 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
@@ -67,18 +57,13 @@
}
#version 310 es
-bvec3 tint_select(bvec3 param_0, bvec3 param_1, bvec3 param_2) {
- return bvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(location = 0) flat out int prevent_dce_1;
int select_80a9a9() {
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bvec3 arg_2 = bvec3(true);
- bvec3 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec3(false))) ? 1 : 0);
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.ir.glsl
index 00ca629..b1ae8b6 100644
--- a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.ir.glsl
@@ -10,13 +10,8 @@
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bvec3 arg_2 = bvec3(true);
- bvec3 v_1 = arg_0;
- bvec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bool v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- bvec3 res = bvec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
void main() {
v.tint_symbol = select_80a9a9();
@@ -31,13 +26,8 @@
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bvec3 arg_2 = bvec3(true);
- bvec3 v_1 = arg_0;
- bvec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bool v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- bvec3 res = bvec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -56,13 +46,8 @@
bvec3 arg_0 = bvec3(true);
bvec3 arg_1 = bvec3(true);
bvec3 arg_2 = bvec3(true);
- bvec3 v = arg_0;
- bvec3 v_1 = arg_1;
- bvec3 v_2 = arg_2;
- bool v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- bool v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- bvec3 res = bvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
- return ((all(equal(res, bvec3(false)))) ? (1) : (0));
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec3(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
@@ -71,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl
index 85bcca7..d54d23c 100644
--- a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl
@@ -11,7 +11,7 @@
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bool arg_2 = true;
- f16vec4 res = (arg_2 ? arg_1 : arg_0);
+ f16vec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
@@ -39,7 +39,7 @@
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bool arg_2 = true;
- f16vec4 res = (arg_2 ? arg_1 : arg_0);
+ f16vec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
@@ -65,7 +65,7 @@
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bool arg_2 = true;
- f16vec4 res = (arg_2 ? arg_1 : arg_0);
+ f16vec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.ir.glsl
index 34f215d..be9c2e5 100644
--- a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
precision highp float;
@@ -15,23 +13,12 @@
bool arg_2 = true;
f16vec4 v_1 = arg_0;
f16vec4 v_2 = arg_1;
- bool v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float16_t v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- float16_t v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- f16vec4 res = f16vec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ f16vec4 res = mix(v_1, v_2, bvec4(arg_2));
return res;
}
void main() {
v.tint_symbol = select_830dd9();
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
@@ -45,24 +32,13 @@
bool arg_2 = true;
f16vec4 v_1 = arg_0;
f16vec4 v_2 = arg_1;
- bool v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float16_t v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- float16_t v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- f16vec4 res = f16vec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ f16vec4 res = mix(v_1, v_2, bvec4(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_830dd9();
}
-error: Error parsing GLSL shader:
-ERROR: 0:15: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:15: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
@@ -79,11 +55,7 @@
bool arg_2 = true;
f16vec4 v = arg_0;
f16vec4 v_1 = arg_1;
- bool v_2 = arg_2;
- float16_t v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- float16_t v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- float16_t v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- f16vec4 res = f16vec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
+ f16vec4 res = mix(v, v_1, bvec4(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -93,19 +65,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:18: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:18: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl
index 650b484..657240d 100644
--- a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl
@@ -11,7 +11,7 @@
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bool arg_2 = true;
- f16vec2 res = (arg_2 ? arg_1 : arg_0);
+ f16vec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
@@ -39,7 +39,7 @@
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bool arg_2 = true;
- f16vec2 res = (arg_2 ? arg_1 : arg_0);
+ f16vec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
@@ -65,7 +65,7 @@
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bool arg_2 = true;
- f16vec2 res = (arg_2 ? arg_1 : arg_0);
+ f16vec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.ir.glsl
index 314d2e3..fcb4800 100644
--- a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
precision highp float;
@@ -15,21 +13,12 @@
bool arg_2 = true;
f16vec2 v_1 = arg_0;
f16vec2 v_2 = arg_1;
- bool v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- f16vec2 res = f16vec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ f16vec2 res = mix(v_1, v_2, bvec2(arg_2));
return res;
}
void main() {
v.tint_symbol = select_86f9bd();
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
@@ -43,22 +32,13 @@
bool arg_2 = true;
f16vec2 v_1 = arg_0;
f16vec2 v_2 = arg_1;
- bool v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- f16vec2 res = f16vec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ f16vec2 res = mix(v_1, v_2, bvec2(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_86f9bd();
}
-error: Error parsing GLSL shader:
-ERROR: 0:15: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:15: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
@@ -75,9 +55,7 @@
bool arg_2 = true;
f16vec2 v = arg_0;
f16vec2 v_1 = arg_1;
- bool v_2 = arg_2;
- float16_t v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- f16vec2 res = f16vec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
+ f16vec2 res = mix(v, v_1, bvec2(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -87,19 +65,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:18: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:18: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl
index 2e09685..628c2dd 100644
--- a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl
@@ -10,7 +10,7 @@
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bool arg_2 = true;
- ivec3 res = (arg_2 ? arg_1 : arg_0);
+ ivec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
@@ -37,7 +37,7 @@
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bool arg_2 = true;
- ivec3 res = (arg_2 ? arg_1 : arg_0);
+ ivec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
@@ -62,7 +62,7 @@
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
bool arg_2 = true;
- ivec3 res = (arg_2 ? arg_1 : arg_0);
+ ivec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.ir.glsl
index afbf47a..0c99497 100644
--- a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,22 +12,12 @@
bool arg_2 = true;
ivec3 v_1 = arg_0;
ivec3 v_2 = arg_1;
- bool v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- int v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- ivec3 res = ivec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ ivec3 res = mix(v_1, v_2, bvec3(arg_2));
return res;
}
void main() {
v.tint_symbol = select_8fa62c();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -42,23 +30,13 @@
bool arg_2 = true;
ivec3 v_1 = arg_0;
ivec3 v_2 = arg_1;
- bool v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- int v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- ivec3 res = ivec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ ivec3 res = mix(v_1, v_2, bvec3(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_8fa62c();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -74,10 +52,7 @@
bool arg_2 = true;
ivec3 v = arg_0;
ivec3 v_1 = arg_1;
- bool v_2 = arg_2;
- int v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- int v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- ivec3 res = ivec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
+ ivec3 res = mix(v, v_1, bvec3(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -87,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl
index 646ab31..247d990 100644
--- a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl
@@ -10,7 +10,7 @@
uint arg_0 = 1u;
uint arg_1 = 1u;
bool arg_2 = true;
- uint res = (arg_2 ? arg_1 : arg_0);
+ uint res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -37,7 +37,7 @@
uint arg_0 = 1u;
uint arg_1 = 1u;
bool arg_2 = true;
- uint res = (arg_2 ? arg_1 : arg_0);
+ uint res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -62,7 +62,7 @@
uint arg_0 = 1u;
uint arg_1 = 1u;
bool arg_2 = true;
- uint res = (arg_2 ? arg_1 : arg_0);
+ uint res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.ir.glsl
index 8ae0563..dd82170 100644
--- a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
uint arg_0 = 1u;
uint arg_1 = 1u;
bool arg_2 = true;
- uint res = ((arg_2) ? (arg_1) : (arg_0));
+ uint res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -26,7 +26,7 @@
uint arg_0 = 1u;
uint arg_1 = 1u;
bool arg_2 = true;
- uint res = ((arg_2) ? (arg_1) : (arg_0));
+ uint res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -46,7 +46,7 @@
uint arg_0 = 1u;
uint arg_1 = 1u;
bool arg_2 = true;
- uint res = ((arg_2) ? (arg_1) : (arg_0));
+ uint res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/select/9b478d.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/9b478d.wgsl.expected.glsl
index a0ba6e3..5ed8c3d 100644
--- a/test/tint/builtins/gen/var/select/9b478d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/9b478d.wgsl.expected.glsl
@@ -4,7 +4,7 @@
void select_9b478d() {
bool arg_2 = true;
- int res = (arg_2 ? 1 : 1);
+ int res = mix(1, 1, arg_2);
}
struct VertexOutput {
@@ -23,7 +23,7 @@
void select_9b478d() {
bool arg_2 = true;
- int res = (arg_2 ? 1 : 1);
+ int res = mix(1, 1, arg_2);
}
struct VertexOutput {
@@ -43,7 +43,7 @@
void select_9b478d() {
bool arg_2 = true;
- int res = (arg_2 ? 1 : 1);
+ int res = mix(1, 1, arg_2);
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/9b478d.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/9b478d.wgsl.expected.ir.glsl
index 1c92af9..d1c51f8 100644
--- a/test/tint/builtins/gen/var/select/9b478d.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/9b478d.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
void select_9b478d() {
bool arg_2 = true;
- int res = ((arg_2) ? (1) : (1));
+ int res = mix(1, 1, arg_2);
}
void main() {
select_9b478d();
@@ -13,7 +13,7 @@
void select_9b478d() {
bool arg_2 = true;
- int res = ((arg_2) ? (1) : (1));
+ int res = mix(1, 1, arg_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -28,7 +28,7 @@
void select_9b478d() {
bool arg_2 = true;
- int res = ((arg_2) ? (1) : (1));
+ int res = mix(1, 1, arg_2);
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl
index 97cc8f9..7808f29 100644
--- a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl
@@ -3,11 +3,6 @@
precision highp float;
precision highp int;
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec4 inner;
} prevent_dce;
@@ -16,7 +11,7 @@
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bvec4 arg_2 = bvec4(true);
- f16vec4 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -36,11 +31,6 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec4 inner;
} prevent_dce;
@@ -49,7 +39,7 @@
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bvec4 arg_2 = bvec4(true);
- f16vec4 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -70,17 +60,12 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_select(f16vec4 param_0, f16vec4 param_1, bvec4 param_2) {
- return f16vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(location = 0) flat out f16vec4 prevent_dce_1;
f16vec4 select_a081f1() {
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bvec4 arg_2 = bvec4(true);
- f16vec4 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.ir.glsl
index 44799a6..c9e3a71 100644
--- a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.ir.glsl
@@ -11,13 +11,7 @@
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bvec4 arg_2 = bvec4(true);
- f16vec4 v_1 = arg_0;
- f16vec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float16_t v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- float16_t v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- f16vec4 res = f16vec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ f16vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -34,13 +28,7 @@
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bvec4 arg_2 = bvec4(true);
- f16vec4 v_1 = arg_0;
- f16vec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float16_t v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- float16_t v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- f16vec4 res = f16vec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ f16vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -61,13 +49,7 @@
f16vec4 arg_0 = f16vec4(1.0hf);
f16vec4 arg_1 = f16vec4(1.0hf);
bvec4 arg_2 = bvec4(true);
- f16vec4 v = arg_0;
- f16vec4 v_1 = arg_1;
- bvec4 v_2 = arg_2;
- float16_t v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- float16_t v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- float16_t v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- f16vec4 res = f16vec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
+ f16vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -77,10 +59,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl
index a76c004..840818b 100644
--- a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
ivec4 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bvec4 arg_2 = bvec4(true);
- ivec4 res = tint_select(arg_0, arg_1, arg_2);
+ ivec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
ivec4 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bvec4 arg_2 = bvec4(true);
- ivec4 res = tint_select(arg_0, arg_1, arg_2);
+ ivec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(location = 0) flat out ivec4 prevent_dce_1;
ivec4 select_a2860e() {
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bvec4 arg_2 = bvec4(true);
- ivec4 res = tint_select(arg_0, arg_1, arg_2);
+ ivec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.ir.glsl
index b6c7a99..5bc8797 100644
--- a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.ir.glsl
@@ -10,13 +10,7 @@
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bvec4 arg_2 = bvec4(true);
- ivec4 v_1 = arg_0;
- ivec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- int v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- int v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- ivec4 res = ivec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ ivec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -32,13 +26,7 @@
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bvec4 arg_2 = bvec4(true);
- ivec4 v_1 = arg_0;
- ivec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- int v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- int v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- ivec4 res = ivec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ ivec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -58,13 +46,7 @@
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bvec4 arg_2 = bvec4(true);
- ivec4 v = arg_0;
- ivec4 v_1 = arg_1;
- bvec4 v_2 = arg_2;
- int v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- int v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- int v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- ivec4 res = ivec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
+ ivec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -74,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl
index 0ed0bcd..ba87617 100644
--- a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl
@@ -10,7 +10,7 @@
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bool arg_2 = true;
- ivec4 res = (arg_2 ? arg_1 : arg_0);
+ ivec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
@@ -37,7 +37,7 @@
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bool arg_2 = true;
- ivec4 res = (arg_2 ? arg_1 : arg_0);
+ ivec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
@@ -62,7 +62,7 @@
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
bool arg_2 = true;
- ivec4 res = (arg_2 ? arg_1 : arg_0);
+ ivec4 res = mix(arg_0, arg_1, bvec4(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.ir.glsl
index 2c0bcd6..4e8f6d1 100644
--- a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,23 +12,12 @@
bool arg_2 = true;
ivec4 v_1 = arg_0;
ivec4 v_2 = arg_1;
- bool v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- int v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- int v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- ivec4 res = ivec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ ivec4 res = mix(v_1, v_2, bvec4(arg_2));
return res;
}
void main() {
v.tint_symbol = select_ab069f();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -43,24 +30,13 @@
bool arg_2 = true;
ivec4 v_1 = arg_0;
ivec4 v_2 = arg_1;
- bool v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- int v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- int v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- ivec4 res = ivec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ ivec4 res = mix(v_1, v_2, bvec4(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_ab069f();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -76,11 +52,7 @@
bool arg_2 = true;
ivec4 v = arg_0;
ivec4 v_1 = arg_1;
- bool v_2 = arg_2;
- int v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- int v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- int v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- ivec4 res = ivec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
+ ivec4 res = mix(v, v_1, bvec4(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -90,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl
index 562ff42..02be400 100644
--- a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl
@@ -10,7 +10,7 @@
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bool arg_2 = true;
- uvec3 res = (arg_2 ? arg_1 : arg_0);
+ uvec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
@@ -37,7 +37,7 @@
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bool arg_2 = true;
- uvec3 res = (arg_2 ? arg_1 : arg_0);
+ uvec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
@@ -62,7 +62,7 @@
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
bool arg_2 = true;
- uvec3 res = (arg_2 ? arg_1 : arg_0);
+ uvec3 res = mix(arg_0, arg_1, bvec3(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.ir.glsl
index 0887bfd..06c1dd3 100644
--- a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,22 +12,12 @@
bool arg_2 = true;
uvec3 v_1 = arg_0;
uvec3 v_2 = arg_1;
- bool v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uint v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- uvec3 res = uvec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ uvec3 res = mix(v_1, v_2, bvec3(arg_2));
return res;
}
void main() {
v.tint_symbol = select_b04721();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -42,23 +30,13 @@
bool arg_2 = true;
uvec3 v_1 = arg_0;
uvec3 v_2 = arg_1;
- bool v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uint v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- uvec3 res = uvec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ uvec3 res = mix(v_1, v_2, bvec3(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_b04721();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -74,10 +52,7 @@
bool arg_2 = true;
uvec3 v = arg_0;
uvec3 v_1 = arg_1;
- bool v_2 = arg_2;
- uint v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- uvec3 res = uvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
+ uvec3 res = mix(v, v_1, bvec3(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -87,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/b93806.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/b93806.wgsl.expected.glsl
index 905d00a..ce82c9bf 100644
--- a/test/tint/builtins/gen/var/select/b93806.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/b93806.wgsl.expected.glsl
@@ -2,14 +2,9 @@
precision highp float;
precision highp int;
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
void select_b93806() {
bvec3 arg_2 = bvec3(true);
- ivec3 res = tint_select(ivec3(1), ivec3(1), arg_2);
+ ivec3 res = mix(ivec3(1), ivec3(1), arg_2);
}
struct VertexOutput {
@@ -26,14 +21,9 @@
}
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
void select_b93806() {
bvec3 arg_2 = bvec3(true);
- ivec3 res = tint_select(ivec3(1), ivec3(1), arg_2);
+ ivec3 res = mix(ivec3(1), ivec3(1), arg_2);
}
struct VertexOutput {
@@ -51,14 +41,9 @@
}
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
void select_b93806() {
bvec3 arg_2 = bvec3(true);
- ivec3 res = tint_select(ivec3(1), ivec3(1), arg_2);
+ ivec3 res = mix(ivec3(1), ivec3(1), arg_2);
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/b93806.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/b93806.wgsl.expected.ir.glsl
index f5d955e..a6f52f5 100644
--- a/test/tint/builtins/gen/var/select/b93806.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/b93806.wgsl.expected.ir.glsl
@@ -4,10 +4,7 @@
void select_b93806() {
bvec3 arg_2 = bvec3(true);
- bvec3 v = arg_2;
- int v_1 = ((v.x) ? (ivec3(1).x) : (ivec3(1).x));
- int v_2 = ((v.y) ? (ivec3(1).y) : (ivec3(1).y));
- ivec3 res = ivec3(v_1, v_2, ((v.z) ? (ivec3(1).z) : (ivec3(1).z)));
+ ivec3 res = mix(ivec3(1), ivec3(1), arg_2);
}
void main() {
select_b93806();
@@ -16,10 +13,7 @@
void select_b93806() {
bvec3 arg_2 = bvec3(true);
- bvec3 v = arg_2;
- int v_1 = ((v.x) ? (ivec3(1).x) : (ivec3(1).x));
- int v_2 = ((v.y) ? (ivec3(1).y) : (ivec3(1).y));
- ivec3 res = ivec3(v_1, v_2, ((v.z) ? (ivec3(1).z) : (ivec3(1).z)));
+ ivec3 res = mix(ivec3(1), ivec3(1), arg_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -34,10 +28,7 @@
void select_b93806() {
bvec3 arg_2 = bvec3(true);
- bvec3 v = arg_2;
- int v_1 = ((v.x) ? (ivec3(1).x) : (ivec3(1).x));
- int v_2 = ((v.y) ? (ivec3(1).y) : (ivec3(1).y));
- ivec3 res = ivec3(v_1, v_2, ((v.z) ? (ivec3(1).z) : (ivec3(1).z)));
+ ivec3 res = mix(ivec3(1), ivec3(1), arg_2);
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl
index 4238b6a..c8938f8 100644
--- a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl
@@ -10,7 +10,7 @@
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bool arg_2 = true;
- ivec2 res = (arg_2 ? arg_1 : arg_0);
+ ivec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
@@ -37,7 +37,7 @@
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bool arg_2 = true;
- ivec2 res = (arg_2 ? arg_1 : arg_0);
+ ivec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
@@ -62,7 +62,7 @@
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
bool arg_2 = true;
- ivec2 res = (arg_2 ? arg_1 : arg_0);
+ ivec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.ir.glsl
index 7335492..a56da5c 100644
--- a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,21 +12,12 @@
bool arg_2 = true;
ivec2 v_1 = arg_0;
ivec2 v_2 = arg_1;
- bool v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- ivec2 res = ivec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ ivec2 res = mix(v_1, v_2, bvec2(arg_2));
return res;
}
void main() {
v.tint_symbol = select_bb447f();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -41,22 +30,13 @@
bool arg_2 = true;
ivec2 v_1 = arg_0;
ivec2 v_2 = arg_1;
- bool v_3 = arg_2;
- int v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- ivec2 res = ivec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ ivec2 res = mix(v_1, v_2, bvec2(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_bb447f();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -72,9 +52,7 @@
bool arg_2 = true;
ivec2 v = arg_0;
ivec2 v_1 = arg_1;
- bool v_2 = arg_2;
- int v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- ivec2 res = ivec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
+ ivec2 res = mix(v, v_1, bvec2(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -84,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl
index 4fcdc02..bd3f881 100644
--- a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec4 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bvec4 arg_2 = bvec4(true);
- vec4 res = tint_select(arg_0, arg_1, arg_2);
+ vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec4 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bvec4 arg_2 = bvec4(true);
- vec4 res = tint_select(arg_0, arg_1, arg_2);
+ vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-vec4 tint_select(vec4 param_0, vec4 param_1, bvec4 param_2) {
- return vec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(location = 0) flat out vec4 prevent_dce_1;
vec4 select_bb8aae() {
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bvec4 arg_2 = bvec4(true);
- vec4 res = tint_select(arg_0, arg_1, arg_2);
+ vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.ir.glsl
index 6f3d869..f2ce060 100644
--- a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.ir.glsl
@@ -10,13 +10,7 @@
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bvec4 arg_2 = bvec4(true);
- vec4 v_1 = arg_0;
- vec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- float v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- vec4 res = vec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -32,13 +26,7 @@
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bvec4 arg_2 = bvec4(true);
- vec4 v_1 = arg_0;
- vec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- float v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- vec4 res = vec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -58,13 +46,7 @@
vec4 arg_0 = vec4(1.0f);
vec4 arg_1 = vec4(1.0f);
bvec4 arg_2 = bvec4(true);
- vec4 v = arg_0;
- vec4 v_1 = arg_1;
- bvec4 v_2 = arg_2;
- float v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- float v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- float v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- vec4 res = vec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
+ vec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -74,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl
index 8979034..eb2513e 100644
--- a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl
@@ -10,7 +10,7 @@
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bool arg_2 = true;
- vec2 res = (arg_2 ? arg_1 : arg_0);
+ vec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
@@ -37,7 +37,7 @@
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bool arg_2 = true;
- vec2 res = (arg_2 ? arg_1 : arg_0);
+ vec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
@@ -62,7 +62,7 @@
vec2 arg_0 = vec2(1.0f);
vec2 arg_1 = vec2(1.0f);
bool arg_2 = true;
- vec2 res = (arg_2 ? arg_1 : arg_0);
+ vec2 res = mix(arg_0, arg_1, bvec2(arg_2));
return res;
}
diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.ir.glsl
index cebede2..ca7641c 100644
--- a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,21 +12,12 @@
bool arg_2 = true;
vec2 v_1 = arg_0;
vec2 v_2 = arg_1;
- bool v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- vec2 res = vec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ vec2 res = mix(v_1, v_2, bvec2(arg_2));
return res;
}
void main() {
v.tint_symbol = select_bf3d29();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -41,22 +30,13 @@
bool arg_2 = true;
vec2 v_1 = arg_0;
vec2 v_2 = arg_1;
- bool v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- vec2 res = vec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ vec2 res = mix(v_1, v_2, bvec2(arg_2));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_bf3d29();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -72,9 +52,7 @@
bool arg_2 = true;
vec2 v = arg_0;
vec2 v_1 = arg_1;
- bool v_2 = arg_2;
- float v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- vec2 res = vec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
+ vec2 res = mix(v, v_1, bvec2(arg_2));
return res;
}
VertexOutput vertex_main_inner() {
@@ -84,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl
index d4db801..99c0b2f 100644
--- a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl
@@ -10,8 +10,8 @@
bool arg_0 = true;
bool arg_1 = true;
bool arg_2 = true;
- bool res = (arg_2 ? arg_1 : arg_0);
- return ((res == false) ? 1 : 0);
+ bool res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -37,8 +37,8 @@
bool arg_0 = true;
bool arg_1 = true;
bool arg_2 = true;
- bool res = (arg_2 ? arg_1 : arg_0);
- return ((res == false) ? 1 : 0);
+ bool res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
@@ -62,8 +62,8 @@
bool arg_0 = true;
bool arg_1 = true;
bool arg_2 = true;
- bool res = (arg_2 ? arg_1 : arg_0);
- return ((res == false) ? 1 : 0);
+ bool res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, (res == false));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.ir.glsl
index d9a48b1..15c2c2c 100644
--- a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.ir.glsl
@@ -10,8 +10,8 @@
bool arg_0 = true;
bool arg_1 = true;
bool arg_2 = true;
- bool res = ((arg_2) ? (arg_1) : (arg_0));
- return (((res == false)) ? (1) : (0));
+ bool res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, (res == false));
}
void main() {
v.tint_symbol = select_c31f9e();
@@ -26,8 +26,8 @@
bool arg_0 = true;
bool arg_1 = true;
bool arg_2 = true;
- bool res = ((arg_2) ? (arg_1) : (arg_0));
- return (((res == false)) ? (1) : (0));
+ bool res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, (res == false));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -46,8 +46,8 @@
bool arg_0 = true;
bool arg_1 = true;
bool arg_2 = true;
- bool res = ((arg_2) ? (arg_1) : (arg_0));
- return (((res == false)) ? (1) : (0));
+ bool res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, (res == false));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl
index bac9706..80a8a44 100644
--- a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl
@@ -10,8 +10,8 @@
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bool arg_2 = true;
- bvec4 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ bvec4 res = mix(arg_0, arg_1, bvec4(arg_2));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
@@ -37,8 +37,8 @@
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bool arg_2 = true;
- bvec4 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ bvec4 res = mix(arg_0, arg_1, bvec4(arg_2));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
@@ -62,8 +62,8 @@
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bool arg_2 = true;
- bvec4 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ bvec4 res = mix(arg_0, arg_1, bvec4(arg_2));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.ir.glsl
index bd1438f..a630901 100644
--- a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,23 +12,12 @@
bool arg_2 = true;
bvec4 v_1 = arg_0;
bvec4 v_2 = arg_1;
- bool v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bool v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- bool v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- bvec4 res = bvec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
- return ((all((res == bvec4(false)))) ? (1) : (0));
+ bvec4 res = mix(v_1, v_2, bvec4(arg_2));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
void main() {
v.tint_symbol = select_c41bd1();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -43,24 +30,13 @@
bool arg_2 = true;
bvec4 v_1 = arg_0;
bvec4 v_2 = arg_1;
- bool v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bool v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- bool v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- bvec4 res = bvec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
- return ((all((res == bvec4(false)))) ? (1) : (0));
+ bvec4 res = mix(v_1, v_2, bvec4(arg_2));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_c41bd1();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -76,12 +52,8 @@
bool arg_2 = true;
bvec4 v = arg_0;
bvec4 v_1 = arg_1;
- bool v_2 = arg_2;
- bool v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- bool v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- bool v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- bvec4 res = bvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
- return ((all((res == bvec4(false)))) ? (1) : (0));
+ bvec4 res = mix(v, v_1, bvec4(arg_2));
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
@@ -90,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl
index 22536d2..987ce40 100644
--- a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec4 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bvec4 arg_2 = bvec4(true);
- uvec4 res = tint_select(arg_0, arg_1, arg_2);
+ uvec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec4 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bvec4 arg_2 = bvec4(true);
- uvec4 res = tint_select(arg_0, arg_1, arg_2);
+ uvec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(location = 0) flat out uvec4 prevent_dce_1;
uvec4 select_c4a4ef() {
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bvec4 arg_2 = bvec4(true);
- uvec4 res = tint_select(arg_0, arg_1, arg_2);
+ uvec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.ir.glsl
index 3b49383..8f8623f 100644
--- a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.ir.glsl
@@ -10,13 +10,7 @@
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bvec4 arg_2 = bvec4(true);
- uvec4 v_1 = arg_0;
- uvec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uint v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- uint v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- uvec4 res = uvec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ uvec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -32,13 +26,7 @@
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bvec4 arg_2 = bvec4(true);
- uvec4 v_1 = arg_0;
- uvec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- uint v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- uint v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- uint v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- uvec4 res = uvec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
+ uvec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -58,13 +46,7 @@
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
bvec4 arg_2 = bvec4(true);
- uvec4 v = arg_0;
- uvec4 v_1 = arg_1;
- bvec4 v_2 = arg_2;
- uint v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- uvec4 res = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
+ uvec4 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -74,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl
index 911d5fd..6c52d36 100644
--- a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-bvec2 tint_select(bvec2 param_0, bvec2 param_1, bvec2 param_2) {
- return bvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
int inner;
} prevent_dce;
@@ -15,8 +10,8 @@
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bvec2 arg_2 = bvec2(true);
- bvec2 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
@@ -34,11 +29,6 @@
}
#version 310 es
-bvec2 tint_select(bvec2 param_0, bvec2 param_1, bvec2 param_2) {
- return bvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
int inner;
} prevent_dce;
@@ -47,8 +37,8 @@
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bvec2 arg_2 = bvec2(true);
- bvec2 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
@@ -67,18 +57,13 @@
}
#version 310 es
-bvec2 tint_select(bvec2 param_0, bvec2 param_1, bvec2 param_2) {
- return bvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(location = 0) flat out int prevent_dce_1;
int select_cb9301() {
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bvec2 arg_2 = bvec2(true);
- bvec2 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.ir.glsl
index 77adae4..95b3a80 100644
--- a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.ir.glsl
@@ -10,12 +10,8 @@
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bvec2 arg_2 = bvec2(true);
- bvec2 v_1 = arg_0;
- bvec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bvec2 res = bvec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
void main() {
v.tint_symbol = select_cb9301();
@@ -30,12 +26,8 @@
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bvec2 arg_2 = bvec2(true);
- bvec2 v_1 = arg_0;
- bvec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bvec2 res = bvec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -54,12 +46,8 @@
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bvec2 arg_2 = bvec2(true);
- bvec2 v = arg_0;
- bvec2 v_1 = arg_1;
- bvec2 v_2 = arg_2;
- bool v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- bvec2 res = bvec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
- return ((all(equal(res, bvec2(false)))) ? (1) : (0));
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
@@ -68,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/dfab3b.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/dfab3b.wgsl.expected.glsl
index 16fecd8..1e6db4e 100644
--- a/test/tint/builtins/gen/var/select/dfab3b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/dfab3b.wgsl.expected.glsl
@@ -4,7 +4,7 @@
void select_dfab3b() {
bool arg_2 = true;
- ivec3 res = (arg_2 ? ivec3(1) : ivec3(1));
+ ivec3 res = mix(ivec3(1), ivec3(1), bvec3(arg_2));
}
struct VertexOutput {
@@ -23,7 +23,7 @@
void select_dfab3b() {
bool arg_2 = true;
- ivec3 res = (arg_2 ? ivec3(1) : ivec3(1));
+ ivec3 res = mix(ivec3(1), ivec3(1), bvec3(arg_2));
}
struct VertexOutput {
@@ -43,7 +43,7 @@
void select_dfab3b() {
bool arg_2 = true;
- ivec3 res = (arg_2 ? ivec3(1) : ivec3(1));
+ ivec3 res = mix(ivec3(1), ivec3(1), bvec3(arg_2));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/dfab3b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/dfab3b.wgsl.expected.ir.glsl
index f85c518..ce475a6 100644
--- a/test/tint/builtins/gen/var/select/dfab3b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/dfab3b.wgsl.expected.ir.glsl
@@ -1,46 +1,24 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
void select_dfab3b() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec3(1).x) : (ivec3(1).x));
- int v_2 = ((v.y) ? (ivec3(1).y) : (ivec3(1).y));
- ivec3 res = ivec3(v_1, v_2, ((v.z) ? (ivec3(1).z) : (ivec3(1).z)));
+ ivec3 res = mix(ivec3(1), ivec3(1), bvec3(arg_2));
}
void main() {
select_dfab3b();
}
-error: Error parsing GLSL shader:
-ERROR: 0:8: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:8: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
void select_dfab3b() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec3(1).x) : (ivec3(1).x));
- int v_2 = ((v.y) ? (ivec3(1).y) : (ivec3(1).y));
- ivec3 res = ivec3(v_1, v_2, ((v.z) ? (ivec3(1).z) : (ivec3(1).z)));
+ ivec3 res = mix(ivec3(1), ivec3(1), bvec3(arg_2));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
select_dfab3b();
}
-error: Error parsing GLSL shader:
-ERROR: 0:6: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:6: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -50,10 +28,7 @@
void select_dfab3b() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec3(1).x) : (ivec3(1).x));
- int v_2 = ((v.y) ? (ivec3(1).y) : (ivec3(1).y));
- ivec3 res = ivec3(v_1, v_2, ((v.z) ? (ivec3(1).z) : (ivec3(1).z)));
+ ivec3 res = mix(ivec3(1), ivec3(1), bvec3(arg_2));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
@@ -67,12 +42,3 @@
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:11: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/e381c3.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/e381c3.wgsl.expected.glsl
index e8f3498..9b3a0ad 100644
--- a/test/tint/builtins/gen/var/select/e381c3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/e381c3.wgsl.expected.glsl
@@ -4,7 +4,7 @@
void select_e381c3() {
bool arg_2 = true;
- ivec4 res = (arg_2 ? ivec4(1) : ivec4(1));
+ ivec4 res = mix(ivec4(1), ivec4(1), bvec4(arg_2));
}
struct VertexOutput {
@@ -23,7 +23,7 @@
void select_e381c3() {
bool arg_2 = true;
- ivec4 res = (arg_2 ? ivec4(1) : ivec4(1));
+ ivec4 res = mix(ivec4(1), ivec4(1), bvec4(arg_2));
}
struct VertexOutput {
@@ -43,7 +43,7 @@
void select_e381c3() {
bool arg_2 = true;
- ivec4 res = (arg_2 ? ivec4(1) : ivec4(1));
+ ivec4 res = mix(ivec4(1), ivec4(1), bvec4(arg_2));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/e381c3.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/e381c3.wgsl.expected.ir.glsl
index c3da7cd..59a8bca 100644
--- a/test/tint/builtins/gen/var/select/e381c3.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/e381c3.wgsl.expected.ir.glsl
@@ -1,48 +1,24 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
void select_e381c3() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec4(1).x) : (ivec4(1).x));
- int v_2 = ((v.y) ? (ivec4(1).y) : (ivec4(1).y));
- int v_3 = ((v.z) ? (ivec4(1).z) : (ivec4(1).z));
- ivec4 res = ivec4(v_1, v_2, v_3, ((v.w) ? (ivec4(1).w) : (ivec4(1).w)));
+ ivec4 res = mix(ivec4(1), ivec4(1), bvec4(arg_2));
}
void main() {
select_e381c3();
}
-error: Error parsing GLSL shader:
-ERROR: 0:8: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:8: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
void select_e381c3() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec4(1).x) : (ivec4(1).x));
- int v_2 = ((v.y) ? (ivec4(1).y) : (ivec4(1).y));
- int v_3 = ((v.z) ? (ivec4(1).z) : (ivec4(1).z));
- ivec4 res = ivec4(v_1, v_2, v_3, ((v.w) ? (ivec4(1).w) : (ivec4(1).w)));
+ ivec4 res = mix(ivec4(1), ivec4(1), bvec4(arg_2));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
select_e381c3();
}
-error: Error parsing GLSL shader:
-ERROR: 0:6: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:6: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -52,11 +28,7 @@
void select_e381c3() {
bool arg_2 = true;
- bool v = arg_2;
- int v_1 = ((v.x) ? (ivec4(1).x) : (ivec4(1).x));
- int v_2 = ((v.y) ? (ivec4(1).y) : (ivec4(1).y));
- int v_3 = ((v.z) ? (ivec4(1).z) : (ivec4(1).z));
- ivec4 res = ivec4(v_1, v_2, v_3, ((v.w) ? (ivec4(1).w) : (ivec4(1).w)));
+ ivec4 res = mix(ivec4(1), ivec4(1), bvec4(arg_2));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f));
@@ -70,12 +42,3 @@
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:11: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl
index a1341e2..1945c3c 100644
--- a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-bvec4 tint_select(bvec4 param_0, bvec4 param_1, bvec4 param_2) {
- return bvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
int inner;
} prevent_dce;
@@ -15,8 +10,8 @@
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bvec4 arg_2 = bvec4(true);
- bvec4 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
@@ -34,11 +29,6 @@
}
#version 310 es
-bvec4 tint_select(bvec4 param_0, bvec4 param_1, bvec4 param_2) {
- return bvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
int inner;
} prevent_dce;
@@ -47,8 +37,8 @@
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bvec4 arg_2 = bvec4(true);
- bvec4 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
@@ -67,18 +57,13 @@
}
#version 310 es
-bvec4 tint_select(bvec4 param_0, bvec4 param_1, bvec4 param_2) {
- return bvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(location = 0) flat out int prevent_dce_1;
int select_e3e028() {
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bvec4 arg_2 = bvec4(true);
- bvec4 res = tint_select(arg_0, arg_1, arg_2);
- return (all(equal(res, bvec4(false))) ? 1 : 0);
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.ir.glsl
index d676139..48fbe1c 100644
--- a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.ir.glsl
@@ -10,14 +10,8 @@
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bvec4 arg_2 = bvec4(true);
- bvec4 v_1 = arg_0;
- bvec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bool v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- bool v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- bvec4 res = bvec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
void main() {
v.tint_symbol = select_e3e028();
@@ -32,14 +26,8 @@
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bvec4 arg_2 = bvec4(true);
- bvec4 v_1 = arg_0;
- bvec4 v_2 = arg_1;
- bvec4 v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bool v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- bool v_6 = ((v_3.z) ? (v_2.z) : (v_1.z));
- bvec4 res = bvec4(v_4, v_5, v_6, ((v_3.w) ? (v_2.w) : (v_1.w)));
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -58,14 +46,8 @@
bvec4 arg_0 = bvec4(true);
bvec4 arg_1 = bvec4(true);
bvec4 arg_2 = bvec4(true);
- bvec4 v = arg_0;
- bvec4 v_1 = arg_1;
- bvec4 v_2 = arg_2;
- bool v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- bool v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- bool v_5 = ((v_2.z) ? (v_1.z) : (v.z));
- bvec4 res = bvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (v.w)));
- return ((all(equal(res, bvec4(false)))) ? (1) : (0));
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+ return mix(0, 1, all(equal(res, bvec4(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
@@ -74,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_6 = vertex_main_inner();
- gl_Position = v_6.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_6.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl
index eeb05e5..67b8a81 100644
--- a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec3 inner;
} prevent_dce;
@@ -15,7 +10,7 @@
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bvec3 arg_2 = bvec3(true);
- vec3 res = tint_select(arg_0, arg_1, arg_2);
+ vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -34,11 +29,6 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec3 inner;
} prevent_dce;
@@ -47,7 +37,7 @@
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bvec3 arg_2 = bvec3(true);
- vec3 res = tint_select(arg_0, arg_1, arg_2);
+ vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -67,17 +57,12 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(location = 0) flat out vec3 prevent_dce_1;
vec3 select_ebfea2() {
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bvec3 arg_2 = bvec3(true);
- vec3 res = tint_select(arg_0, arg_1, arg_2);
+ vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.ir.glsl
index 92890c4..5c2fe0d 100644
--- a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.ir.glsl
@@ -10,12 +10,7 @@
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bvec3 arg_2 = bvec3(true);
- vec3 v_1 = arg_0;
- vec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- vec3 res = vec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -31,12 +26,7 @@
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bvec3 arg_2 = bvec3(true);
- vec3 v_1 = arg_0;
- vec3 v_2 = arg_1;
- bvec3 v_3 = arg_2;
- float v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- float v_5 = ((v_3.y) ? (v_2.y) : (v_1.y));
- vec3 res = vec3(v_4, v_5, ((v_3.z) ? (v_2.z) : (v_1.z)));
+ vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -56,12 +46,7 @@
vec3 arg_0 = vec3(1.0f);
vec3 arg_1 = vec3(1.0f);
bvec3 arg_2 = bvec3(true);
- vec3 v = arg_0;
- vec3 v_1 = arg_1;
- bvec3 v_2 = arg_2;
- float v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- float v_4 = ((v_2.y) ? (v_1.y) : (v.y));
- vec3 res = vec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (v.z)));
+ vec3 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -71,10 +56,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_5 = vertex_main_inner();
- gl_Position = v_5.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_5.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl
index c85e846..93b1d3e 100644
--- a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl
@@ -3,11 +3,6 @@
precision highp float;
precision highp int;
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec2 inner;
} prevent_dce;
@@ -16,7 +11,7 @@
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bvec2 arg_2 = bvec2(true);
- f16vec2 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -36,11 +31,6 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec2 inner;
} prevent_dce;
@@ -49,7 +39,7 @@
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bvec2 arg_2 = bvec2(true);
- f16vec2 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -70,17 +60,12 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_select(f16vec2 param_0, f16vec2 param_1, bvec2 param_2) {
- return f16vec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(location = 0) flat out f16vec2 prevent_dce_1;
f16vec2 select_ed7c13() {
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bvec2 arg_2 = bvec2(true);
- f16vec2 res = tint_select(arg_0, arg_1, arg_2);
+ f16vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.ir.glsl
index cac0345..e609913 100644
--- a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.ir.glsl
@@ -11,11 +11,7 @@
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bvec2 arg_2 = bvec2(true);
- f16vec2 v_1 = arg_0;
- f16vec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- f16vec2 res = f16vec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ f16vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -32,11 +28,7 @@
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bvec2 arg_2 = bvec2(true);
- f16vec2 v_1 = arg_0;
- f16vec2 v_2 = arg_1;
- bvec2 v_3 = arg_2;
- float16_t v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- f16vec2 res = f16vec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
+ f16vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -57,11 +49,7 @@
f16vec2 arg_0 = f16vec2(1.0hf);
f16vec2 arg_1 = f16vec2(1.0hf);
bvec2 arg_2 = bvec2(true);
- f16vec2 v = arg_0;
- f16vec2 v_1 = arg_1;
- bvec2 v_2 = arg_2;
- float16_t v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- f16vec2 res = f16vec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
+ f16vec2 res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
@@ -71,10 +59,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v = vertex_main_inner();
+ gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl
index 9745c57..3cda203 100644
--- a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int arg_0 = 1;
int arg_1 = 1;
bool arg_2 = true;
- int res = (arg_2 ? arg_1 : arg_0);
+ int res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -37,7 +37,7 @@
int arg_0 = 1;
int arg_1 = 1;
bool arg_2 = true;
- int res = (arg_2 ? arg_1 : arg_0);
+ int res = mix(arg_0, arg_1, arg_2);
return res;
}
@@ -62,7 +62,7 @@
int arg_0 = 1;
int arg_1 = 1;
bool arg_2 = true;
- int res = (arg_2 ? arg_1 : arg_0);
+ int res = mix(arg_0, arg_1, arg_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.ir.glsl
index 4a6e0c0..8dd0219 100644
--- a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int arg_0 = 1;
int arg_1 = 1;
bool arg_2 = true;
- int res = ((arg_2) ? (arg_1) : (arg_0));
+ int res = mix(arg_0, arg_1, arg_2);
return res;
}
void main() {
@@ -26,7 +26,7 @@
int arg_0 = 1;
int arg_1 = 1;
bool arg_2 = true;
- int res = ((arg_2) ? (arg_1) : (arg_0));
+ int res = mix(arg_0, arg_1, arg_2);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -46,7 +46,7 @@
int arg_0 = 1;
int arg_1 = 1;
bool arg_2 = true;
- int res = ((arg_2) ? (arg_1) : (arg_0));
+ int res = mix(arg_0, arg_1, arg_2);
return res;
}
VertexOutput vertex_main_inner() {
diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl
index 1d7ff8d..18ff8a7 100644
--- a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl
@@ -10,8 +10,8 @@
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bool arg_2 = true;
- bvec2 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ bvec2 res = mix(arg_0, arg_1, bvec2(arg_2));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
@@ -37,8 +37,8 @@
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bool arg_2 = true;
- bvec2 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ bvec2 res = mix(arg_0, arg_1, bvec2(arg_2));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
@@ -62,8 +62,8 @@
bvec2 arg_0 = bvec2(true);
bvec2 arg_1 = bvec2(true);
bool arg_2 = true;
- bvec2 res = (arg_2 ? arg_1 : arg_0);
- return (all(equal(res, bvec2(false))) ? 1 : 0);
+ bvec2 res = mix(arg_0, arg_1, bvec2(arg_2));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.ir.glsl
index 9f93d8c..2003d4e 100644
--- a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -14,21 +12,12 @@
bool arg_2 = true;
bvec2 v_1 = arg_0;
bvec2 v_2 = arg_1;
- bool v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bvec2 res = bvec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
- return ((all((res == bvec2(false)))) ? (1) : (0));
+ bvec2 res = mix(v_1, v_2, bvec2(arg_2));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
void main() {
v.tint_symbol = select_fb7e53();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:16: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
@@ -41,22 +30,13 @@
bool arg_2 = true;
bvec2 v_1 = arg_0;
bvec2 v_2 = arg_1;
- bool v_3 = arg_2;
- bool v_4 = ((v_3.x) ? (v_2.x) : (v_1.x));
- bvec2 res = bvec2(v_4, ((v_3.y) ? (v_2.y) : (v_1.y)));
- return ((all((res == bvec2(false)))) ? (1) : (0));
+ bvec2 res = mix(v_1, v_2, bvec2(arg_2));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = select_fb7e53();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:14: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -72,10 +52,8 @@
bool arg_2 = true;
bvec2 v = arg_0;
bvec2 v_1 = arg_1;
- bool v_2 = arg_2;
- bool v_3 = ((v_2.x) ? (v_1.x) : (v.x));
- bvec2 res = bvec2(v_3, ((v_2.y) ? (v_1.y) : (v.y)));
- return ((all((res == bvec2(false)))) ? (1) : (0));
+ bvec2 res = mix(v, v_1, bvec2(arg_2));
+ return mix(0, 1, all(equal(res, bvec2(false))));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
@@ -84,19 +62,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_4 = vertex_main_inner();
- gl_Position = v_4.pos;
+ VertexOutput v_2 = vertex_main_inner();
+ gl_Position = v_2.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_4.prevent_dce;
+ vertex_main_loc0_Output = v_2.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'scalar swizzle' : not supported with this profile: es
-ERROR: 0:17: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
index 102af37..4904267 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
@@ -2,17 +2,8 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -80,7 +71,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
@@ -128,17 +119,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -206,7 +188,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
@@ -255,17 +237,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
layout(location = 0) flat out vec4 prevent_dce_1;
@@ -330,7 +303,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.ir.glsl
index 3cc1b3a..8bdbbfa 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.ir.glsl
@@ -70,46 +70,43 @@
vec3 v_5 = abs(v);
vec3 v_6 = sign(v);
bvec3 v_7 = lessThan(v_5, v_4);
- vec3 v_8 = (v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E));
- float v_9 = ((v_7.x) ? ((v_6 * ((params.C * v_5) + params.F)).x) : (v_8.x));
- float v_10 = ((v_7.y) ? ((v_6 * ((params.C * v_5) + params.F)).y) : (v_8.y));
- return vec3(v_9, v_10, ((v_7.z) ? ((v_6 * ((params.C * v_5) + params.F)).z) : (v_8.z)));
+ return mix((v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E)), (v_6 * ((params.C * v_5) + params.F)), v_7);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_11 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_12 = uvec2(v_11);
- vec3 v_13 = vec3(0.0f);
- float v_14 = 0.0f;
+ vec2 v_8 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_9 = uvec2(v_8);
+ vec3 v_10 = vec3(0.0f);
+ float v_11 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_15 = ivec2(v_12);
- vec4 v_16 = texelFetch(plane_0, v_15, int(0u));
- v_13 = v_16.xyz;
- v_14 = v_16[3u];
+ ivec2 v_12 = ivec2(v_9);
+ vec4 v_13 = texelFetch(plane_0, v_12, int(0u));
+ v_10 = v_13.xyz;
+ v_11 = v_13[3u];
} else {
- ivec2 v_17 = ivec2(v_12);
- float v_18 = texelFetch(plane_0, v_17, int(0u))[0u];
- ivec2 v_19 = ivec2(uvec2((v_11 * params.plane1CoordFactor)));
- v_13 = (vec4(v_18, texelFetch(plane_1, v_19, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_14 = 1.0f;
+ ivec2 v_14 = ivec2(v_9);
+ float v_15 = texelFetch(plane_0, v_14, int(0u))[0u];
+ ivec2 v_16 = ivec2(uvec2((v_8 * params.plane1CoordFactor)));
+ v_10 = (vec4(v_15, texelFetch(plane_1, v_16, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_11 = 1.0f;
}
- vec3 v_20 = v_13;
- vec3 v_21 = vec3(0.0f);
+ vec3 v_17 = v_10;
+ vec3 v_18 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_21 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_20, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_18 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_17, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_21 = v_20;
+ v_18 = v_17;
}
- return vec4(v_21, v_14);
+ return vec4(v_18, v_11);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_22 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_23 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_22, v_23, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_19 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_20 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_19, v_20, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_1bfdfb() {
uvec2 arg_1 = uvec2(1u);
- tint_ExternalTextureParams v_24 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_24, arg_1);
+ tint_ExternalTextureParams v_21 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_21, arg_1);
return res;
}
void main() {
@@ -185,46 +182,43 @@
vec3 v_5 = abs(v);
vec3 v_6 = sign(v);
bvec3 v_7 = lessThan(v_5, v_4);
- vec3 v_8 = (v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E));
- float v_9 = ((v_7.x) ? ((v_6 * ((params.C * v_5) + params.F)).x) : (v_8.x));
- float v_10 = ((v_7.y) ? ((v_6 * ((params.C * v_5) + params.F)).y) : (v_8.y));
- return vec3(v_9, v_10, ((v_7.z) ? ((v_6 * ((params.C * v_5) + params.F)).z) : (v_8.z)));
+ return mix((v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E)), (v_6 * ((params.C * v_5) + params.F)), v_7);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_11 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_12 = uvec2(v_11);
- vec3 v_13 = vec3(0.0f);
- float v_14 = 0.0f;
+ vec2 v_8 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_9 = uvec2(v_8);
+ vec3 v_10 = vec3(0.0f);
+ float v_11 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_15 = ivec2(v_12);
- vec4 v_16 = texelFetch(plane_0, v_15, int(0u));
- v_13 = v_16.xyz;
- v_14 = v_16[3u];
+ ivec2 v_12 = ivec2(v_9);
+ vec4 v_13 = texelFetch(plane_0, v_12, int(0u));
+ v_10 = v_13.xyz;
+ v_11 = v_13[3u];
} else {
- ivec2 v_17 = ivec2(v_12);
- float v_18 = texelFetch(plane_0, v_17, int(0u))[0u];
- ivec2 v_19 = ivec2(uvec2((v_11 * params.plane1CoordFactor)));
- v_13 = (vec4(v_18, texelFetch(plane_1, v_19, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_14 = 1.0f;
+ ivec2 v_14 = ivec2(v_9);
+ float v_15 = texelFetch(plane_0, v_14, int(0u))[0u];
+ ivec2 v_16 = ivec2(uvec2((v_8 * params.plane1CoordFactor)));
+ v_10 = (vec4(v_15, texelFetch(plane_1, v_16, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_11 = 1.0f;
}
- vec3 v_20 = v_13;
- vec3 v_21 = vec3(0.0f);
+ vec3 v_17 = v_10;
+ vec3 v_18 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_21 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_20, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_18 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_17, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_21 = v_20;
+ v_18 = v_17;
}
- return vec4(v_21, v_14);
+ return vec4(v_18, v_11);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_22 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_23 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_22, v_23, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_19 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_20 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_19, v_20, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_1bfdfb() {
uvec2 arg_1 = uvec2(1u);
- tint_ExternalTextureParams v_24 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_24, arg_1);
+ tint_ExternalTextureParams v_21 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_21, arg_1);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -303,46 +297,43 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_1bfdfb() {
uvec2 arg_1 = uvec2(1u);
- tint_ExternalTextureParams v_23 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_23, arg_1);
+ tint_ExternalTextureParams v_20 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_20, arg_1);
return res;
}
VertexOutput vertex_main_inner() {
@@ -352,10 +343,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_24 = vertex_main_inner();
- gl_Position = v_24.pos;
+ VertexOutput v_21 = vertex_main_inner();
+ gl_Position = v_21.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_24.prevent_dce;
+ vertex_main_loc0_Output = v_21.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl
index 1617a2c..4edadc6 100644
--- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl
@@ -2,17 +2,8 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -80,7 +71,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
@@ -128,17 +119,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -206,7 +188,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
@@ -255,17 +237,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
layout(location = 0) flat out vec4 prevent_dce_1;
@@ -330,7 +303,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.ir.glsl
index 41b9538..7433cfd 100644
--- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.ir.glsl
@@ -70,46 +70,43 @@
vec3 v_5 = abs(v);
vec3 v_6 = sign(v);
bvec3 v_7 = lessThan(v_5, v_4);
- vec3 v_8 = (v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E));
- float v_9 = ((v_7.x) ? ((v_6 * ((params.C * v_5) + params.F)).x) : (v_8.x));
- float v_10 = ((v_7.y) ? ((v_6 * ((params.C * v_5) + params.F)).y) : (v_8.y));
- return vec3(v_9, v_10, ((v_7.z) ? ((v_6 * ((params.C * v_5) + params.F)).z) : (v_8.z)));
+ return mix((v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E)), (v_6 * ((params.C * v_5) + params.F)), v_7);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_11 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_12 = uvec2(v_11);
- vec3 v_13 = vec3(0.0f);
- float v_14 = 0.0f;
+ vec2 v_8 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_9 = uvec2(v_8);
+ vec3 v_10 = vec3(0.0f);
+ float v_11 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_15 = ivec2(v_12);
- vec4 v_16 = texelFetch(plane_0, v_15, int(0u));
- v_13 = v_16.xyz;
- v_14 = v_16[3u];
+ ivec2 v_12 = ivec2(v_9);
+ vec4 v_13 = texelFetch(plane_0, v_12, int(0u));
+ v_10 = v_13.xyz;
+ v_11 = v_13[3u];
} else {
- ivec2 v_17 = ivec2(v_12);
- float v_18 = texelFetch(plane_0, v_17, int(0u))[0u];
- ivec2 v_19 = ivec2(uvec2((v_11 * params.plane1CoordFactor)));
- v_13 = (vec4(v_18, texelFetch(plane_1, v_19, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_14 = 1.0f;
+ ivec2 v_14 = ivec2(v_9);
+ float v_15 = texelFetch(plane_0, v_14, int(0u))[0u];
+ ivec2 v_16 = ivec2(uvec2((v_8 * params.plane1CoordFactor)));
+ v_10 = (vec4(v_15, texelFetch(plane_1, v_16, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_11 = 1.0f;
}
- vec3 v_20 = v_13;
- vec3 v_21 = vec3(0.0f);
+ vec3 v_17 = v_10;
+ vec3 v_18 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_21 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_20, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_18 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_17, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_21 = v_20;
+ v_18 = v_17;
}
- return vec4(v_21, v_14);
+ return vec4(v_18, v_11);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_22 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_23 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_22, v_23, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_19 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_20 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_19, v_20, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_8acf41() {
ivec2 arg_1 = ivec2(1);
- tint_ExternalTextureParams v_24 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_24, uvec2(arg_1));
+ tint_ExternalTextureParams v_21 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_21, uvec2(arg_1));
return res;
}
void main() {
@@ -185,46 +182,43 @@
vec3 v_5 = abs(v);
vec3 v_6 = sign(v);
bvec3 v_7 = lessThan(v_5, v_4);
- vec3 v_8 = (v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E));
- float v_9 = ((v_7.x) ? ((v_6 * ((params.C * v_5) + params.F)).x) : (v_8.x));
- float v_10 = ((v_7.y) ? ((v_6 * ((params.C * v_5) + params.F)).y) : (v_8.y));
- return vec3(v_9, v_10, ((v_7.z) ? ((v_6 * ((params.C * v_5) + params.F)).z) : (v_8.z)));
+ return mix((v_6 * (pow(((params.A * v_5) + params.B), v_3) + params.E)), (v_6 * ((params.C * v_5) + params.F)), v_7);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_11 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_12 = uvec2(v_11);
- vec3 v_13 = vec3(0.0f);
- float v_14 = 0.0f;
+ vec2 v_8 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_9 = uvec2(v_8);
+ vec3 v_10 = vec3(0.0f);
+ float v_11 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_15 = ivec2(v_12);
- vec4 v_16 = texelFetch(plane_0, v_15, int(0u));
- v_13 = v_16.xyz;
- v_14 = v_16[3u];
+ ivec2 v_12 = ivec2(v_9);
+ vec4 v_13 = texelFetch(plane_0, v_12, int(0u));
+ v_10 = v_13.xyz;
+ v_11 = v_13[3u];
} else {
- ivec2 v_17 = ivec2(v_12);
- float v_18 = texelFetch(plane_0, v_17, int(0u))[0u];
- ivec2 v_19 = ivec2(uvec2((v_11 * params.plane1CoordFactor)));
- v_13 = (vec4(v_18, texelFetch(plane_1, v_19, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_14 = 1.0f;
+ ivec2 v_14 = ivec2(v_9);
+ float v_15 = texelFetch(plane_0, v_14, int(0u))[0u];
+ ivec2 v_16 = ivec2(uvec2((v_8 * params.plane1CoordFactor)));
+ v_10 = (vec4(v_15, texelFetch(plane_1, v_16, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_11 = 1.0f;
}
- vec3 v_20 = v_13;
- vec3 v_21 = vec3(0.0f);
+ vec3 v_17 = v_10;
+ vec3 v_18 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_21 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_20, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_18 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_17, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_21 = v_20;
+ v_18 = v_17;
}
- return vec4(v_21, v_14);
+ return vec4(v_18, v_11);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_22 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_23 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_22, v_23, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_19 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_20 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_19, v_20, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_8acf41() {
ivec2 arg_1 = ivec2(1);
- tint_ExternalTextureParams v_24 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_24, uvec2(arg_1));
+ tint_ExternalTextureParams v_21 = tint_convert_tint_ExternalTextureParams(v_2.tint_symbol_2);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_21, uvec2(arg_1));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -303,46 +297,43 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
vec4 textureLoad_8acf41() {
ivec2 arg_1 = ivec2(1);
- tint_ExternalTextureParams v_23 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
- vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_23, uvec2(arg_1));
+ tint_ExternalTextureParams v_20 = tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1);
+ vec4 res = tint_TextureLoadExternal(arg_0_plane0, arg_0_plane1, v_20, uvec2(arg_1));
return res;
}
VertexOutput vertex_main_inner() {
@@ -352,10 +343,10 @@
return tint_symbol;
}
void main() {
- VertexOutput v_24 = vertex_main_inner();
- gl_Position = v_24.pos;
+ VertexOutput v_21 = vertex_main_inner();
+ gl_Position = v_21.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
- vertex_main_loc0_Output = v_24.prevent_dce;
+ vertex_main_loc0_Output = v_21.prevent_dce;
gl_PointSize = 1.0f;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
index 422c1cf..2936b18 100644
--- a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
@@ -2,11 +2,6 @@
precision highp float;
precision highp int;
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
struct GammaTransferParams {
float G;
float A;
@@ -72,7 +67,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select(f, t, cond);
+ return mix(f, t, cond);
}
@@ -121,11 +116,6 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
struct GammaTransferParams {
float G;
float A;
@@ -191,7 +181,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select(f, t, cond);
+ return mix(f, t, cond);
}
@@ -241,11 +231,6 @@
}
#version 310 es
-vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(location = 0) flat out vec4 prevent_dce_1;
struct GammaTransferParams {
float G;
@@ -308,7 +293,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select(f, t, cond);
+ return mix(f, t, cond);
}
diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl
index ed22528..9f97171 100644
--- a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_06794e() {
f16mat3 arg_0 = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_06794e() {
f16mat3 arg_0 = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_06794e() {
f16mat3 arg_0 = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.ir.glsl
index 6c23f3b..59af010 100644
--- a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_06794e() {
f16mat3 arg_0 = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_06794e();
@@ -25,7 +25,7 @@
int transpose_06794e() {
f16mat3 arg_0 = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_06794e() {
f16mat3 arg_0 = f16mat3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl
index 7d1700b..c93107e 100644
--- a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_2585cd() {
mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_2585cd() {
mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_2585cd() {
mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.ir.glsl
index bd4b4c7..b146fe2 100644
--- a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_2585cd() {
mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3x4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_2585cd();
@@ -23,7 +23,7 @@
int transpose_2585cd() {
mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3x4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_2585cd() {
mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3x4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl
index f4a82db..baad73c 100644
--- a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_31d679() {
mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f));
mat2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_31d679() {
mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f));
mat2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_31d679() {
mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f));
mat2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.ir.glsl
index 1ad78d2..932738b 100644
--- a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_31d679() {
mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f));
mat2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_31d679();
@@ -23,7 +23,7 @@
int transpose_31d679() {
mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f));
mat2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_31d679() {
mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f));
mat2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl
index dcd7ff8..eb44498 100644
--- a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_31e37e() {
mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_31e37e() {
mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_31e37e() {
mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.ir.glsl
index aeebcdd..48ad846 100644
--- a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_31e37e() {
mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_31e37e();
@@ -23,7 +23,7 @@
int transpose_31e37e() {
mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_31e37e() {
mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl
index dd8f925..e64c8ff 100644
--- a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_4ce359() {
mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f));
mat4x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_4ce359() {
mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f));
mat4x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_4ce359() {
mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f));
mat4x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.ir.glsl
index 47e8c70..1914a5a 100644
--- a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_4ce359() {
mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f));
mat4x2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_4ce359();
@@ -23,7 +23,7 @@
int transpose_4ce359() {
mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f));
mat4x2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_4ce359() {
mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f));
mat4x2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl
index 2158984..9efc984 100644
--- a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_4dc9a1() {
mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f));
mat3x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_4dc9a1() {
mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f));
mat3x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_4dc9a1() {
mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f));
mat3x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.ir.glsl
index 39225cc..f0d71f0 100644
--- a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_4dc9a1() {
mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f));
mat3x2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_4dc9a1();
@@ -23,7 +23,7 @@
int transpose_4dc9a1() {
mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f));
mat3x2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_4dc9a1() {
mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f));
mat3x2 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl
index 6e0db11..4e0f94c 100644
--- a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_5edd96() {
f16mat4x2 arg_0 = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_5edd96() {
f16mat4x2 arg_0 = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_5edd96() {
f16mat4x2 arg_0 = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.ir.glsl
index 6bbaf5d..e5cc0e0 100644
--- a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_5edd96() {
f16mat4x2 arg_0 = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_5edd96();
@@ -25,7 +25,7 @@
int transpose_5edd96() {
f16mat4x2 arg_0 = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_5edd96() {
f16mat4x2 arg_0 = f16mat4x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl
index 21073b7..53de525 100644
--- a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_5f36bf() {
f16mat4x3 arg_0 = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_5f36bf() {
f16mat4x3 arg_0 = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_5f36bf() {
f16mat4x3 arg_0 = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.ir.glsl
index 3977953..264d393 100644
--- a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_5f36bf() {
f16mat4x3 arg_0 = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_5f36bf();
@@ -25,7 +25,7 @@
int transpose_5f36bf() {
f16mat4x3 arg_0 = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_5f36bf() {
f16mat4x3 arg_0 = f16mat4x3(f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl
index 57da1ec..888cd29 100644
--- a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_7be8b2() {
f16mat2 arg_0 = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_7be8b2() {
f16mat2 arg_0 = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_7be8b2() {
f16mat2 arg_0 = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.ir.glsl
index 7259fdb..bdb27c3 100644
--- a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_7be8b2() {
f16mat2 arg_0 = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_7be8b2();
@@ -25,7 +25,7 @@
int transpose_7be8b2() {
f16mat2 arg_0 = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_7be8b2() {
f16mat2 arg_0 = f16mat2(f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl
index 60c6652..68b6ab2 100644
--- a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_844869() {
f16mat4 arg_0 = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_844869() {
f16mat4 arg_0 = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_844869() {
f16mat4 arg_0 = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.ir.glsl
index e4e321e..c1c407f 100644
--- a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_844869() {
f16mat4 arg_0 = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_844869();
@@ -25,7 +25,7 @@
int transpose_844869() {
f16mat4 arg_0 = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_844869() {
f16mat4 arg_0 = f16mat4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl
index be74ee7..03cdbcb 100644
--- a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_854336() {
mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_854336() {
mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_854336() {
mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.ir.glsl
index f875a00..159903d 100644
--- a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_854336() {
mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_854336();
@@ -23,7 +23,7 @@
int transpose_854336() {
mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_854336() {
mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
mat3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl
index 262e417..795794e 100644
--- a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_8c06ce() {
f16mat3x4 arg_0 = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_8c06ce() {
f16mat3x4 arg_0 = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_8c06ce() {
f16mat3x4 arg_0 = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.ir.glsl
index 21b9bf3..da3ed38 100644
--- a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_8c06ce() {
f16mat3x4 arg_0 = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_8c06ce();
@@ -25,7 +25,7 @@
int transpose_8c06ce() {
f16mat3x4 arg_0 = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_8c06ce() {
f16mat3x4 arg_0 = f16mat3x4(f16vec4(1.0hf), f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl
index 4232093..4a549ca 100644
--- a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_b9ad1f() {
f16mat3x2 arg_0 = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_b9ad1f() {
f16mat3x2 arg_0 = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_b9ad1f() {
f16mat3x2 arg_0 = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.ir.glsl
index aa77de2..f3cf87f 100644
--- a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_b9ad1f() {
f16mat3x2 arg_0 = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_b9ad1f();
@@ -25,7 +25,7 @@
int transpose_b9ad1f() {
f16mat3x2 arg_0 = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_b9ad1f() {
f16mat3x2 arg_0 = f16mat3x2(f16vec2(1.0hf), f16vec2(1.0hf), f16vec2(1.0hf));
f16mat2x3 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl
index feb1e8b..ec87f34 100644
--- a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_c1b600() {
mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_c1b600() {
mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_c1b600() {
mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.ir.glsl
index 0116d8e..61f815e 100644
--- a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_c1b600() {
mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_c1b600();
@@ -23,7 +23,7 @@
int transpose_c1b600() {
mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_c1b600() {
mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl
index 401b49f..d025760 100644
--- a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_d6faec() {
f16mat2x3 arg_0 = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_d6faec() {
f16mat2x3 arg_0 = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_d6faec() {
f16mat2x3 arg_0 = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.ir.glsl
index 2f56718..cdc5c76c 100644
--- a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_d6faec() {
f16mat2x3 arg_0 = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_d6faec();
@@ -25,7 +25,7 @@
int transpose_d6faec() {
f16mat2x3 arg_0 = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_d6faec() {
f16mat2x3 arg_0 = f16mat2x3(f16vec3(1.0hf), f16vec3(1.0hf));
f16mat3x2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl
index 0730dbf..bd45945 100644
--- a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_d8f8ba() {
mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_d8f8ba() {
mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_d8f8ba() {
mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.ir.glsl
index 32d6b93..9e7512d 100644
--- a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_d8f8ba() {
mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4x3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_d8f8ba();
@@ -23,7 +23,7 @@
int transpose_d8f8ba() {
mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4x3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_d8f8ba() {
mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f));
mat4x3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl
index 25c439c..20bed7b 100644
--- a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl
@@ -9,7 +9,7 @@
int transpose_ed4bdc() {
mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -34,7 +34,7 @@
int transpose_ed4bdc() {
mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
@@ -57,7 +57,7 @@
int transpose_ed4bdc() {
mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x3 res = transpose(arg_0);
- return ((res[0][0] == 0.0f) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0f));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.ir.glsl
index 17ad05b..be68234 100644
--- a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.ir.glsl
@@ -9,7 +9,7 @@
int transpose_ed4bdc() {
mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
void main() {
v.tint_symbol = transpose_ed4bdc();
@@ -23,7 +23,7 @@
int transpose_ed4bdc() {
mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -41,7 +41,7 @@
int transpose_ed4bdc() {
mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f));
mat2x3 res = transpose(arg_0);
- return (((res[0].x == 0.0f)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0f));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl
index 13b96d8..ca64da9 100644
--- a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl
@@ -10,7 +10,7 @@
int transpose_faeb05() {
f16mat2x4 arg_0 = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -36,7 +36,7 @@
int transpose_faeb05() {
f16mat2x4 arg_0 = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
@@ -60,7 +60,7 @@
int transpose_faeb05() {
f16mat2x4 arg_0 = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x2 res = transpose(arg_0);
- return ((res[0][0] == 0.0hf) ? 1 : 0);
+ return mix(0, 1, (res[0][0] == 0.0hf));
}
struct VertexOutput {
diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.ir.glsl
index c83efdc..7f8183c 100644
--- a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.ir.glsl
@@ -10,7 +10,7 @@
int transpose_faeb05() {
f16mat2x4 arg_0 = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
void main() {
v.tint_symbol = transpose_faeb05();
@@ -25,7 +25,7 @@
int transpose_faeb05() {
f16mat2x4 arg_0 = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
@@ -44,7 +44,7 @@
int transpose_faeb05() {
f16mat2x4 arg_0 = f16mat2x4(f16vec4(1.0hf), f16vec4(1.0hf));
f16mat4x2 res = transpose(arg_0);
- return (((res[0].x == 0.0hf)) ? (1) : (0));
+ return mix(0, 1, (res[0].x == 0.0hf));
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0);
diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl
index 4e3a06a..e380de1 100644
--- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl
+++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl
@@ -1,16 +1,7 @@
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -74,7 +65,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
@@ -126,17 +117,8 @@
precision highp float;
precision highp int;
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -200,7 +182,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
@@ -245,17 +227,8 @@
}
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-vec3 tint_select_1(vec3 param_0, vec3 param_1, bvec3 param_2) {
- return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
struct GammaTransferParams {
@@ -319,7 +292,7 @@
bvec3 cond = lessThan(abs(v), vec3(params.D));
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
- return tint_select_1(f, t, cond);
+ return mix(f, t, cond);
}
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.ir.glsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.ir.glsl
index 02117ab..146848f 100644
--- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.ir.glsl
@@ -64,44 +64,41 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
vec4 textureLoad2d(highp sampler2D tint_symbol_plane0, highp sampler2D tint_symbol_plane1, tint_ExternalTextureParams tint_symbol_params, ivec2 coords) {
return tint_TextureLoadExternal(tint_symbol_plane0, tint_symbol_plane1, tint_symbol_params, uvec2(coords));
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
void doTextureLoad() {
vec4 res = textureLoad2d(arg_0_plane0, arg_0_plane1, tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1), ivec2(0));
@@ -184,44 +181,41 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
vec4 textureLoad2d(highp sampler2D tint_symbol_plane0, highp sampler2D tint_symbol_plane1, tint_ExternalTextureParams tint_symbol_params, ivec2 coords) {
return tint_TextureLoadExternal(tint_symbol_plane0, tint_symbol_plane1, tint_symbol_params, uvec2(coords));
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
void doTextureLoad() {
vec4 res = textureLoad2d(arg_0_plane0, arg_0_plane1, tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1), ivec2(0));
@@ -295,44 +289,41 @@
vec3 v_4 = abs(v);
vec3 v_5 = sign(v);
bvec3 v_6 = lessThan(v_4, v_3);
- vec3 v_7 = (v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E));
- float v_8 = ((v_6.x) ? ((v_5 * ((params.C * v_4) + params.F)).x) : (v_7.x));
- float v_9 = ((v_6.y) ? ((v_5 * ((params.C * v_4) + params.F)).y) : (v_7.y));
- return vec3(v_8, v_9, ((v_6.z) ? ((v_5 * ((params.C * v_4) + params.F)).z) : (v_7.z)));
+ return mix((v_5 * (pow(((params.A * v_4) + params.B), v_2) + params.E)), (v_5 * ((params.C * v_4) + params.F)), v_6);
}
vec4 tint_TextureLoadExternal(highp sampler2D plane_0, highp sampler2D plane_1, tint_ExternalTextureParams params, uvec2 coords) {
- vec2 v_10 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
- uvec2 v_11 = uvec2(v_10);
- vec3 v_12 = vec3(0.0f);
- float v_13 = 0.0f;
+ vec2 v_7 = round((params.loadTransform * vec3(vec2(min(coords, params.visibleSize)), 1.0f)));
+ uvec2 v_8 = uvec2(v_7);
+ vec3 v_9 = vec3(0.0f);
+ float v_10 = 0.0f;
if ((params.numPlanes == 1u)) {
- ivec2 v_14 = ivec2(v_11);
- vec4 v_15 = texelFetch(plane_0, v_14, int(0u));
- v_12 = v_15.xyz;
- v_13 = v_15[3u];
+ ivec2 v_11 = ivec2(v_8);
+ vec4 v_12 = texelFetch(plane_0, v_11, int(0u));
+ v_9 = v_12.xyz;
+ v_10 = v_12[3u];
} else {
- ivec2 v_16 = ivec2(v_11);
- float v_17 = texelFetch(plane_0, v_16, int(0u))[0u];
- ivec2 v_18 = ivec2(uvec2((v_10 * params.plane1CoordFactor)));
- v_12 = (vec4(v_17, texelFetch(plane_1, v_18, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
- v_13 = 1.0f;
+ ivec2 v_13 = ivec2(v_8);
+ float v_14 = texelFetch(plane_0, v_13, int(0u))[0u];
+ ivec2 v_15 = ivec2(uvec2((v_7 * params.plane1CoordFactor)));
+ v_9 = (vec4(v_14, texelFetch(plane_1, v_15, int(0u)).xy, 1.0f) * params.yuvToRgbConversionMatrix);
+ v_10 = 1.0f;
}
- vec3 v_19 = v_12;
- vec3 v_20 = vec3(0.0f);
+ vec3 v_16 = v_9;
+ vec3 v_17 = vec3(0.0f);
if ((params.doYuvToRgbConversionOnly == 0u)) {
- v_20 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_19, params.gammaDecodeParams)), params.gammaEncodeParams);
+ v_17 = tint_GammaCorrection((params.gamutConversionMatrix * tint_GammaCorrection(v_16, params.gammaDecodeParams)), params.gammaEncodeParams);
} else {
- v_20 = v_19;
+ v_17 = v_16;
}
- return vec4(v_20, v_13);
+ return vec4(v_17, v_10);
}
vec4 textureLoad2d(highp sampler2D tint_symbol_plane0, highp sampler2D tint_symbol_plane1, tint_ExternalTextureParams tint_symbol_params, ivec2 coords) {
return tint_TextureLoadExternal(tint_symbol_plane0, tint_symbol_plane1, tint_symbol_params, uvec2(coords));
}
tint_ExternalTextureParams tint_convert_tint_ExternalTextureParams(tint_ExternalTextureParams_std140 tint_input) {
- mat3 v_21 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
- mat3x2 v_22 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
- return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_21, v_22, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
+ mat3 v_18 = mat3(tint_input.gamutConversionMatrix_col0, tint_input.gamutConversionMatrix_col1, tint_input.gamutConversionMatrix_col2);
+ mat3x2 v_19 = mat3x2(tint_input.sampleTransform_col0, tint_input.sampleTransform_col1, tint_input.sampleTransform_col2);
+ return tint_ExternalTextureParams(tint_input.numPlanes, tint_input.doYuvToRgbConversionOnly, tint_input.yuvToRgbConversionMatrix, tint_input.gammaDecodeParams, tint_input.gammaEncodeParams, v_18, v_19, mat3x2(tint_input.loadTransform_col0, tint_input.loadTransform_col1, tint_input.loadTransform_col2), tint_input.samplePlane0RectMin, tint_input.samplePlane0RectMax, tint_input.samplePlane1RectMin, tint_input.samplePlane1RectMax, tint_input.visibleSize, tint_input.plane1CoordFactor);
}
void doTextureLoad() {
vec4 res = textureLoad2d(arg_0_plane0, arg_0_plane1, tint_convert_tint_ExternalTextureParams(v_1.tint_symbol_1), ivec2(0));
diff --git a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.glsl
index 9270052..c9a6a79 100644
--- a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.glsl
@@ -15,7 +15,7 @@
precision highp int;
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
layout(location = 0) in float x_1;
diff --git a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.glsl
index 20a9e00..18fc2e7 100644
--- a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.glsl
@@ -15,7 +15,7 @@
precision highp int;
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
layout(location = 0) in float x_1;
diff --git a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.glsl
index b5953ec..a8e088e 100644
--- a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.glsl
@@ -15,7 +15,7 @@
precision highp int;
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
layout(location = 0) in float x_1;
diff --git a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.ir.glsl b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.ir.glsl
index b93577c..0a6ae98 100644
--- a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.ir.glsl
+++ b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.ir.glsl
@@ -16,7 +16,7 @@
layout(location = 0) in float tint_symbol_loc0_Input;
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void tint_symbol_inner(float x) {
switch(tint_f32_to_i32(x)) {
diff --git a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.glsl
index 4b0eef2..5f63612 100644
--- a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.ir.glsl
index 4d60fa4..26a7907 100644
--- a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- return (lhs / ((bool((v_2 | uint(v_1)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_2 | uint(v_1)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.glsl
index e3a6918..d5caa2c 100644
--- a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
void f() {
diff --git a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.ir.glsl
index 8cb521d..55da33f 100644
--- a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_div_u32(uint lhs, uint rhs) {
- return (lhs / (((rhs == 0u)) ? (1u) : (rhs)));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.glsl
index 4f71f45..a136f22 100644
--- a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(int lhs, ivec3 rhs) {
ivec3 l = ivec3(lhs);
- return (l / tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
+ return (l / mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.ir.glsl
index 81e9403..d0e4b40 100644
--- a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.ir.glsl
@@ -7,10 +7,7 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.glsl
index c43c106..39dc7a7 100644
--- a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uint lhs, uvec3 rhs) {
uvec3 l = uvec3(lhs);
- return (l / tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (l / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.ir.glsl
index 232d603..45e04da 100644
--- a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.ir.glsl
@@ -1,10 +1,7 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.glsl
index 4e3c8d5..d2b60b8 100644
--- a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(ivec3 lhs, int rhs) {
ivec3 r = ivec3(rhs);
- return (lhs / tint_select(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1))))))));
+ return (lhs / mix(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.ir.glsl
index 93c08a0..9e76e23 100644
--- a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.ir.glsl
@@ -7,10 +7,7 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.glsl
index 7b04561..a648733 100644
--- a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uvec3 lhs, uint rhs) {
uvec3 r = uvec3(rhs);
- return (lhs / tint_select(r, uvec3(1u), equal(r, uvec3(0u))));
+ return (lhs / mix(r, uvec3(1u), equal(r, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.ir.glsl
index e2620e5..0915a11 100644
--- a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.ir.glsl
@@ -1,10 +1,7 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.glsl
index dc0f396..ce3f657 100644
--- a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(ivec3 lhs, ivec3 rhs) {
- return (lhs / tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
+ return (lhs / mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.ir.glsl
index c26e361..ffa17bd 100644
--- a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.ir.glsl
@@ -7,10 +7,7 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.glsl
index c955489..8320c3f 100644
--- a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uvec3 lhs, uvec3 rhs) {
- return (lhs / tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.ir.glsl
index 5834f9f..e572eb1 100644
--- a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.ir.glsl
@@ -1,10 +1,7 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.glsl
index aac1597..3d4afc5 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.ir.glsl
index f93576f..1a60513 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- return (lhs / ((bool((v_2 | uint(v_1)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_2 | uint(v_1)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.glsl
index 30a1f0c..4bc44ac 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.ir.glsl
index ae9e046..8be2b61 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_div_u32(uint lhs, uint rhs) {
- return (lhs / (((rhs == 0u)) ? (1u) : (rhs)));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.glsl
index 389f189..cd04914 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(int lhs, ivec3 rhs) {
ivec3 l = ivec3(lhs);
- return (l / tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
+ return (l / mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.ir.glsl
index 07d6b7d..9396632 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.ir.glsl
@@ -7,10 +7,7 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.glsl
index b9caa15..50ab5b3 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uint lhs, uvec3 rhs) {
uvec3 l = uvec3(lhs);
- return (l / tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (l / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.ir.glsl
index 95151a7..baef491 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.ir.glsl
@@ -1,10 +1,7 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.glsl
index e4741ab..4afe949 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(ivec3 lhs, int rhs) {
ivec3 r = ivec3(rhs);
- return (lhs / tint_select(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1))))))));
+ return (lhs / mix(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.ir.glsl
index cb414e6..6254c79 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.ir.glsl
@@ -7,10 +7,7 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.glsl
index 3242245..926d784 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uvec3 lhs, uint rhs) {
uvec3 r = uvec3(rhs);
- return (lhs / tint_select(r, uvec3(1u), equal(r, uvec3(0u))));
+ return (lhs / mix(r, uvec3(1u), equal(r, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.ir.glsl
index c19e2d8..5609115 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.ir.glsl
@@ -1,10 +1,7 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.glsl
index 63d26f1..1e37826 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(ivec3 lhs, ivec3 rhs) {
- return (lhs / tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
+ return (lhs / mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.ir.glsl
index a0942b0..c2f75b1 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.ir.glsl
@@ -7,10 +7,7 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.glsl
index 4390696..000bf89 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uvec3 lhs, uvec3 rhs) {
- return (lhs / tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.ir.glsl
index e79e505..e7cd9da 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.ir.glsl
@@ -1,10 +1,7 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.glsl
index b4550b4..86d389c 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.ir.glsl
index 5491c54..f6dfde1 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- return (lhs / ((bool((v_2 | uint(v_1)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_2 | uint(v_1)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.glsl
index cf9e739..c7559ff 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.ir.glsl
index 2904e8a..7d9d6b4 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_div_u32(uint lhs, uint rhs) {
- return (lhs / (((rhs == 0u)) ? (1u) : (rhs)));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.glsl
index c77f6f4..54021cd 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(int lhs, ivec3 rhs) {
ivec3 l = ivec3(lhs);
- return (l / tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
+ return (l / mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.ir.glsl
index c951b16..2f64a9a 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.ir.glsl
@@ -7,15 +7,12 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
int a = 4;
ivec3 b = ivec3(0, 2, 0);
- ivec3 v_9 = (b + b);
- ivec3 r = tint_div_v3i32(ivec3(a), v_9);
+ ivec3 v_6 = (b + b);
+ ivec3 r = tint_div_v3i32(ivec3(a), v_6);
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.glsl
index 22f1020..187744b 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uint lhs, uvec3 rhs) {
uvec3 l = uvec3(lhs);
- return (l / tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (l / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.ir.glsl
index a2f6fda..f01a918 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.ir.glsl
@@ -1,15 +1,12 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
uint a = 4u;
uvec3 b = uvec3(0u, 2u, 0u);
- uvec3 v_3 = (b + b);
- uvec3 r = tint_div_v3u32(uvec3(a), v_3);
+ uvec3 v = (b + b);
+ uvec3 r = tint_div_v3u32(uvec3(a), v);
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.glsl
index cb85264..de877e2 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(ivec3 lhs, int rhs) {
ivec3 r = ivec3(rhs);
- return (lhs / tint_select(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1))))))));
+ return (lhs / mix(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.ir.glsl
index 1acce3f..8f2b359 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.ir.glsl
@@ -7,15 +7,12 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
ivec3 a = ivec3(1, 2, 3);
int b = 0;
- ivec3 v_9 = a;
- ivec3 r = tint_div_v3i32(v_9, ivec3((b + b)));
+ ivec3 v_6 = a;
+ ivec3 r = tint_div_v3i32(v_6, ivec3((b + b)));
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.glsl
index b54020f..4f7e3f3 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uvec3 lhs, uint rhs) {
uvec3 r = uvec3(rhs);
- return (lhs / tint_select(r, uvec3(1u), equal(r, uvec3(0u))));
+ return (lhs / mix(r, uvec3(1u), equal(r, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.ir.glsl
index 6113a08..d28729f 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.ir.glsl
@@ -1,15 +1,12 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
uvec3 a = uvec3(1u, 2u, 3u);
uint b = 0u;
- uvec3 v_3 = a;
- uvec3 r = tint_div_v3u32(v_3, uvec3((b + b)));
+ uvec3 v = a;
+ uvec3 r = tint_div_v3u32(v, uvec3((b + b)));
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.glsl
index 105f8f4..d6cb57e 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(ivec3 lhs, ivec3 rhs) {
- return (lhs / tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
+ return (lhs / mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.ir.glsl
index 37cfde7..32fa59e 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.ir.glsl
@@ -7,10 +7,7 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.glsl
index 7485252..22846e6 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uvec3 lhs, uvec3 rhs) {
- return (lhs / tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.ir.glsl
index 52d60a7..0e29de4 100644
--- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.ir.glsl
@@ -1,10 +1,7 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.glsl
index aac1597..3d4afc5 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.ir.glsl
index f93576f..1a60513 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- return (lhs / ((bool((v_2 | uint(v_1)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_2 | uint(v_1)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.glsl
index 30a1f0c..4bc44ac 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.ir.glsl
index ae9e046..8be2b61 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_div_u32(uint lhs, uint rhs) {
- return (lhs / (((rhs == 0u)) ? (1u) : (rhs)));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.glsl
index 389f189..cd04914 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(int lhs, ivec3 rhs) {
ivec3 l = ivec3(lhs);
- return (l / tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
+ return (l / mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.ir.glsl
index ab73f63..fb95fe6 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.ir.glsl
@@ -7,15 +7,12 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
int a = 4;
ivec3 b = ivec3(0, 2, 0);
- ivec3 v_9 = b;
- ivec3 r = tint_div_v3i32(ivec3(a), v_9);
+ ivec3 v_6 = b;
+ ivec3 r = tint_div_v3i32(ivec3(a), v_6);
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.glsl
index b9caa15..50ab5b3 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uint lhs, uvec3 rhs) {
uvec3 l = uvec3(lhs);
- return (l / tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (l / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.ir.glsl
index 1af11f3..c198446 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.ir.glsl
@@ -1,15 +1,12 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
uint a = 4u;
uvec3 b = uvec3(0u, 2u, 0u);
- uvec3 v_3 = b;
- uvec3 r = tint_div_v3u32(uvec3(a), v_3);
+ uvec3 v = b;
+ uvec3 r = tint_div_v3u32(uvec3(a), v);
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.glsl
index e4741ab..4afe949 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(ivec3 lhs, int rhs) {
ivec3 r = ivec3(rhs);
- return (lhs / tint_select(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1))))))));
+ return (lhs / mix(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.ir.glsl
index d691ca6..73bbb0b 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.ir.glsl
@@ -7,15 +7,12 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
ivec3 a = ivec3(1, 2, 3);
int b = 0;
- ivec3 v_9 = a;
- ivec3 r = tint_div_v3i32(v_9, ivec3(b));
+ ivec3 v_6 = a;
+ ivec3 r = tint_div_v3i32(v_6, ivec3(b));
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.glsl
index 3242245..926d784 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uvec3 lhs, uint rhs) {
uvec3 r = uvec3(rhs);
- return (lhs / tint_select(r, uvec3(1u), equal(r, uvec3(0u))));
+ return (lhs / mix(r, uvec3(1u), equal(r, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.ir.glsl
index 9b2656b..379f843 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.ir.glsl
@@ -1,15 +1,12 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
uvec3 a = uvec3(1u, 2u, 3u);
uint b = 0u;
- uvec3 v_3 = a;
- uvec3 r = tint_div_v3u32(v_3, uvec3(b));
+ uvec3 v = a;
+ uvec3 r = tint_div_v3u32(v, uvec3(b));
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.glsl
index 63d26f1..1e37826 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_div(ivec3 lhs, ivec3 rhs) {
- return (lhs / tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
+ return (lhs / mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1))))))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.ir.glsl
index a0942b0..c2f75b1 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.ir.glsl
@@ -7,10 +7,7 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- return (lhs / ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z))));
+ return (lhs / mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4)))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.glsl
index 4390696..000bf89 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_div(uvec3 lhs, uvec3 rhs) {
- return (lhs / tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.ir.glsl
index e79e505..e7cd9da 100644
--- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.ir.glsl
@@ -1,10 +1,7 @@
#version 310 es
uvec3 tint_div_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- return (lhs / uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z))));
+ return (lhs / mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.glsl
index da05027..4bd18e9 100644
--- a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_mod(int lhs, int rhs) {
- int rhs_or_one = (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs);
+ int rhs_or_one = mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))));
if (((uint((lhs | rhs_or_one)) & 2147483648u) != 0u)) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.ir.glsl
index 46b9ccc..c70ad4a 100644
--- a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- int v_3 = ((bool((v_2 | uint(v_1)))) ? (1) : (rhs));
+ int v_3 = mix(rhs, 1, bool((v_2 | uint(v_1))));
return (lhs - ((lhs / v_3) * v_3));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.glsl
index 920fd38..8bceb87 100644
--- a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
void f() {
diff --git a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.ir.glsl
index 4bf3656..77e1eaf 100644
--- a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod_u32(uint lhs, uint rhs) {
- uint v = (((rhs == 0u)) ? (1u) : (rhs));
+ uint v = mix(rhs, 1u, (rhs == 0u));
return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.glsl
index 2745da5..28b2b1c 100644
--- a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(int lhs, ivec3 rhs) {
ivec3 l = ivec3(lhs);
- ivec3 rhs_or_one = tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
if (any(notEqual((uvec3((l | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (l - ((l / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.ir.glsl
index 5b15d31..ba8d945 100644
--- a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.ir.glsl
@@ -7,11 +7,8 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.glsl
index ca3eb40..f854088 100644
--- a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uint lhs, uvec3 rhs) {
uvec3 l = uvec3(lhs);
- return (l % tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (l % mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.ir.glsl
index ca3fc51..b42dbc6 100644
--- a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.ir.glsl
@@ -1,11 +1,8 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.glsl
index 20ac109..1178af2 100644
--- a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(ivec3 lhs, int rhs) {
ivec3 r = ivec3(rhs);
- ivec3 rhs_or_one = tint_select(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1)))))));
if (any(notEqual((uvec3((lhs | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.ir.glsl
index 38e65f0..fd63379 100644
--- a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.ir.glsl
@@ -7,11 +7,8 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.glsl
index f722a77..f751327 100644
--- a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uvec3 lhs, uint rhs) {
uvec3 r = uvec3(rhs);
- return (lhs % tint_select(r, uvec3(1u), equal(r, uvec3(0u))));
+ return (lhs % mix(r, uvec3(1u), equal(r, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.ir.glsl
index 54436c4..665d699 100644
--- a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.ir.glsl
@@ -1,11 +1,8 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.glsl
index 1cf4c8e..f1c30a0 100644
--- a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(ivec3 lhs, ivec3 rhs) {
- ivec3 rhs_or_one = tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
if (any(notEqual((uvec3((lhs | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.ir.glsl
index eb274ff..5710ecc 100644
--- a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.ir.glsl
@@ -7,11 +7,8 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.glsl
index 2449b84..78f3803 100644
--- a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uvec3 lhs, uvec3 rhs) {
- return (lhs % tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (lhs % mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.ir.glsl
index d306aa3..91eb4ca 100644
--- a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.ir.glsl
@@ -1,11 +1,8 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.glsl
index da82cf0..52a1007 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_mod(int lhs, int rhs) {
- int rhs_or_one = (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs);
+ int rhs_or_one = mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))));
if (((uint((lhs | rhs_or_one)) & 2147483648u) != 0u)) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.ir.glsl
index dac65a3..0277f57 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- int v_3 = ((bool((v_2 | uint(v_1)))) ? (1) : (rhs));
+ int v_3 = mix(rhs, 1, bool((v_2 | uint(v_1))));
return (lhs - ((lhs / v_3) * v_3));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.glsl
index 9fd11d7..d953107 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.ir.glsl
index 74b7d71..9359385 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod_u32(uint lhs, uint rhs) {
- uint v = (((rhs == 0u)) ? (1u) : (rhs));
+ uint v = mix(rhs, 1u, (rhs == 0u));
return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.glsl
index cdbec37..ef41fb8 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(int lhs, ivec3 rhs) {
ivec3 l = ivec3(lhs);
- ivec3 rhs_or_one = tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
if (any(notEqual((uvec3((l | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (l - ((l / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.ir.glsl
index 729dffa..7880479 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.ir.glsl
@@ -7,11 +7,8 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.glsl
index 2b82a77..534cab7 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uint lhs, uvec3 rhs) {
uvec3 l = uvec3(lhs);
- return (l % tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (l % mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.ir.glsl
index aa280d8..0d4c587 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.ir.glsl
@@ -1,11 +1,8 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.glsl
index 8d45e86..b1ddb82 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(ivec3 lhs, int rhs) {
ivec3 r = ivec3(rhs);
- ivec3 rhs_or_one = tint_select(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1)))))));
if (any(notEqual((uvec3((lhs | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.ir.glsl
index 8ce36c1..91a5159 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.ir.glsl
@@ -7,11 +7,8 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.glsl
index 82feba0..03f7867 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uvec3 lhs, uint rhs) {
uvec3 r = uvec3(rhs);
- return (lhs % tint_select(r, uvec3(1u), equal(r, uvec3(0u))));
+ return (lhs % mix(r, uvec3(1u), equal(r, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.ir.glsl
index cec1806..d83b80a 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.ir.glsl
@@ -1,11 +1,8 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.glsl
index b117147..fcb2b37 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(ivec3 lhs, ivec3 rhs) {
- ivec3 rhs_or_one = tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
if (any(notEqual((uvec3((lhs | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.ir.glsl
index 315a951..e49d863 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.ir.glsl
@@ -7,11 +7,8 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.glsl
index 361f7c2..e6cd33b 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uvec3 lhs, uvec3 rhs) {
- return (lhs % tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (lhs % mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.ir.glsl
index 52542e0..3d693fe 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.ir.glsl
@@ -1,11 +1,8 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.glsl
index 1ce033d..784e576 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_mod(int lhs, int rhs) {
- int rhs_or_one = (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs);
+ int rhs_or_one = mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))));
if (((uint((lhs | rhs_or_one)) & 2147483648u) != 0u)) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.ir.glsl
index 659be19..fb8206e 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- int v_3 = ((bool((v_2 | uint(v_1)))) ? (1) : (rhs));
+ int v_3 = mix(rhs, 1, bool((v_2 | uint(v_1))));
return (lhs - ((lhs / v_3) * v_3));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.glsl
index 23248d3..ed9b927 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.ir.glsl
index 999b739..00b046e 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod_u32(uint lhs, uint rhs) {
- uint v = (((rhs == 0u)) ? (1u) : (rhs));
+ uint v = mix(rhs, 1u, (rhs == 0u));
return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.glsl
index 255527a..b11b632 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(int lhs, ivec3 rhs) {
ivec3 l = ivec3(lhs);
- ivec3 rhs_or_one = tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
if (any(notEqual((uvec3((l | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (l - ((l / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.ir.glsl
index 6666420..75899ae 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.ir.glsl
@@ -7,16 +7,13 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
int a = 4;
ivec3 b = ivec3(0, 2, 0);
- ivec3 v_10 = (b + b);
- ivec3 r = tint_mod_v3i32(ivec3(a), v_10);
+ ivec3 v_7 = (b + b);
+ ivec3 r = tint_mod_v3i32(ivec3(a), v_7);
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.glsl
index 939452d..47e9d7e 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uint lhs, uvec3 rhs) {
uvec3 l = uvec3(lhs);
- return (l % tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (l % mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.ir.glsl
index 0235e9b..8f1b407 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.ir.glsl
@@ -1,16 +1,13 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
uint a = 4u;
uvec3 b = uvec3(0u, 2u, 0u);
- uvec3 v_4 = (b + b);
- uvec3 r = tint_mod_v3u32(uvec3(a), v_4);
+ uvec3 v_1 = (b + b);
+ uvec3 r = tint_mod_v3u32(uvec3(a), v_1);
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.glsl
index 1e741c4..405f426 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(ivec3 lhs, int rhs) {
ivec3 r = ivec3(rhs);
- ivec3 rhs_or_one = tint_select(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1)))))));
if (any(notEqual((uvec3((lhs | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.ir.glsl
index ca36e1a..a1e82ba 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.ir.glsl
@@ -7,16 +7,13 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
ivec3 a = ivec3(1, 2, 3);
int b = 0;
- ivec3 v_10 = a;
- ivec3 r = tint_mod_v3i32(v_10, ivec3((b + b)));
+ ivec3 v_7 = a;
+ ivec3 r = tint_mod_v3i32(v_7, ivec3((b + b)));
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.glsl
index c64f75e..82a5991 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uvec3 lhs, uint rhs) {
uvec3 r = uvec3(rhs);
- return (lhs % tint_select(r, uvec3(1u), equal(r, uvec3(0u))));
+ return (lhs % mix(r, uvec3(1u), equal(r, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.ir.glsl
index 4af0638..f3e20e9 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.ir.glsl
@@ -1,16 +1,13 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
uvec3 a = uvec3(1u, 2u, 3u);
uint b = 0u;
- uvec3 v_4 = a;
- uvec3 r = tint_mod_v3u32(v_4, uvec3((b + b)));
+ uvec3 v_1 = a;
+ uvec3 r = tint_mod_v3u32(v_1, uvec3((b + b)));
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.glsl
index c34f703..56a740d 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(ivec3 lhs, ivec3 rhs) {
- ivec3 rhs_or_one = tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
if (any(notEqual((uvec3((lhs | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.ir.glsl
index a6e0f05..0b5de82 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.ir.glsl
@@ -7,11 +7,8 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.glsl
index 88876dd..2f2985a 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uvec3 lhs, uvec3 rhs) {
- return (lhs % tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (lhs % mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.ir.glsl
index af1771f..8ad4997 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.ir.glsl
@@ -1,11 +1,8 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.glsl
index da82cf0..52a1007 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
int tint_mod(int lhs, int rhs) {
- int rhs_or_one = (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs);
+ int rhs_or_one = mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))));
if (((uint((lhs | rhs_or_one)) & 2147483648u) != 0u)) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.ir.glsl
index dac65a3..0277f57 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- int v_3 = ((bool((v_2 | uint(v_1)))) ? (1) : (rhs));
+ int v_3 = mix(rhs, 1, bool((v_2 | uint(v_1))));
return (lhs - ((lhs / v_3) * v_3));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.glsl
index 9fd11d7..d953107 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.ir.glsl
index 74b7d71..9359385 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.ir.glsl
@@ -1,7 +1,7 @@
#version 310 es
uint tint_mod_u32(uint lhs, uint rhs) {
- uint v = (((rhs == 0u)) ? (1u) : (rhs));
+ uint v = mix(rhs, 1u, (rhs == 0u));
return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.glsl
index cdbec37..ef41fb8 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(int lhs, ivec3 rhs) {
ivec3 l = ivec3(lhs);
- ivec3 rhs_or_one = tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(l, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
if (any(notEqual((uvec3((l | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (l - ((l / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.ir.glsl
index aa334f7..1de7677 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.ir.glsl
@@ -7,16 +7,13 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
int a = 4;
ivec3 b = ivec3(0, 2, 0);
- ivec3 v_10 = b;
- ivec3 r = tint_mod_v3i32(ivec3(a), v_10);
+ ivec3 v_7 = b;
+ ivec3 r = tint_mod_v3i32(ivec3(a), v_7);
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.glsl
index 2b82a77..534cab7 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uint lhs, uvec3 rhs) {
uvec3 l = uvec3(lhs);
- return (l % tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (l % mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.ir.glsl
index 0e55483..0f743c2 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.ir.glsl
@@ -1,16 +1,13 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
uint a = 4u;
uvec3 b = uvec3(0u, 2u, 0u);
- uvec3 v_4 = b;
- uvec3 r = tint_mod_v3u32(uvec3(a), v_4);
+ uvec3 v_1 = b;
+ uvec3 r = tint_mod_v3u32(uvec3(a), v_1);
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.glsl
index 8d45e86..b1ddb82 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(ivec3 lhs, int rhs) {
ivec3 r = ivec3(rhs);
- ivec3 rhs_or_one = tint_select(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(r, ivec3(1), bvec3(uvec3(equal(r, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(r, ivec3(-1)))))));
if (any(notEqual((uvec3((lhs | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.ir.glsl
index 7724ea6..5d42d1f 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.ir.glsl
@@ -7,16 +7,13 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
ivec3 a = ivec3(1, 2, 3);
int b = 0;
- ivec3 v_10 = a;
- ivec3 r = tint_mod_v3i32(v_10, ivec3(b));
+ ivec3 v_7 = a;
+ ivec3 r = tint_mod_v3i32(v_7, ivec3(b));
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.glsl
index 82feba0..03f7867 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uvec3 lhs, uint rhs) {
uvec3 r = uvec3(rhs);
- return (lhs % tint_select(r, uvec3(1u), equal(r, uvec3(0u))));
+ return (lhs % mix(r, uvec3(1u), equal(r, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.ir.glsl
index 2b1b54e..f51167b 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.ir.glsl
@@ -1,16 +1,13 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
uvec3 a = uvec3(1u, 2u, 3u);
uint b = 0u;
- uvec3 v_4 = a;
- uvec3 r = tint_mod_v3u32(v_4, uvec3(b));
+ uvec3 v_1 = a;
+ uvec3 r = tint_mod_v3u32(v_1, uvec3(b));
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.glsl
index b117147..fcb2b37 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
ivec3 tint_mod(ivec3 lhs, ivec3 rhs) {
- ivec3 rhs_or_one = tint_select(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
+ ivec3 rhs_or_one = mix(rhs, ivec3(1), bvec3(uvec3(equal(rhs, ivec3(0))) | uvec3(bvec3(uvec3(equal(lhs, ivec3((-2147483647 - 1)))) & uvec3(equal(rhs, ivec3(-1)))))));
if (any(notEqual((uvec3((lhs | rhs_or_one)) & uvec3(2147483648u)), uvec3(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.ir.glsl
index 315a951..e49d863 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.ir.glsl
@@ -7,11 +7,8 @@
uvec3 v_3 = uvec3(v_1);
bvec3 v_4 = bvec3((v_3 & uvec3(v_2)));
uvec3 v_5 = uvec3(v);
- bvec3 v_6 = bvec3((v_5 | uvec3(v_4)));
- int v_7 = ((v_6.x) ? (ivec3(1).x) : (rhs.x));
- int v_8 = ((v_6.y) ? (ivec3(1).y) : (rhs.y));
- ivec3 v_9 = ivec3(v_7, v_8, ((v_6.z) ? (ivec3(1).z) : (rhs.z)));
- return (lhs - ((lhs / v_9) * v_9));
+ ivec3 v_6 = mix(rhs, ivec3(1), bvec3((v_5 | uvec3(v_4))));
+ return (lhs - ((lhs / v_6) * v_6));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.glsl
index 361f7c2..e6cd33b 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
uvec3 tint_mod(uvec3 lhs, uvec3 rhs) {
- return (lhs % tint_select(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
+ return (lhs % mix(rhs, uvec3(1u), equal(rhs, uvec3(0u))));
}
void f() {
diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.ir.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.ir.glsl
index 52542e0..3d693fe 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.ir.glsl
@@ -1,11 +1,8 @@
#version 310 es
uvec3 tint_mod_v3u32(uvec3 lhs, uvec3 rhs) {
- bvec3 v = equal(rhs, uvec3(0u));
- uint v_1 = ((v.x) ? (uvec3(1u).x) : (rhs.x));
- uint v_2 = ((v.y) ? (uvec3(1u).y) : (rhs.y));
- uvec3 v_3 = uvec3(v_1, v_2, ((v.z) ? (uvec3(1u).z) : (rhs.z)));
- return (lhs - ((lhs / v_3) * v_3));
+ uvec3 v = mix(rhs, uvec3(1u), equal(rhs, uvec3(0u)));
+ return (lhs - ((lhs / v) * v));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.ir.glsl
index 2c2e25a..d354fcf 100644
--- a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.ir.glsl
@@ -7,7 +7,7 @@
return float16_t(t);
}
int tint_f16_to_i32(float16_t value) {
- return (((value <= 65504.0hf)) ? ((((value >= -65504.0hf)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -65504.0hf)), (value <= 65504.0hf));
}
void f() {
int v = tint_f16_to_i32(m());
diff --git a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.ir.glsl
index a37e0a2..5a3e853 100644
--- a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.ir.glsl
@@ -7,7 +7,7 @@
return float16_t(t);
}
uint tint_f16_to_u32(float16_t value) {
- return (((value <= 65504.0hf)) ? ((((value >= 0.0hf)) ? (uint(value)) : (0u))) : (4294967295u));
+ return mix(4294967295u, mix(0u, uint(value), (value >= 0.0hf)), (value <= 65504.0hf));
}
void f() {
uint v = tint_f16_to_u32(m());
diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.glsl
index 1b05d12..f31dbbe 100644
--- a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.glsl
@@ -5,7 +5,7 @@
return;
}
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
float t = 0.0f;
diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.ir.glsl
index d7ea2df..b4471e6 100644
--- a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.ir.glsl
@@ -6,7 +6,7 @@
return float(t);
}
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void f() {
int v = tint_f32_to_i32(m());
diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.glsl
index b8564a0..9581058 100644
--- a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.glsl
@@ -5,7 +5,7 @@
return;
}
uint tint_ftou(float v) {
- return ((v <= 4294967040.0f) ? ((v < 0.0f) ? 0u : uint(v)) : 4294967295u);
+ return mix(4294967295u, mix(uint(v), 0u, (v < 0.0f)), (v <= 4294967040.0f));
}
float t = 0.0f;
diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.ir.glsl
index 03e89b3..82ac674 100644
--- a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.ir.glsl
@@ -6,7 +6,7 @@
return float(t);
}
uint tint_f32_to_u32(float value) {
- return (((value <= 4294967040.0f)) ? ((((value >= 0.0f)) ? (uint(value)) : (0u))) : (4294967295u));
+ return mix(4294967295u, mix(0u, uint(value), (value >= 0.0f)), (value <= 4294967040.0f));
}
void f() {
uint v = tint_f32_to_u32(m());
diff --git a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.ir.glsl
index b4addeb..cddf2a9 100644
--- a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.ir.glsl
@@ -3,7 +3,7 @@
float16_t u = 1.0hf;
int tint_f16_to_i32(float16_t value) {
- return (((value <= 65504.0hf)) ? ((((value >= -65504.0hf)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -65504.0hf)), (value <= 65504.0hf));
}
void f() {
int v = tint_f16_to_i32(u);
diff --git a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.ir.glsl
index ba8a023..8352e31 100644
--- a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.ir.glsl
@@ -3,7 +3,7 @@
float16_t u = 1.0hf;
uint tint_f16_to_u32(float16_t value) {
- return (((value <= 65504.0hf)) ? ((((value >= 0.0hf)) ? (uint(value)) : (0u))) : (4294967295u));
+ return mix(4294967295u, mix(0u, uint(value), (value >= 0.0hf)), (value <= 65504.0hf));
}
void f() {
uint v = tint_f16_to_u32(u);
diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.glsl
index 89bc943..0c5afcc 100644
--- a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.glsl
@@ -5,7 +5,7 @@
return;
}
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
float u = 1.0f;
diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.ir.glsl
index 10c62ea..84014f1 100644
--- a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.ir.glsl
@@ -2,7 +2,7 @@
float u = 1.0f;
int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : ((-2147483647 - 1)))) : (2147483647));
+ return mix(2147483647, mix((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void f() {
int v = tint_f32_to_i32(u);
diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.glsl
index cb83984..3b7c03d 100644
--- a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.glsl
@@ -5,7 +5,7 @@
return;
}
uint tint_ftou(float v) {
- return ((v <= 4294967040.0f) ? ((v < 0.0f) ? 0u : uint(v)) : 4294967295u);
+ return mix(4294967295u, mix(uint(v), 0u, (v < 0.0f)), (v <= 4294967040.0f));
}
float u = 1.0f;
diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.ir.glsl
index a3f577c..7c9c9db 100644
--- a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.ir.glsl
@@ -2,7 +2,7 @@
float u = 1.0f;
uint tint_f32_to_u32(float value) {
- return (((value <= 4294967040.0f)) ? ((((value >= 0.0f)) ? (uint(value)) : (0u))) : (4294967295u));
+ return mix(4294967295u, mix(0u, uint(value), (value >= 0.0f)), (value <= 4294967040.0f));
}
void f() {
uint v = tint_f32_to_u32(u);
diff --git a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.ir.glsl
index 383c8cd..e02ebfa 100644
--- a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.ir.glsl
@@ -8,12 +8,8 @@
}
ivec2 tint_v2f16_to_v2i32(f16vec2 value) {
ivec2 v_1 = ivec2(value);
- bvec2 v_2 = greaterThanEqual(value, f16vec2(-65504.0hf));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec2((-2147483647 - 1)).x));
- ivec2 v_4 = ivec2(v_3, ((v_2.y) ? (v_1.y) : (ivec2((-2147483647 - 1)).y)));
- bvec2 v_5 = lessThanEqual(value, f16vec2(65504.0hf));
- int v_6 = ((v_5.x) ? (v_4.x) : (ivec2(2147483647).x));
- return ivec2(v_6, ((v_5.y) ? (v_4.y) : (ivec2(2147483647).y)));
+ ivec2 v_2 = mix(ivec2((-2147483647 - 1)), v_1, greaterThanEqual(value, f16vec2(-65504.0hf)));
+ return mix(ivec2(2147483647), v_2, lessThanEqual(value, f16vec2(65504.0hf)));
}
void f() {
ivec2 v = tint_v2f16_to_v2i32(m());
diff --git a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.ir.glsl
index d4166c1..9603b63 100644
--- a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.ir.glsl
@@ -8,12 +8,8 @@
}
uvec2 tint_v2f16_to_v2u32(f16vec2 value) {
uvec2 v_1 = uvec2(value);
- bvec2 v_2 = greaterThanEqual(value, f16vec2(0.0hf));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (v_1.y) : (uvec2(0u).y)));
- bvec2 v_5 = lessThanEqual(value, f16vec2(65504.0hf));
- uint v_6 = ((v_5.x) ? (v_4.x) : (uvec2(4294967295u).x));
- return uvec2(v_6, ((v_5.y) ? (v_4.y) : (uvec2(4294967295u).y)));
+ uvec2 v_2 = mix(uvec2(0u), v_1, greaterThanEqual(value, f16vec2(0.0hf)));
+ return mix(uvec2(4294967295u), v_2, lessThanEqual(value, f16vec2(65504.0hf)));
}
void f() {
uvec2 v = tint_v2f16_to_v2u32(m());
diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.glsl
index 08f7381..5321690 100644
--- a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-ivec2 tint_select(ivec2 param_0, ivec2 param_1, bvec2 param_2) {
- return ivec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
ivec2 tint_ftoi(vec2 v) {
- return tint_select(ivec2(2147483647), tint_select(ivec2(v), ivec2((-2147483647 - 1)), lessThan(v, vec2(-2147483648.0f))), lessThanEqual(v, vec2(2147483520.0f)));
+ return mix(ivec2(2147483647), mix(ivec2(v), ivec2((-2147483647 - 1)), lessThan(v, vec2(-2147483648.0f))), lessThanEqual(v, vec2(2147483520.0f)));
}
float t = 0.0f;
diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.ir.glsl
index 451490d..dec14f8 100644
--- a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.ir.glsl
@@ -7,12 +7,8 @@
}
ivec2 tint_v2f32_to_v2i32(vec2 value) {
ivec2 v_1 = ivec2(value);
- bvec2 v_2 = greaterThanEqual(value, vec2(-2147483648.0f));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec2((-2147483647 - 1)).x));
- ivec2 v_4 = ivec2(v_3, ((v_2.y) ? (v_1.y) : (ivec2((-2147483647 - 1)).y)));
- bvec2 v_5 = lessThanEqual(value, vec2(2147483520.0f));
- int v_6 = ((v_5.x) ? (v_4.x) : (ivec2(2147483647).x));
- return ivec2(v_6, ((v_5.y) ? (v_4.y) : (ivec2(2147483647).y)));
+ ivec2 v_2 = mix(ivec2((-2147483647 - 1)), v_1, greaterThanEqual(value, vec2(-2147483648.0f)));
+ return mix(ivec2(2147483647), v_2, lessThanEqual(value, vec2(2147483520.0f)));
}
void f() {
ivec2 v = tint_v2f32_to_v2i32(m());
diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.glsl
index 14414f8..f2a6b6d 100644
--- a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
float t = 0.0f;
diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.ir.glsl
index ef1cb7a..8184170 100644
--- a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.ir.glsl
@@ -7,12 +7,8 @@
}
uvec2 tint_v2f32_to_v2u32(vec2 value) {
uvec2 v_1 = uvec2(value);
- bvec2 v_2 = greaterThanEqual(value, vec2(0.0f));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (v_1.y) : (uvec2(0u).y)));
- bvec2 v_5 = lessThanEqual(value, vec2(4294967040.0f));
- uint v_6 = ((v_5.x) ? (v_4.x) : (uvec2(4294967295u).x));
- return uvec2(v_6, ((v_5.y) ? (v_4.y) : (uvec2(4294967295u).y)));
+ uvec2 v_2 = mix(uvec2(0u), v_1, greaterThanEqual(value, vec2(0.0f)));
+ return mix(uvec2(4294967295u), v_2, lessThanEqual(value, vec2(4294967040.0f)));
}
void f() {
uvec2 v = tint_v2f32_to_v2u32(m());
diff --git a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.ir.glsl
index b8cdf76..6154a32 100644
--- a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.ir.glsl
@@ -4,12 +4,8 @@
f16vec2 u = f16vec2(1.0hf);
ivec2 tint_v2f16_to_v2i32(f16vec2 value) {
ivec2 v_1 = ivec2(value);
- bvec2 v_2 = greaterThanEqual(value, f16vec2(-65504.0hf));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec2((-2147483647 - 1)).x));
- ivec2 v_4 = ivec2(v_3, ((v_2.y) ? (v_1.y) : (ivec2((-2147483647 - 1)).y)));
- bvec2 v_5 = lessThanEqual(value, f16vec2(65504.0hf));
- int v_6 = ((v_5.x) ? (v_4.x) : (ivec2(2147483647).x));
- return ivec2(v_6, ((v_5.y) ? (v_4.y) : (ivec2(2147483647).y)));
+ ivec2 v_2 = mix(ivec2((-2147483647 - 1)), v_1, greaterThanEqual(value, f16vec2(-65504.0hf)));
+ return mix(ivec2(2147483647), v_2, lessThanEqual(value, f16vec2(65504.0hf)));
}
void f() {
ivec2 v = tint_v2f16_to_v2i32(u);
diff --git a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.ir.glsl
index 35ad80d..8de6103 100644
--- a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.ir.glsl
@@ -4,12 +4,8 @@
f16vec2 u = f16vec2(1.0hf);
uvec2 tint_v2f16_to_v2u32(f16vec2 value) {
uvec2 v_1 = uvec2(value);
- bvec2 v_2 = greaterThanEqual(value, f16vec2(0.0hf));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (v_1.y) : (uvec2(0u).y)));
- bvec2 v_5 = lessThanEqual(value, f16vec2(65504.0hf));
- uint v_6 = ((v_5.x) ? (v_4.x) : (uvec2(4294967295u).x));
- return uvec2(v_6, ((v_5.y) ? (v_4.y) : (uvec2(4294967295u).y)));
+ uvec2 v_2 = mix(uvec2(0u), v_1, greaterThanEqual(value, f16vec2(0.0hf)));
+ return mix(uvec2(4294967295u), v_2, lessThanEqual(value, f16vec2(65504.0hf)));
}
void f() {
uvec2 v = tint_v2f16_to_v2u32(u);
diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.glsl
index 32f99c5..852101f 100644
--- a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-ivec2 tint_select(ivec2 param_0, ivec2 param_1, bvec2 param_2) {
- return ivec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
ivec2 tint_ftoi(vec2 v) {
- return tint_select(ivec2(2147483647), tint_select(ivec2(v), ivec2((-2147483647 - 1)), lessThan(v, vec2(-2147483648.0f))), lessThanEqual(v, vec2(2147483520.0f)));
+ return mix(ivec2(2147483647), mix(ivec2(v), ivec2((-2147483647 - 1)), lessThan(v, vec2(-2147483648.0f))), lessThanEqual(v, vec2(2147483520.0f)));
}
vec2 u = vec2(1.0f);
diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.ir.glsl
index 6befd6b..3f0487c 100644
--- a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.ir.glsl
@@ -3,12 +3,8 @@
vec2 u = vec2(1.0f);
ivec2 tint_v2f32_to_v2i32(vec2 value) {
ivec2 v_1 = ivec2(value);
- bvec2 v_2 = greaterThanEqual(value, vec2(-2147483648.0f));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec2((-2147483647 - 1)).x));
- ivec2 v_4 = ivec2(v_3, ((v_2.y) ? (v_1.y) : (ivec2((-2147483647 - 1)).y)));
- bvec2 v_5 = lessThanEqual(value, vec2(2147483520.0f));
- int v_6 = ((v_5.x) ? (v_4.x) : (ivec2(2147483647).x));
- return ivec2(v_6, ((v_5.y) ? (v_4.y) : (ivec2(2147483647).y)));
+ ivec2 v_2 = mix(ivec2((-2147483647 - 1)), v_1, greaterThanEqual(value, vec2(-2147483648.0f)));
+ return mix(ivec2(2147483647), v_2, lessThanEqual(value, vec2(2147483520.0f)));
}
void f() {
ivec2 v = tint_v2f32_to_v2i32(u);
diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.glsl
index baae45e..d00d74b 100644
--- a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-uvec2 tint_select(uvec2 param_0, uvec2 param_1, bvec2 param_2) {
- return uvec2(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
uvec2 tint_ftou(vec2 v) {
- return tint_select(uvec2(4294967295u), tint_select(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
+ return mix(uvec2(4294967295u), mix(uvec2(v), uvec2(0u), lessThan(v, vec2(0.0f))), lessThanEqual(v, vec2(4294967040.0f)));
}
vec2 u = vec2(1.0f);
diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.ir.glsl
index 061f2fc..9e1ab48 100644
--- a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.ir.glsl
@@ -3,12 +3,8 @@
vec2 u = vec2(1.0f);
uvec2 tint_v2f32_to_v2u32(vec2 value) {
uvec2 v_1 = uvec2(value);
- bvec2 v_2 = greaterThanEqual(value, vec2(0.0f));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec2(0u).x));
- uvec2 v_4 = uvec2(v_3, ((v_2.y) ? (v_1.y) : (uvec2(0u).y)));
- bvec2 v_5 = lessThanEqual(value, vec2(4294967040.0f));
- uint v_6 = ((v_5.x) ? (v_4.x) : (uvec2(4294967295u).x));
- return uvec2(v_6, ((v_5.y) ? (v_4.y) : (uvec2(4294967295u).y)));
+ uvec2 v_2 = mix(uvec2(0u), v_1, greaterThanEqual(value, vec2(0.0f)));
+ return mix(uvec2(4294967295u), v_2, lessThanEqual(value, vec2(4294967040.0f)));
}
void f() {
uvec2 v = tint_v2f32_to_v2u32(u);
diff --git a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.ir.glsl
index e3a2391..62cd746 100644
--- a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.ir.glsl
@@ -8,14 +8,8 @@
}
ivec3 tint_v3f16_to_v3i32(f16vec3 value) {
ivec3 v_1 = ivec3(value);
- bvec3 v_2 = greaterThanEqual(value, f16vec3(-65504.0hf));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec3((-2147483647 - 1)).x));
- int v_4 = ((v_2.y) ? (v_1.y) : (ivec3((-2147483647 - 1)).y));
- ivec3 v_5 = ivec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (ivec3((-2147483647 - 1)).z)));
- bvec3 v_6 = lessThanEqual(value, f16vec3(65504.0hf));
- int v_7 = ((v_6.x) ? (v_5.x) : (ivec3(2147483647).x));
- int v_8 = ((v_6.y) ? (v_5.y) : (ivec3(2147483647).y));
- return ivec3(v_7, v_8, ((v_6.z) ? (v_5.z) : (ivec3(2147483647).z)));
+ ivec3 v_2 = mix(ivec3((-2147483647 - 1)), v_1, greaterThanEqual(value, f16vec3(-65504.0hf)));
+ return mix(ivec3(2147483647), v_2, lessThanEqual(value, f16vec3(65504.0hf)));
}
void f() {
ivec3 v = tint_v3f16_to_v3i32(m());
diff --git a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.ir.glsl
index 413f041..b27838b 100644
--- a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.ir.glsl
@@ -8,14 +8,8 @@
}
uvec3 tint_v3f16_to_v3u32(f16vec3 value) {
uvec3 v_1 = uvec3(value);
- bvec3 v_2 = greaterThanEqual(value, f16vec3(0.0hf));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (uvec3(0u).z)));
- bvec3 v_6 = lessThanEqual(value, f16vec3(65504.0hf));
- uint v_7 = ((v_6.x) ? (v_5.x) : (uvec3(4294967295u).x));
- uint v_8 = ((v_6.y) ? (v_5.y) : (uvec3(4294967295u).y));
- return uvec3(v_7, v_8, ((v_6.z) ? (v_5.z) : (uvec3(4294967295u).z)));
+ uvec3 v_2 = mix(uvec3(0u), v_1, greaterThanEqual(value, f16vec3(0.0hf)));
+ return mix(uvec3(4294967295u), v_2, lessThanEqual(value, f16vec3(65504.0hf)));
}
void f() {
uvec3 v = tint_v3f16_to_v3u32(m());
diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.glsl
index 4c39e24..7d8da43 100644
--- a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
ivec3 tint_ftoi(vec3 v) {
- return tint_select(ivec3(2147483647), tint_select(ivec3(v), ivec3((-2147483647 - 1)), lessThan(v, vec3(-2147483648.0f))), lessThanEqual(v, vec3(2147483520.0f)));
+ return mix(ivec3(2147483647), mix(ivec3(v), ivec3((-2147483647 - 1)), lessThan(v, vec3(-2147483648.0f))), lessThanEqual(v, vec3(2147483520.0f)));
}
float t = 0.0f;
diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.ir.glsl
index 1eacf3f..32f8dfd 100644
--- a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.ir.glsl
@@ -7,14 +7,8 @@
}
ivec3 tint_v3f32_to_v3i32(vec3 value) {
ivec3 v_1 = ivec3(value);
- bvec3 v_2 = greaterThanEqual(value, vec3(-2147483648.0f));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec3((-2147483647 - 1)).x));
- int v_4 = ((v_2.y) ? (v_1.y) : (ivec3((-2147483647 - 1)).y));
- ivec3 v_5 = ivec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (ivec3((-2147483647 - 1)).z)));
- bvec3 v_6 = lessThanEqual(value, vec3(2147483520.0f));
- int v_7 = ((v_6.x) ? (v_5.x) : (ivec3(2147483647).x));
- int v_8 = ((v_6.y) ? (v_5.y) : (ivec3(2147483647).y));
- return ivec3(v_7, v_8, ((v_6.z) ? (v_5.z) : (ivec3(2147483647).z)));
+ ivec3 v_2 = mix(ivec3((-2147483647 - 1)), v_1, greaterThanEqual(value, vec3(-2147483648.0f)));
+ return mix(ivec3(2147483647), v_2, lessThanEqual(value, vec3(2147483520.0f)));
}
void f() {
ivec3 v = tint_v3f32_to_v3i32(m());
diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.glsl
index 8c46c48..297fc66 100644
--- a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
uvec3 tint_ftou(vec3 v) {
- return tint_select(uvec3(4294967295u), tint_select(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
+ return mix(uvec3(4294967295u), mix(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
}
float t = 0.0f;
diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.ir.glsl
index 4fa8831..46e424d 100644
--- a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.ir.glsl
@@ -7,14 +7,8 @@
}
uvec3 tint_v3f32_to_v3u32(vec3 value) {
uvec3 v_1 = uvec3(value);
- bvec3 v_2 = greaterThanEqual(value, vec3(0.0f));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (uvec3(0u).z)));
- bvec3 v_6 = lessThanEqual(value, vec3(4294967040.0f));
- uint v_7 = ((v_6.x) ? (v_5.x) : (uvec3(4294967295u).x));
- uint v_8 = ((v_6.y) ? (v_5.y) : (uvec3(4294967295u).y));
- return uvec3(v_7, v_8, ((v_6.z) ? (v_5.z) : (uvec3(4294967295u).z)));
+ uvec3 v_2 = mix(uvec3(0u), v_1, greaterThanEqual(value, vec3(0.0f)));
+ return mix(uvec3(4294967295u), v_2, lessThanEqual(value, vec3(4294967040.0f)));
}
void f() {
uvec3 v = tint_v3f32_to_v3u32(m());
diff --git a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.ir.glsl
index b5f63d3..838e0d0 100644
--- a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.ir.glsl
@@ -4,14 +4,8 @@
f16vec3 u = f16vec3(1.0hf);
ivec3 tint_v3f16_to_v3i32(f16vec3 value) {
ivec3 v_1 = ivec3(value);
- bvec3 v_2 = greaterThanEqual(value, f16vec3(-65504.0hf));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec3((-2147483647 - 1)).x));
- int v_4 = ((v_2.y) ? (v_1.y) : (ivec3((-2147483647 - 1)).y));
- ivec3 v_5 = ivec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (ivec3((-2147483647 - 1)).z)));
- bvec3 v_6 = lessThanEqual(value, f16vec3(65504.0hf));
- int v_7 = ((v_6.x) ? (v_5.x) : (ivec3(2147483647).x));
- int v_8 = ((v_6.y) ? (v_5.y) : (ivec3(2147483647).y));
- return ivec3(v_7, v_8, ((v_6.z) ? (v_5.z) : (ivec3(2147483647).z)));
+ ivec3 v_2 = mix(ivec3((-2147483647 - 1)), v_1, greaterThanEqual(value, f16vec3(-65504.0hf)));
+ return mix(ivec3(2147483647), v_2, lessThanEqual(value, f16vec3(65504.0hf)));
}
void f() {
ivec3 v = tint_v3f16_to_v3i32(u);
diff --git a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.ir.glsl
index ec97174..f400ffc 100644
--- a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.ir.glsl
@@ -4,14 +4,8 @@
f16vec3 u = f16vec3(1.0hf);
uvec3 tint_v3f16_to_v3u32(f16vec3 value) {
uvec3 v_1 = uvec3(value);
- bvec3 v_2 = greaterThanEqual(value, f16vec3(0.0hf));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (uvec3(0u).z)));
- bvec3 v_6 = lessThanEqual(value, f16vec3(65504.0hf));
- uint v_7 = ((v_6.x) ? (v_5.x) : (uvec3(4294967295u).x));
- uint v_8 = ((v_6.y) ? (v_5.y) : (uvec3(4294967295u).y));
- return uvec3(v_7, v_8, ((v_6.z) ? (v_5.z) : (uvec3(4294967295u).z)));
+ uvec3 v_2 = mix(uvec3(0u), v_1, greaterThanEqual(value, f16vec3(0.0hf)));
+ return mix(uvec3(4294967295u), v_2, lessThanEqual(value, f16vec3(65504.0hf)));
}
void f() {
uvec3 v = tint_v3f16_to_v3u32(u);
diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.glsl
index 0d4a7b9..6618d38 100644
--- a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-ivec3 tint_select(ivec3 param_0, ivec3 param_1, bvec3 param_2) {
- return ivec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
ivec3 tint_ftoi(vec3 v) {
- return tint_select(ivec3(2147483647), tint_select(ivec3(v), ivec3((-2147483647 - 1)), lessThan(v, vec3(-2147483648.0f))), lessThanEqual(v, vec3(2147483520.0f)));
+ return mix(ivec3(2147483647), mix(ivec3(v), ivec3((-2147483647 - 1)), lessThan(v, vec3(-2147483648.0f))), lessThanEqual(v, vec3(2147483520.0f)));
}
vec3 u = vec3(1.0f);
diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.ir.glsl
index 0939d28..c28fbe3 100644
--- a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.ir.glsl
@@ -3,14 +3,8 @@
vec3 u = vec3(1.0f);
ivec3 tint_v3f32_to_v3i32(vec3 value) {
ivec3 v_1 = ivec3(value);
- bvec3 v_2 = greaterThanEqual(value, vec3(-2147483648.0f));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec3((-2147483647 - 1)).x));
- int v_4 = ((v_2.y) ? (v_1.y) : (ivec3((-2147483647 - 1)).y));
- ivec3 v_5 = ivec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (ivec3((-2147483647 - 1)).z)));
- bvec3 v_6 = lessThanEqual(value, vec3(2147483520.0f));
- int v_7 = ((v_6.x) ? (v_5.x) : (ivec3(2147483647).x));
- int v_8 = ((v_6.y) ? (v_5.y) : (ivec3(2147483647).y));
- return ivec3(v_7, v_8, ((v_6.z) ? (v_5.z) : (ivec3(2147483647).z)));
+ ivec3 v_2 = mix(ivec3((-2147483647 - 1)), v_1, greaterThanEqual(value, vec3(-2147483648.0f)));
+ return mix(ivec3(2147483647), v_2, lessThanEqual(value, vec3(2147483520.0f)));
}
void f() {
ivec3 v = tint_v3f32_to_v3i32(u);
diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.glsl
index cd85e7d..faad4c5 100644
--- a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-uvec3 tint_select(uvec3 param_0, uvec3 param_1, bvec3 param_2) {
- return uvec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
uvec3 tint_ftou(vec3 v) {
- return tint_select(uvec3(4294967295u), tint_select(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
+ return mix(uvec3(4294967295u), mix(uvec3(v), uvec3(0u), lessThan(v, vec3(0.0f))), lessThanEqual(v, vec3(4294967040.0f)));
}
vec3 u = vec3(1.0f);
diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.ir.glsl
index 6dd006e..d6305ec 100644
--- a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.ir.glsl
@@ -3,14 +3,8 @@
vec3 u = vec3(1.0f);
uvec3 tint_v3f32_to_v3u32(vec3 value) {
uvec3 v_1 = uvec3(value);
- bvec3 v_2 = greaterThanEqual(value, vec3(0.0f));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec3(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec3(0u).y));
- uvec3 v_5 = uvec3(v_3, v_4, ((v_2.z) ? (v_1.z) : (uvec3(0u).z)));
- bvec3 v_6 = lessThanEqual(value, vec3(4294967040.0f));
- uint v_7 = ((v_6.x) ? (v_5.x) : (uvec3(4294967295u).x));
- uint v_8 = ((v_6.y) ? (v_5.y) : (uvec3(4294967295u).y));
- return uvec3(v_7, v_8, ((v_6.z) ? (v_5.z) : (uvec3(4294967295u).z)));
+ uvec3 v_2 = mix(uvec3(0u), v_1, greaterThanEqual(value, vec3(0.0f)));
+ return mix(uvec3(4294967295u), v_2, lessThanEqual(value, vec3(4294967040.0f)));
}
void f() {
uvec3 v = tint_v3f32_to_v3u32(u);
diff --git a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.ir.glsl
index b586a26..75590f6 100644
--- a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.ir.glsl
@@ -8,16 +8,8 @@
}
ivec4 tint_v4f16_to_v4i32(f16vec4 value) {
ivec4 v_1 = ivec4(value);
- bvec4 v_2 = greaterThanEqual(value, f16vec4(-65504.0hf));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec4((-2147483647 - 1)).x));
- int v_4 = ((v_2.y) ? (v_1.y) : (ivec4((-2147483647 - 1)).y));
- int v_5 = ((v_2.z) ? (v_1.z) : (ivec4((-2147483647 - 1)).z));
- ivec4 v_6 = ivec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (ivec4((-2147483647 - 1)).w)));
- bvec4 v_7 = lessThanEqual(value, f16vec4(65504.0hf));
- int v_8 = ((v_7.x) ? (v_6.x) : (ivec4(2147483647).x));
- int v_9 = ((v_7.y) ? (v_6.y) : (ivec4(2147483647).y));
- int v_10 = ((v_7.z) ? (v_6.z) : (ivec4(2147483647).z));
- return ivec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (ivec4(2147483647).w)));
+ ivec4 v_2 = mix(ivec4((-2147483647 - 1)), v_1, greaterThanEqual(value, f16vec4(-65504.0hf)));
+ return mix(ivec4(2147483647), v_2, lessThanEqual(value, f16vec4(65504.0hf)));
}
void f() {
ivec4 v = tint_v4f16_to_v4i32(m());
diff --git a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.ir.glsl
index d0c3744..39ef4d2 100644
--- a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.ir.glsl
@@ -8,16 +8,8 @@
}
uvec4 tint_v4f16_to_v4u32(f16vec4 value) {
uvec4 v_1 = uvec4(value);
- bvec4 v_2 = greaterThanEqual(value, f16vec4(0.0hf));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual(value, f16vec4(65504.0hf));
- uint v_8 = ((v_7.x) ? (v_6.x) : (uvec4(4294967295u).x));
- uint v_9 = ((v_7.y) ? (v_6.y) : (uvec4(4294967295u).y));
- uint v_10 = ((v_7.z) ? (v_6.z) : (uvec4(4294967295u).z));
- return uvec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (uvec4(4294967295u).w)));
+ uvec4 v_2 = mix(uvec4(0u), v_1, greaterThanEqual(value, f16vec4(0.0hf)));
+ return mix(uvec4(4294967295u), v_2, lessThanEqual(value, f16vec4(65504.0hf)));
}
void f() {
uvec4 v = tint_v4f16_to_v4u32(m());
diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.glsl
index b8faed3..541d573 100644
--- a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
ivec4 tint_ftoi(vec4 v) {
- return tint_select(ivec4(2147483647), tint_select(ivec4(v), ivec4((-2147483647 - 1)), lessThan(v, vec4(-2147483648.0f))), lessThanEqual(v, vec4(2147483520.0f)));
+ return mix(ivec4(2147483647), mix(ivec4(v), ivec4((-2147483647 - 1)), lessThan(v, vec4(-2147483648.0f))), lessThanEqual(v, vec4(2147483520.0f)));
}
float t = 0.0f;
diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.ir.glsl
index ed4d8e7..94aa45e 100644
--- a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.ir.glsl
@@ -7,16 +7,8 @@
}
ivec4 tint_v4f32_to_v4i32(vec4 value) {
ivec4 v_1 = ivec4(value);
- bvec4 v_2 = greaterThanEqual(value, vec4(-2147483648.0f));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec4((-2147483647 - 1)).x));
- int v_4 = ((v_2.y) ? (v_1.y) : (ivec4((-2147483647 - 1)).y));
- int v_5 = ((v_2.z) ? (v_1.z) : (ivec4((-2147483647 - 1)).z));
- ivec4 v_6 = ivec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (ivec4((-2147483647 - 1)).w)));
- bvec4 v_7 = lessThanEqual(value, vec4(2147483520.0f));
- int v_8 = ((v_7.x) ? (v_6.x) : (ivec4(2147483647).x));
- int v_9 = ((v_7.y) ? (v_6.y) : (ivec4(2147483647).y));
- int v_10 = ((v_7.z) ? (v_6.z) : (ivec4(2147483647).z));
- return ivec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (ivec4(2147483647).w)));
+ ivec4 v_2 = mix(ivec4((-2147483647 - 1)), v_1, greaterThanEqual(value, vec4(-2147483648.0f)));
+ return mix(ivec4(2147483647), v_2, lessThanEqual(value, vec4(2147483520.0f)));
}
void f() {
ivec4 v = tint_v4f32_to_v4i32(m());
diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.glsl
index f027cbb..9301191 100644
--- a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
uvec4 tint_ftou(vec4 v) {
- return tint_select(uvec4(4294967295u), tint_select(uvec4(v), uvec4(0u), lessThan(v, vec4(0.0f))), lessThanEqual(v, vec4(4294967040.0f)));
+ return mix(uvec4(4294967295u), mix(uvec4(v), uvec4(0u), lessThan(v, vec4(0.0f))), lessThanEqual(v, vec4(4294967040.0f)));
}
float t = 0.0f;
diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.ir.glsl
index 1457c0f..9bb66ce 100644
--- a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.ir.glsl
@@ -7,16 +7,8 @@
}
uvec4 tint_v4f32_to_v4u32(vec4 value) {
uvec4 v_1 = uvec4(value);
- bvec4 v_2 = greaterThanEqual(value, vec4(0.0f));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual(value, vec4(4294967040.0f));
- uint v_8 = ((v_7.x) ? (v_6.x) : (uvec4(4294967295u).x));
- uint v_9 = ((v_7.y) ? (v_6.y) : (uvec4(4294967295u).y));
- uint v_10 = ((v_7.z) ? (v_6.z) : (uvec4(4294967295u).z));
- return uvec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (uvec4(4294967295u).w)));
+ uvec4 v_2 = mix(uvec4(0u), v_1, greaterThanEqual(value, vec4(0.0f)));
+ return mix(uvec4(4294967295u), v_2, lessThanEqual(value, vec4(4294967040.0f)));
}
void f() {
uvec4 v = tint_v4f32_to_v4u32(m());
diff --git a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.ir.glsl
index aaf72d8..4e03cdd 100644
--- a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.ir.glsl
@@ -4,16 +4,8 @@
f16vec4 u = f16vec4(1.0hf);
ivec4 tint_v4f16_to_v4i32(f16vec4 value) {
ivec4 v_1 = ivec4(value);
- bvec4 v_2 = greaterThanEqual(value, f16vec4(-65504.0hf));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec4((-2147483647 - 1)).x));
- int v_4 = ((v_2.y) ? (v_1.y) : (ivec4((-2147483647 - 1)).y));
- int v_5 = ((v_2.z) ? (v_1.z) : (ivec4((-2147483647 - 1)).z));
- ivec4 v_6 = ivec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (ivec4((-2147483647 - 1)).w)));
- bvec4 v_7 = lessThanEqual(value, f16vec4(65504.0hf));
- int v_8 = ((v_7.x) ? (v_6.x) : (ivec4(2147483647).x));
- int v_9 = ((v_7.y) ? (v_6.y) : (ivec4(2147483647).y));
- int v_10 = ((v_7.z) ? (v_6.z) : (ivec4(2147483647).z));
- return ivec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (ivec4(2147483647).w)));
+ ivec4 v_2 = mix(ivec4((-2147483647 - 1)), v_1, greaterThanEqual(value, f16vec4(-65504.0hf)));
+ return mix(ivec4(2147483647), v_2, lessThanEqual(value, f16vec4(65504.0hf)));
}
void f() {
ivec4 v = tint_v4f16_to_v4i32(u);
diff --git a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.ir.glsl
index c6fa970..8137dc0 100644
--- a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.ir.glsl
@@ -4,16 +4,8 @@
f16vec4 u = f16vec4(1.0hf);
uvec4 tint_v4f16_to_v4u32(f16vec4 value) {
uvec4 v_1 = uvec4(value);
- bvec4 v_2 = greaterThanEqual(value, f16vec4(0.0hf));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual(value, f16vec4(65504.0hf));
- uint v_8 = ((v_7.x) ? (v_6.x) : (uvec4(4294967295u).x));
- uint v_9 = ((v_7.y) ? (v_6.y) : (uvec4(4294967295u).y));
- uint v_10 = ((v_7.z) ? (v_6.z) : (uvec4(4294967295u).z));
- return uvec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (uvec4(4294967295u).w)));
+ uvec4 v_2 = mix(uvec4(0u), v_1, greaterThanEqual(value, f16vec4(0.0hf)));
+ return mix(uvec4(4294967295u), v_2, lessThanEqual(value, f16vec4(65504.0hf)));
}
void f() {
uvec4 v = tint_v4f16_to_v4u32(u);
diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.glsl
index 95ace30..cf5bf3a 100644
--- a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
ivec4 tint_ftoi(vec4 v) {
- return tint_select(ivec4(2147483647), tint_select(ivec4(v), ivec4((-2147483647 - 1)), lessThan(v, vec4(-2147483648.0f))), lessThanEqual(v, vec4(2147483520.0f)));
+ return mix(ivec4(2147483647), mix(ivec4(v), ivec4((-2147483647 - 1)), lessThan(v, vec4(-2147483648.0f))), lessThanEqual(v, vec4(2147483520.0f)));
}
vec4 u = vec4(1.0f);
diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.ir.glsl
index 70b6855..0879f24 100644
--- a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.ir.glsl
@@ -3,16 +3,8 @@
vec4 u = vec4(1.0f);
ivec4 tint_v4f32_to_v4i32(vec4 value) {
ivec4 v_1 = ivec4(value);
- bvec4 v_2 = greaterThanEqual(value, vec4(-2147483648.0f));
- int v_3 = ((v_2.x) ? (v_1.x) : (ivec4((-2147483647 - 1)).x));
- int v_4 = ((v_2.y) ? (v_1.y) : (ivec4((-2147483647 - 1)).y));
- int v_5 = ((v_2.z) ? (v_1.z) : (ivec4((-2147483647 - 1)).z));
- ivec4 v_6 = ivec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (ivec4((-2147483647 - 1)).w)));
- bvec4 v_7 = lessThanEqual(value, vec4(2147483520.0f));
- int v_8 = ((v_7.x) ? (v_6.x) : (ivec4(2147483647).x));
- int v_9 = ((v_7.y) ? (v_6.y) : (ivec4(2147483647).y));
- int v_10 = ((v_7.z) ? (v_6.z) : (ivec4(2147483647).z));
- return ivec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (ivec4(2147483647).w)));
+ ivec4 v_2 = mix(ivec4((-2147483647 - 1)), v_1, greaterThanEqual(value, vec4(-2147483648.0f)));
+ return mix(ivec4(2147483647), v_2, lessThanEqual(value, vec4(2147483520.0f)));
}
void f() {
ivec4 v = tint_v4f32_to_v4i32(u);
diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.glsl
index 28f9fd4..7f0502d 100644
--- a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.glsl
+++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.glsl
@@ -1,16 +1,11 @@
#version 310 es
-uvec4 tint_select(uvec4 param_0, uvec4 param_1, bvec4 param_2) {
- return uvec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
uvec4 tint_ftou(vec4 v) {
- return tint_select(uvec4(4294967295u), tint_select(uvec4(v), uvec4(0u), lessThan(v, vec4(0.0f))), lessThanEqual(v, vec4(4294967040.0f)));
+ return mix(uvec4(4294967295u), mix(uvec4(v), uvec4(0u), lessThan(v, vec4(0.0f))), lessThanEqual(v, vec4(4294967040.0f)));
}
vec4 u = vec4(1.0f);
diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.ir.glsl b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.ir.glsl
index a56b6a0..e0ed36a 100644
--- a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.ir.glsl
+++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.ir.glsl
@@ -3,16 +3,8 @@
vec4 u = vec4(1.0f);
uvec4 tint_v4f32_to_v4u32(vec4 value) {
uvec4 v_1 = uvec4(value);
- bvec4 v_2 = greaterThanEqual(value, vec4(0.0f));
- uint v_3 = ((v_2.x) ? (v_1.x) : (uvec4(0u).x));
- uint v_4 = ((v_2.y) ? (v_1.y) : (uvec4(0u).y));
- uint v_5 = ((v_2.z) ? (v_1.z) : (uvec4(0u).z));
- uvec4 v_6 = uvec4(v_3, v_4, v_5, ((v_2.w) ? (v_1.w) : (uvec4(0u).w)));
- bvec4 v_7 = lessThanEqual(value, vec4(4294967040.0f));
- uint v_8 = ((v_7.x) ? (v_6.x) : (uvec4(4294967295u).x));
- uint v_9 = ((v_7.y) ? (v_6.y) : (uvec4(4294967295u).y));
- uint v_10 = ((v_7.z) ? (v_6.z) : (uvec4(4294967295u).z));
- return uvec4(v_8, v_9, v_10, ((v_7.w) ? (v_6.w) : (uvec4(4294967295u).w)));
+ uvec4 v_2 = mix(uvec4(0u), v_1, greaterThanEqual(value, vec4(0.0f)));
+ return mix(uvec4(4294967295u), v_2, lessThanEqual(value, vec4(4294967040.0f)));
}
void f() {
uvec4 v = tint_v4f32_to_v4u32(u);
diff --git a/test/tint/shadowing/short_names/renamer/function.wgsl.expected.glsl b/test/tint/shadowing/short_names/renamer/function.wgsl.expected.glsl
index 5badde0..5fa4bef 100644
--- a/test/tint/shadowing/short_names/renamer/function.wgsl.expected.glsl
+++ b/test/tint/shadowing/short_names/renamer/function.wgsl.expected.glsl
@@ -18,7 +18,7 @@
int tint_symbol_3 = vec4f();
float tint_symbol_4 = vec2f(tint_symbol_3);
bool tint_symbol_5 = vec2i(tint_symbol_4);
- return (tint_symbol_5 ? tint_symbol_2 : tint_symbol_1);
+ return mix(tint_symbol_1, tint_symbol_2, bvec4(tint_symbol_5));
}
void main() {
diff --git a/test/tint/shadowing/short_names/renamer/type.wgsl.expected.glsl b/test/tint/shadowing/short_names/renamer/type.wgsl.expected.glsl
index 2c2b003..0a30666 100644
--- a/test/tint/shadowing/short_names/renamer/type.wgsl.expected.glsl
+++ b/test/tint/shadowing/short_names/renamer/type.wgsl.expected.glsl
@@ -8,7 +8,7 @@
vec4f s = vec4f(1);
float f = float(s.i);
bool b = bool(f);
- return (b ? vec4(1.0f) : vec4(0.0f));
+ return mix(vec4(0.0f), vec4(1.0f), bvec4(b));
}
void main() {
diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.glsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.glsl
index 68edcef..965db8a 100644
--- a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.glsl
@@ -12,11 +12,11 @@
int a = 0;
float b = 0.0f;
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
int tint_mod(int lhs, int rhs) {
- int rhs_or_one = (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs);
+ int rhs_or_one = mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))));
if (((uint((lhs | rhs_or_one)) & 2147483648u) != 0u)) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.ir.glsl
index da96e9a..8dec860 100644
--- a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.ir.glsl
@@ -6,14 +6,14 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- int v_3 = ((bool((v_2 | uint(v_1)))) ? (1) : (rhs));
+ int v_3 = mix(rhs, 1, bool((v_2 | uint(v_1))));
return (lhs - ((lhs / v_3) * v_3));
}
int tint_div_i32(int lhs, int rhs) {
uint v_4 = uint((lhs == (-2147483647 - 1)));
bool v_5 = bool((v_4 & uint((rhs == -1))));
uint v_6 = uint((rhs == 0));
- return (lhs / ((bool((v_6 | uint(v_5)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_6 | uint(v_5)))));
}
void foo(int maybe_zero) {
a = tint_div_i32(a, maybe_zero);
diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.glsl b/test/tint/statements/compound_assign/function.wgsl.expected.glsl
index 5b8138c..d22c170 100644
--- a/test/tint/statements/compound_assign/function.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/function.wgsl.expected.glsl
@@ -5,7 +5,7 @@
return;
}
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void foo() {
diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/function.wgsl.expected.ir.glsl
index 80a3282..fd0e2fb 100644
--- a/test/tint/statements/compound_assign/function.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/function.wgsl.expected.ir.glsl
@@ -4,7 +4,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- return (lhs / ((bool((v_2 | uint(v_1)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_2 | uint(v_1)))));
}
void foo() {
int a = 0;
diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.glsl b/test/tint/statements/compound_assign/private.wgsl.expected.glsl
index 17a5223..6373c19 100644
--- a/test/tint/statements/compound_assign/private.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/private.wgsl.expected.glsl
@@ -8,7 +8,7 @@
vec4 b = vec4(0.0f, 0.0f, 0.0f, 0.0f);
mat2 c = mat2(0.0f, 0.0f, 0.0f, 0.0f);
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void foo() {
diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/private.wgsl.expected.ir.glsl
index d3e99a5..e4bab5e 100644
--- a/test/tint/statements/compound_assign/private.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/private.wgsl.expected.ir.glsl
@@ -7,7 +7,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- return (lhs / ((bool((v_2 | uint(v_1)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_2 | uint(v_1)))));
}
void foo() {
a = tint_div_i32(a, 2);
diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl
index 669b33e..9633198 100644
--- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl
@@ -13,7 +13,7 @@
} v;
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void foo() {
diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.ir.glsl
index 9c1e8d7..e534115 100644
--- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.ir.glsl
@@ -13,7 +13,7 @@
uint v_2 = uint((lhs == (-2147483647 - 1)));
bool v_3 = bool((v_2 & uint((rhs == -1))));
uint v_4 = uint((rhs == 0));
- return (lhs / ((bool((v_4 | uint(v_3)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_4 | uint(v_3)))));
}
void foo() {
v_1.tint_symbol.a = tint_div_i32(v_1.tint_symbol.a, 2);
diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl
index 863264d..9d1205c 100644
--- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl
@@ -13,7 +13,7 @@
} v;
int tint_mod(int lhs, int rhs) {
- int rhs_or_one = (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs);
+ int rhs_or_one = mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))));
if (((uint((lhs | rhs_or_one)) & 2147483648u) != 0u)) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.ir.glsl
index 6540930..a91d7fa 100644
--- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.ir.glsl
@@ -13,7 +13,7 @@
uint v_2 = uint((lhs == (-2147483647 - 1)));
bool v_3 = bool((v_2 & uint((rhs == -1))));
uint v_4 = uint((rhs == 0));
- int v_5 = ((bool((v_4 | uint(v_3)))) ? (1) : (rhs));
+ int v_5 = mix(rhs, 1, bool((v_4 | uint(v_3))));
return (lhs - ((lhs / v_5) * v_5));
}
void foo() {
diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl
index 57f2f60..3eee1a5 100644
--- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl
@@ -1,10 +1,5 @@
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
@@ -18,7 +13,7 @@
} v;
ivec4 tint_div(ivec4 lhs, ivec4 rhs) {
- return (lhs / tint_select(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4((-2147483647 - 1)))) & uvec4(equal(rhs, ivec4(-1))))))));
+ return (lhs / mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4((-2147483647 - 1)))) & uvec4(equal(rhs, ivec4(-1))))))));
}
void foo() {
diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.ir.glsl
index 9f94f4b..85e1629 100644
--- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.ir.glsl
@@ -16,11 +16,7 @@
uvec4 v_5 = uvec4(v_3);
bvec4 v_6 = bvec4((v_5 & uvec4(v_4)));
uvec4 v_7 = uvec4(v_2);
- bvec4 v_8 = bvec4((v_7 | uvec4(v_6)));
- int v_9 = ((v_8.x) ? (ivec4(1).x) : (rhs.x));
- int v_10 = ((v_8.y) ? (ivec4(1).y) : (rhs.y));
- int v_11 = ((v_8.z) ? (ivec4(1).z) : (rhs.z));
- return (lhs / ivec4(v_9, v_10, v_11, ((v_8.w) ? (ivec4(1).w) : (rhs.w))));
+ return (lhs / mix(rhs, ivec4(1), bvec4((v_7 | uvec4(v_6)))));
}
void foo() {
v_1.tint_symbol.a = tint_div_v4i32(v_1.tint_symbol.a, ivec4(2));
diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl
index 9497586..8d04681 100644
--- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl
@@ -1,10 +1,5 @@
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
@@ -19,7 +14,7 @@
ivec4 tint_mod(ivec4 lhs, int rhs) {
ivec4 r = ivec4(rhs);
- ivec4 rhs_or_one = tint_select(r, ivec4(1), bvec4(uvec4(equal(r, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4((-2147483647 - 1)))) & uvec4(equal(r, ivec4(-1)))))));
+ ivec4 rhs_or_one = mix(r, ivec4(1), bvec4(uvec4(equal(r, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4((-2147483647 - 1)))) & uvec4(equal(r, ivec4(-1)))))));
if (any(notEqual((uvec4((lhs | rhs_or_one)) & uvec4(2147483648u)), uvec4(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.ir.glsl
index 6c94b47..a120b9b 100644
--- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.ir.glsl
@@ -16,16 +16,12 @@
uvec4 v_5 = uvec4(v_3);
bvec4 v_6 = bvec4((v_5 & uvec4(v_4)));
uvec4 v_7 = uvec4(v_2);
- bvec4 v_8 = bvec4((v_7 | uvec4(v_6)));
- int v_9 = ((v_8.x) ? (ivec4(1).x) : (rhs.x));
- int v_10 = ((v_8.y) ? (ivec4(1).y) : (rhs.y));
- int v_11 = ((v_8.z) ? (ivec4(1).z) : (rhs.z));
- ivec4 v_12 = ivec4(v_9, v_10, v_11, ((v_8.w) ? (ivec4(1).w) : (rhs.w)));
- return (lhs - ((lhs / v_12) * v_12));
+ ivec4 v_8 = mix(rhs, ivec4(1), bvec4((v_7 | uvec4(v_6))));
+ return (lhs - ((lhs / v_8) * v_8));
}
void foo() {
- ivec4 v_13 = v_1.tint_symbol.a;
- v_1.tint_symbol.a = tint_mod_v4i32(v_13, ivec4(2));
+ ivec4 v_9 = v_1.tint_symbol.a;
+ v_1.tint_symbol.a = tint_mod_v4i32(v_9, ivec4(2));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl
index 58757ab..c8745d4 100644
--- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl
@@ -1,10 +1,5 @@
#version 310 es
-ivec4 tint_select(ivec4 param_0, ivec4 param_1, bvec4 param_2) {
- return ivec4(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2], param_2[3] ? param_1[3] : param_0[3]);
-}
-
-
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
@@ -18,7 +13,7 @@
} v;
ivec4 tint_mod(ivec4 lhs, ivec4 rhs) {
- ivec4 rhs_or_one = tint_select(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4((-2147483647 - 1)))) & uvec4(equal(rhs, ivec4(-1)))))));
+ ivec4 rhs_or_one = mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4((-2147483647 - 1)))) & uvec4(equal(rhs, ivec4(-1)))))));
if (any(notEqual((uvec4((lhs | rhs_or_one)) & uvec4(2147483648u)), uvec4(0u)))) {
return (lhs - ((lhs / rhs_or_one) * rhs_or_one));
} else {
diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.ir.glsl
index ba65f32..e87ca7f 100644
--- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.ir.glsl
@@ -16,12 +16,8 @@
uvec4 v_5 = uvec4(v_3);
bvec4 v_6 = bvec4((v_5 & uvec4(v_4)));
uvec4 v_7 = uvec4(v_2);
- bvec4 v_8 = bvec4((v_7 | uvec4(v_6)));
- int v_9 = ((v_8.x) ? (ivec4(1).x) : (rhs.x));
- int v_10 = ((v_8.y) ? (ivec4(1).y) : (rhs.y));
- int v_11 = ((v_8.z) ? (ivec4(1).z) : (rhs.z));
- ivec4 v_12 = ivec4(v_9, v_10, v_11, ((v_8.w) ? (ivec4(1).w) : (rhs.w)));
- return (lhs - ((lhs / v_12) * v_12));
+ ivec4 v_8 = mix(rhs, ivec4(1), bvec4((v_7 | uvec4(v_6))));
+ return (lhs - ((lhs / v_8) * v_8));
}
void foo() {
v_1.tint_symbol.a = tint_mod_v4i32(v_1.tint_symbol.a, ivec4(2));
diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl
index 3d11704..d97d83c 100644
--- a/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl
+++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl
@@ -8,7 +8,7 @@
shared vec4 b;
shared mat2 c;
int tint_div(int lhs, int rhs) {
- return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1))))) ? 1 : rhs));
+ return (lhs / mix(rhs, 1, bool(uint((rhs == 0)) | uint(bool(uint((lhs == (-2147483647 - 1))) & uint((rhs == -1)))))));
}
void foo() {
diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.ir.glsl
index 1bf7bd2..67eec29 100644
--- a/test/tint/statements/compound_assign/workgroup.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.ir.glsl
@@ -7,7 +7,7 @@
uint v = uint((lhs == (-2147483647 - 1)));
bool v_1 = bool((v & uint((rhs == -1))));
uint v_2 = uint((rhs == 0));
- return (lhs / ((bool((v_2 | uint(v_1)))) ? (1) : (rhs)));
+ return (lhs / mix(rhs, 1, bool((v_2 | uint(v_1)))));
}
void foo() {
a = tint_div_i32(a, 2);
diff --git a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.glsl b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.glsl
index 934ccda..e718f5d 100644
--- a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.glsl
+++ b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.glsl
@@ -3,7 +3,7 @@
precision highp int;
int tint_ftoi(float v) {
- return ((v <= 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
+ return mix(2147483647, mix(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f));
}
bool tint_discarded = false;
diff --git a/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.glsl
index 97e3de3..6a7aef8 100644
--- a/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.glsl
+++ b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.glsl
@@ -1,11 +1,11 @@
#version 310 es
uint tint_div(uint lhs, uint rhs) {
- return (lhs / ((rhs == 0u) ? 1u : rhs));
+ return (lhs / mix(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
- return (lhs % ((rhs == 0u) ? 1u : rhs));
+ return (lhs % mix(rhs, 1u, (rhs == 0u)));
}
shared int zero[2][3];