[glsl][ir] Polyfill integer `dot`
The `dot` call in GLSL only operators on float values (`f32`, or `f16`).
This CL adds a polyfill for `i32` and `u32` calls to `dot`.
Bug: 42251044
Change-Id: Ifaf67f812309d22b3ed0d58f87fbd9babd5aea0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/207834
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/glsl/builtin_fn.cc b/src/tint/lang/glsl/builtin_fn.cc
index e97f66f..db0371e 100644
--- a/src/tint/lang/glsl/builtin_fn.cc
+++ b/src/tint/lang/glsl/builtin_fn.cc
@@ -72,6 +72,8 @@
return "packFloat2x16";
case BuiltinFn::kUnpackFloat2X16:
return "unpackFloat2x16";
+ case BuiltinFn::kDot:
+ return "dot";
case BuiltinFn::kTextureSize:
return "textureSize";
case BuiltinFn::kImageSize:
diff --git a/src/tint/lang/glsl/builtin_fn.h b/src/tint/lang/glsl/builtin_fn.h
index 444745b..a0460f6 100644
--- a/src/tint/lang/glsl/builtin_fn.h
+++ b/src/tint/lang/glsl/builtin_fn.h
@@ -62,6 +62,7 @@
kBitfieldInsert,
kPackFloat2X16,
kUnpackFloat2X16,
+ kDot,
kTextureSize,
kImageSize,
kTexelFetch,
diff --git a/src/tint/lang/glsl/glsl.def b/src/tint/lang/glsl/glsl.def
index 14aa515..f0863ed 100644
--- a/src/tint/lang/glsl/glsl.def
+++ b/src/tint/lang/glsl/glsl.def
@@ -83,6 +83,7 @@
match fiu32: f32 | i32 | u32
match fiu32_f16: f32 | i32 | u32 | f16
match fiu32_f16_bool: f32 | i32 | u32 | f16 | bool
+match f32_f16: f32 | f16
match read_write: access.read_write
match readable
@@ -166,6 +167,8 @@
fn packFloat2x16(value: vec2<f16>) -> u32
fn unpackFloat2x16(value: u32) -> vec2<f16>
+implicit(T: f32_f16, N: num) fn dot(vec<N, T>, vec<N, T>) -> T
+
@must_use implicit(T: fiu32) fn textureSize(texture: texture_1d<T>,
level: i32) -> i32
@must_use implicit(T: fiu32) fn textureSize(texture: texture_2d<T>,
diff --git a/src/tint/lang/glsl/intrinsic/data.cc b/src/tint/lang/glsl/intrinsic/data.cc
index 95d62ce..63f7543 100644
--- a/src/tint/lang/glsl/intrinsic/data.cc
+++ b/src/tint/lang/glsl/intrinsic/data.cc
@@ -702,6 +702,23 @@
kF32Matcher.print(nullptr, out); out << style::Plain(", "); kI32Matcher.print(nullptr, out); out << style::Plain(", "); kU32Matcher.print(nullptr, out); out << style::Plain(", "); kF16Matcher.print(nullptr, out); out << style::Plain(" or "); kBoolMatcher.print(nullptr, out);}
};
+/// TypeMatcher for 'match f32_f16'
+constexpr TypeMatcher kF32F16Matcher {
+/* match */ [](MatchState& state, const Type* ty) -> const Type* {
+ if (MatchF32(state, ty)) {
+ return BuildF32(state, ty);
+ }
+ if (MatchF16(state, ty)) {
+ return BuildF16(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(" or "); kF16Matcher.print(nullptr, out);}
+};
+
/// EnumMatcher for 'match read_write'
constexpr NumberMatcher kReadWriteMatcher {
/* match */ [](MatchState&, Number number) -> Number {
@@ -874,6 +891,7 @@
/* [31] */ kFiu32Matcher,
/* [32] */ kFiu32F16Matcher,
/* [33] */ kFiu32F16BoolMatcher,
+ /* [34] */ kF32F16Matcher,
};
/// The template numbers, and number matchers
@@ -1005,14 +1023,15 @@
/* [111] */ MatcherIndex(10),
/* [112] */ MatcherIndex(0),
/* [113] */ MatcherIndex(30),
- /* [114] */ MatcherIndex(31),
- /* [115] */ MatcherIndex(21),
- /* [116] */ MatcherIndex(22),
- /* [117] */ MatcherIndex(23),
- /* [118] */ MatcherIndex(24),
- /* [119] */ MatcherIndex(25),
- /* [120] */ MatcherIndex(32),
- /* [121] */ MatcherIndex(33),
+ /* [114] */ MatcherIndex(34),
+ /* [115] */ MatcherIndex(31),
+ /* [116] */ MatcherIndex(21),
+ /* [117] */ MatcherIndex(22),
+ /* [118] */ MatcherIndex(23),
+ /* [119] */ MatcherIndex(24),
+ /* [120] */ MatcherIndex(25),
+ /* [121] */ MatcherIndex(32),
+ /* [122] */ MatcherIndex(33),
};
static_assert(MatcherIndicesIndex::CanIndex(kMatcherIndices),
@@ -1366,18 +1385,18 @@
},
{
/* [69] */
- /* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(83),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(27),
},
{
/* [70] */
- /* usage */ core::ParameterUsage::kLevel,
- /* matcher_indices */ MatcherIndicesIndex(6),
+ /* usage */ core::ParameterUsage::kNone,
+ /* matcher_indices */ MatcherIndicesIndex(27),
},
{
/* [71] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(87),
+ /* matcher_indices */ MatcherIndicesIndex(83),
},
{
/* [72] */
@@ -1387,7 +1406,7 @@
{
/* [73] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(91),
+ /* matcher_indices */ MatcherIndicesIndex(87),
},
{
/* [74] */
@@ -1397,7 +1416,7 @@
{
/* [75] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(93),
+ /* matcher_indices */ MatcherIndicesIndex(91),
},
{
/* [76] */
@@ -1407,7 +1426,7 @@
{
/* [77] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(95),
+ /* matcher_indices */ MatcherIndicesIndex(93),
},
{
/* [78] */
@@ -1417,7 +1436,7 @@
{
/* [79] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(97),
+ /* matcher_indices */ MatcherIndicesIndex(95),
},
{
/* [80] */
@@ -1427,7 +1446,7 @@
{
/* [81] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(115),
+ /* matcher_indices */ MatcherIndicesIndex(97),
},
{
/* [82] */
@@ -1467,37 +1486,37 @@
{
/* [89] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(30),
+ /* matcher_indices */ MatcherIndicesIndex(119),
},
{
/* [90] */
- /* usage */ core::ParameterUsage::kCoords,
+ /* usage */ core::ParameterUsage::kLevel,
/* matcher_indices */ MatcherIndicesIndex(6),
},
{
/* [91] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(33),
+ /* matcher_indices */ MatcherIndicesIndex(30),
},
{
/* [92] */
/* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(85),
+ /* matcher_indices */ MatcherIndicesIndex(6),
},
{
/* [93] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(36),
+ /* matcher_indices */ MatcherIndicesIndex(33),
},
{
/* [94] */
/* usage */ core::ParameterUsage::kCoords,
- /* matcher_indices */ MatcherIndicesIndex(89),
+ /* matcher_indices */ MatcherIndicesIndex(85),
},
{
/* [95] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(39),
+ /* matcher_indices */ MatcherIndicesIndex(36),
},
{
/* [96] */
@@ -1506,13 +1525,13 @@
},
{
/* [97] */
- /* usage */ core::ParameterUsage::kNone,
- /* matcher_indices */ MatcherIndicesIndex(27),
+ /* usage */ core::ParameterUsage::kTexture,
+ /* matcher_indices */ MatcherIndicesIndex(39),
},
{
/* [98] */
- /* usage */ core::ParameterUsage::kNone,
- /* matcher_indices */ MatcherIndicesIndex(27),
+ /* usage */ core::ParameterUsage::kCoords,
+ /* matcher_indices */ MatcherIndicesIndex(89),
},
{
/* [99] */
@@ -1557,7 +1576,7 @@
{
/* [107] */
/* usage */ core::ParameterUsage::kTexture,
- /* matcher_indices */ MatcherIndicesIndex(119),
+ /* matcher_indices */ MatcherIndicesIndex(120),
},
};
@@ -1603,32 +1622,32 @@
},
{
/* [6] */
- /* name */ "F",
- /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
- /* kind */ TemplateInfo::Kind::kNumber,
+ /* name */ "T",
+ /* matcher_indices */ MatcherIndicesIndex(114),
+ /* kind */ TemplateInfo::Kind::kType,
},
{
/* [7] */
- /* name */ "A",
+ /* name */ "N",
/* matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
/* [8] */
/* name */ "F",
- /* matcher_indices */ MatcherIndicesIndex(7),
+ /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
/* [9] */
/* name */ "A",
- /* matcher_indices */ MatcherIndicesIndex(82),
+ /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
/* [10] */
/* name */ "F",
- /* matcher_indices */ MatcherIndicesIndex(46),
+ /* matcher_indices */ MatcherIndicesIndex(7),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
@@ -1640,7 +1659,7 @@
{
/* [12] */
/* name */ "F",
- /* matcher_indices */ MatcherIndicesIndex(0),
+ /* matcher_indices */ MatcherIndicesIndex(46),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
@@ -1651,14 +1670,14 @@
},
{
/* [14] */
- /* name */ "T",
- /* matcher_indices */ MatcherIndicesIndex(120),
- /* kind */ TemplateInfo::Kind::kType,
+ /* name */ "F",
+ /* matcher_indices */ MatcherIndicesIndex(0),
+ /* kind */ TemplateInfo::Kind::kNumber,
},
{
/* [15] */
- /* name */ "N",
- /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
+ /* name */ "A",
+ /* matcher_indices */ MatcherIndicesIndex(82),
/* kind */ TemplateInfo::Kind::kNumber,
},
{
@@ -1676,11 +1695,23 @@
{
/* [18] */
/* name */ "T",
- /* matcher_indices */ MatcherIndicesIndex(114),
+ /* matcher_indices */ MatcherIndicesIndex(122),
/* kind */ TemplateInfo::Kind::kType,
},
{
/* [19] */
+ /* name */ "N",
+ /* matcher_indices */ MatcherIndicesIndex(/* invalid */),
+ /* kind */ TemplateInfo::Kind::kNumber,
+ },
+ {
+ /* [20] */
+ /* name */ "T",
+ /* matcher_indices */ MatcherIndicesIndex(115),
+ /* kind */ TemplateInfo::Kind::kType,
+ },
+ {
+ /* [21] */
/* name */ "C",
/* matcher_indices */ MatcherIndicesIndex(113),
/* kind */ TemplateInfo::Kind::kType,
@@ -1697,8 +1728,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
- /* parameters */ ParameterIndex(69),
+ /* templates */ TemplateIndex(20),
+ /* parameters */ ParameterIndex(71),
/* return_matcher_indices */ MatcherIndicesIndex(6),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1708,8 +1739,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
- /* parameters */ ParameterIndex(71),
+ /* templates */ TemplateIndex(20),
+ /* parameters */ ParameterIndex(73),
/* return_matcher_indices */ MatcherIndicesIndex(85),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1719,8 +1750,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
- /* parameters */ ParameterIndex(73),
+ /* templates */ TemplateIndex(20),
+ /* parameters */ ParameterIndex(75),
/* return_matcher_indices */ MatcherIndicesIndex(89),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1730,8 +1761,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
- /* parameters */ ParameterIndex(75),
+ /* templates */ TemplateIndex(20),
+ /* parameters */ ParameterIndex(77),
/* return_matcher_indices */ MatcherIndicesIndex(89),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1741,8 +1772,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
- /* parameters */ ParameterIndex(77),
+ /* templates */ TemplateIndex(20),
+ /* parameters */ ParameterIndex(79),
/* return_matcher_indices */ MatcherIndicesIndex(85),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1752,8 +1783,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
- /* parameters */ ParameterIndex(79),
+ /* templates */ TemplateIndex(20),
+ /* parameters */ ParameterIndex(81),
/* return_matcher_indices */ MatcherIndicesIndex(89),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1764,7 +1795,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(81),
+ /* parameters */ ParameterIndex(83),
/* return_matcher_indices */ MatcherIndicesIndex(85),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1775,7 +1806,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(83),
+ /* parameters */ ParameterIndex(85),
/* return_matcher_indices */ MatcherIndicesIndex(89),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1786,7 +1817,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(85),
+ /* parameters */ ParameterIndex(87),
/* return_matcher_indices */ MatcherIndicesIndex(85),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1797,7 +1828,7 @@
/* num_explicit_templates */ 0,
/* num_templates */ 0,
/* templates */ TemplateIndex(/* invalid */),
- /* parameters */ ParameterIndex(87),
+ /* parameters */ ParameterIndex(89),
/* return_matcher_indices */ MatcherIndicesIndex(89),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1807,7 +1838,7 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
+ /* templates */ TemplateIndex(20),
/* parameters */ ParameterIndex(25),
/* return_matcher_indices */ MatcherIndicesIndex(85),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -1829,8 +1860,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(8),
- /* parameters */ ParameterIndex(89),
+ /* templates */ TemplateIndex(10),
+ /* parameters */ ParameterIndex(91),
/* return_matcher_indices */ MatcherIndicesIndex(103),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1840,8 +1871,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(8),
- /* parameters */ ParameterIndex(91),
+ /* templates */ TemplateIndex(10),
+ /* parameters */ ParameterIndex(93),
/* return_matcher_indices */ MatcherIndicesIndex(103),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1851,8 +1882,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(8),
- /* parameters */ ParameterIndex(93),
+ /* templates */ TemplateIndex(10),
+ /* parameters */ ParameterIndex(95),
/* return_matcher_indices */ MatcherIndicesIndex(103),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1862,8 +1893,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(8),
- /* parameters */ ParameterIndex(95),
+ /* templates */ TemplateIndex(10),
+ /* parameters */ ParameterIndex(97),
/* return_matcher_indices */ MatcherIndicesIndex(103),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1873,8 +1904,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(10),
- /* parameters */ ParameterIndex(89),
+ /* templates */ TemplateIndex(12),
+ /* parameters */ ParameterIndex(91),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1884,8 +1915,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(10),
- /* parameters */ ParameterIndex(91),
+ /* templates */ TemplateIndex(12),
+ /* parameters */ ParameterIndex(93),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1895,8 +1926,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(10),
- /* parameters */ ParameterIndex(93),
+ /* templates */ TemplateIndex(12),
+ /* parameters */ ParameterIndex(95),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1906,8 +1937,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(10),
- /* parameters */ ParameterIndex(95),
+ /* templates */ TemplateIndex(12),
+ /* parameters */ ParameterIndex(97),
/* return_matcher_indices */ MatcherIndicesIndex(105),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1917,8 +1948,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(12),
- /* parameters */ ParameterIndex(89),
+ /* templates */ TemplateIndex(14),
+ /* parameters */ ParameterIndex(91),
/* return_matcher_indices */ MatcherIndicesIndex(107),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1928,8 +1959,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(12),
- /* parameters */ ParameterIndex(91),
+ /* templates */ TemplateIndex(14),
+ /* parameters */ ParameterIndex(93),
/* return_matcher_indices */ MatcherIndicesIndex(107),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1939,8 +1970,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(12),
- /* parameters */ ParameterIndex(93),
+ /* templates */ TemplateIndex(14),
+ /* parameters */ ParameterIndex(95),
/* return_matcher_indices */ MatcherIndicesIndex(107),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1950,8 +1981,8 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(12),
- /* parameters */ ParameterIndex(95),
+ /* templates */ TemplateIndex(14),
+ /* parameters */ ParameterIndex(97),
/* return_matcher_indices */ MatcherIndicesIndex(107),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -1961,7 +1992,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(31),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -1972,7 +2003,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(34),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -1983,7 +2014,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(37),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -1994,7 +2025,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(40),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2005,7 +2036,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(43),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2016,7 +2047,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(46),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2027,7 +2058,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(49),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2038,7 +2069,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(52),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2049,7 +2080,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(55),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2060,7 +2091,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(58),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2071,7 +2102,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(61),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2082,7 +2113,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(19),
+ /* templates */ TemplateIndex(21),
/* parameters */ ParameterIndex(64),
/* return_matcher_indices */ MatcherIndicesIndex(/* invalid */),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2093,7 +2124,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
+ /* templates */ TemplateIndex(20),
/* parameters */ ParameterIndex(16),
/* return_matcher_indices */ MatcherIndicesIndex(101),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2104,7 +2135,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
+ /* templates */ TemplateIndex(20),
/* parameters */ ParameterIndex(19),
/* return_matcher_indices */ MatcherIndicesIndex(101),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2115,7 +2146,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
+ /* templates */ TemplateIndex(20),
/* parameters */ ParameterIndex(22),
/* return_matcher_indices */ MatcherIndicesIndex(101),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2126,7 +2157,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
+ /* templates */ TemplateIndex(20),
/* parameters */ ParameterIndex(25),
/* return_matcher_indices */ MatcherIndicesIndex(101),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2137,7 +2168,7 @@
/* num_parameters */ 3,
/* num_explicit_templates */ 0,
/* num_templates */ 1,
- /* templates */ TemplateIndex(18),
+ /* templates */ TemplateIndex(20),
/* parameters */ ParameterIndex(28),
/* return_matcher_indices */ MatcherIndicesIndex(101),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
@@ -2148,8 +2179,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(6),
- /* parameters */ ParameterIndex(89),
+ /* templates */ TemplateIndex(8),
+ /* parameters */ ParameterIndex(91),
/* return_matcher_indices */ MatcherIndicesIndex(6),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2159,8 +2190,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(6),
- /* parameters */ ParameterIndex(91),
+ /* templates */ TemplateIndex(8),
+ /* parameters */ ParameterIndex(93),
/* return_matcher_indices */ MatcherIndicesIndex(85),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2170,8 +2201,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(6),
- /* parameters */ ParameterIndex(93),
+ /* templates */ TemplateIndex(8),
+ /* parameters */ ParameterIndex(95),
/* return_matcher_indices */ MatcherIndicesIndex(89),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2181,8 +2212,8 @@
/* num_parameters */ 1,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(6),
- /* parameters */ ParameterIndex(95),
+ /* templates */ TemplateIndex(8),
+ /* parameters */ ParameterIndex(97),
/* return_matcher_indices */ MatcherIndicesIndex(89),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2412,9 +2443,9 @@
/* num_parameters */ 2,
/* num_explicit_templates */ 0,
/* num_templates */ 2,
- /* templates */ TemplateIndex(14),
- /* parameters */ ParameterIndex(97),
- /* return_matcher_indices */ MatcherIndicesIndex(78),
+ /* templates */ TemplateIndex(6),
+ /* parameters */ ParameterIndex(69),
+ /* return_matcher_indices */ MatcherIndicesIndex(3),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
{
@@ -2424,7 +2455,18 @@
/* num_explicit_templates */ 0,
/* num_templates */ 2,
/* templates */ TemplateIndex(16),
- /* parameters */ ParameterIndex(97),
+ /* parameters */ ParameterIndex(69),
+ /* return_matcher_indices */ MatcherIndicesIndex(78),
+ /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
+ },
+ {
+ /* [67] */
+ /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
+ /* num_parameters */ 2,
+ /* num_explicit_templates */ 0,
+ /* num_templates */ 2,
+ /* templates */ TemplateIndex(18),
+ /* parameters */ ParameterIndex(69),
/* return_matcher_indices */ MatcherIndicesIndex(78),
/* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */),
},
@@ -2533,6 +2575,12 @@
},
{
/* [15] */
+ /* fn dot[T : f32_f16, N : num](vec<N, T>, vec<N, T>) -> T */
+ /* num overloads */ 1,
+ /* overloads */ OverloadIndex(65),
+ },
+ {
+ /* [16] */
/* 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> */
@@ -2549,7 +2597,7 @@
/* overloads */ OverloadIndex(0),
},
{
- /* [16] */
+ /* [17] */
/* 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> */
@@ -2558,7 +2606,7 @@
/* overloads */ OverloadIndex(41),
},
{
- /* [17] */
+ /* [18] */
/* 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> */
@@ -2568,7 +2616,7 @@
/* overloads */ OverloadIndex(36),
},
{
- /* [18] */
+ /* [19] */
/* 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> */
@@ -2585,7 +2633,7 @@
/* overloads */ OverloadIndex(12),
},
{
- /* [19] */
+ /* [20] */
/* 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>) */
@@ -2602,40 +2650,40 @@
/* overloads */ OverloadIndex(24),
},
{
- /* [20] */
+ /* [21] */
/* fn lessThan[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(65),
- },
- {
- /* [21] */
- /* fn lessThanEqual[T : fiu32_f16, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
- /* num overloads */ 1,
- /* overloads */ OverloadIndex(65),
+ /* overloads */ OverloadIndex(66),
},
{
/* [22] */
- /* 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(65),
+ /* overloads */ OverloadIndex(66),
},
{
/* [23] */
- /* 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(65),
+ /* overloads */ OverloadIndex(66),
},
{
/* [24] */
- /* 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(66),
},
{
/* [25] */
+ /* fn equal[T : fiu32_f16_bool, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
+ /* num overloads */ 1,
+ /* overloads */ OverloadIndex(67),
+ },
+ {
+ /* [26] */
/* fn notEqual[T : fiu32_f16_bool, N : num](vec<N, T>, vec<N, T>) -> vec<N, bool> */
/* num overloads */ 1,
- /* overloads */ OverloadIndex(66),
+ /* overloads */ OverloadIndex(67),
},
};
diff --git a/src/tint/lang/glsl/writer/builtin_test.cc b/src/tint/lang/glsl/writer/builtin_test.cc
index 50df14a..8237103 100644
--- a/src/tint/lang/glsl/writer/builtin_test.cc
+++ b/src/tint/lang/glsl/writer/builtin_test.cc
@@ -1486,5 +1486,53 @@
)");
}
+TEST_F(GlslWriterTest, DotI32) {
+ auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+ b.Append(func->Block(), [&] {
+ auto* x = b.Let("x", b.Splat(ty.vec4<i32>(), 2_i));
+ auto* y = b.Let("y", b.Splat(ty.vec4<i32>(), 3_i));
+ b.Let("z", b.Call(ty.i32(), core::BuiltinFn::kDot, x, y));
+ b.Return(func);
+ });
+
+ ASSERT_TRUE(Generate()) << err_ << output_.glsl;
+ EXPECT_EQ(output_.glsl, GlslHeader() + R"(precision highp float;
+precision highp int;
+
+int tint_int_dot(ivec4 x, ivec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
+void main() {
+ ivec4 x = ivec4(2);
+ ivec4 y = ivec4(3);
+ int z = tint_int_dot(x, y);
+}
+)");
+}
+
+TEST_F(GlslWriterTest, DotU32) {
+ auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+ b.Append(func->Block(), [&] {
+ auto* x = b.Let("x", b.Splat(ty.vec2<u32>(), 2_u));
+ auto* y = b.Let("y", b.Splat(ty.vec2<u32>(), 3_u));
+ b.Let("z", b.Call(ty.u32(), core::BuiltinFn::kDot, x, y));
+ b.Return(func);
+ });
+
+ ASSERT_TRUE(Generate()) << err_ << output_.glsl;
+ EXPECT_EQ(output_.glsl, GlslHeader() + R"(precision highp float;
+precision highp int;
+
+uint tint_int_dot(uvec2 x, uvec2 y) {
+ return ((x.x * y.x) + (x.y * y.y));
+}
+void main() {
+ uvec2 x = uvec2(2u);
+ uvec2 y = uvec2(3u);
+ uint z = tint_int_dot(x, y);
+}
+)");
+}
+
} // namespace
} // namespace tint::glsl::writer
diff --git a/src/tint/lang/glsl/writer/printer/printer.cc b/src/tint/lang/glsl/writer/printer/printer.cc
index 582fc35..f4a5ca6 100644
--- a/src/tint/lang/glsl/writer/printer/printer.cc
+++ b/src/tint/lang/glsl/writer/printer/printer.cc
@@ -1345,7 +1345,6 @@
case core::BuiltinFn::kDegrees:
case core::BuiltinFn::kDeterminant:
case core::BuiltinFn::kDistance:
- case core::BuiltinFn::kDot:
case core::BuiltinFn::kExp:
case core::BuiltinFn::kExp2:
case core::BuiltinFn::kFloor:
diff --git a/src/tint/lang/glsl/writer/raise/builtin_polyfill.cc b/src/tint/lang/glsl/writer/raise/builtin_polyfill.cc
index 26c3d22..2fa7879 100644
--- a/src/tint/lang/glsl/writer/raise/builtin_polyfill.cc
+++ b/src/tint/lang/glsl/writer/raise/builtin_polyfill.cc
@@ -62,15 +62,20 @@
/// The type manager.
core::type::Manager& ty{ir.Types()};
+ /// Dot polyfills for non `f32`.
+ Hashmap<const core::type::Type*, core::ir::Function*, 4> dot_funcs_{};
+
/// Process the module.
void Process() {
Vector<core::ir::CoreBuiltinCall*, 4> call_worklist;
for (auto* inst : ir.Instructions()) {
if (auto* call = inst->As<core::ir::CoreBuiltinCall>()) {
+ auto args = call->Args();
+
switch (call->Func()) {
case core::BuiltinFn::kAll:
case core::BuiltinFn::kAny:
- if (call->Args()[0]->Type()->Is<core::type::Scalar>()) {
+ if (args[0]->Type()->Is<core::type::Scalar>()) {
call_worklist.Push(call);
}
break;
@@ -79,6 +84,7 @@
case core::BuiltinFn::kAtomicSub:
case core::BuiltinFn::kAtomicLoad:
case core::BuiltinFn::kCountOneBits:
+ case core::BuiltinFn::kDot:
case core::BuiltinFn::kExtractBits:
case core::BuiltinFn::kFma:
case core::BuiltinFn::kInsertBits:
@@ -121,6 +127,9 @@
case core::BuiltinFn::kCountOneBits:
CountOneBits(call);
break;
+ case core::BuiltinFn::kDot:
+ Dot(call);
+ break;
case core::BuiltinFn::kExtractBits:
ExtractBits(call);
break;
@@ -170,6 +179,57 @@
call->Destroy();
}
+ core::ir::Function* CreateDotPolyfill(const core::type::Vector* type) {
+ auto* ret_ty = type->DeepestElement();
+
+ return dot_funcs_.GetOrAdd(type, [&]() -> core::ir::Function* {
+ auto* f = b.Function("tint_int_dot", ret_ty);
+ auto* x = b.FunctionParam("x", type);
+ auto* y = b.FunctionParam("y", type);
+ f->SetParams({x, y});
+
+ b.Append(f->Block(), [&] {
+ core::ir::Value* ret = nullptr;
+
+ for (uint32_t i = 0; i < type->Width(); ++i) {
+ auto* lhs = b.Swizzle(ret_ty, x, {i});
+ auto* rhs = b.Swizzle(ret_ty, y, {i});
+ auto* v = b.Multiply(ret_ty, lhs, rhs);
+
+ if (ret != nullptr) {
+ ret = b.Add(ret_ty, ret, v)->Result(0);
+ } else {
+ ret = v->Result(0);
+ }
+ }
+
+ b.Return(f, ret);
+ });
+ return f;
+ });
+ }
+
+ // GLSL does not have a builtin for `dot` with integer vector types. Generate the helper
+ // function if it hasn't been created already
+ void Dot(core::ir::BuiltinCall* call) {
+ auto args = call->Args();
+
+ auto* vec_ty = call->Args()[0]->Type()->As<core::type::Vector>();
+ TINT_ASSERT(vec_ty);
+
+ b.InsertBefore(call, [&] {
+ if (!vec_ty->DeepestElement()->IsIntegerScalar()) {
+ b.CallWithResult<glsl::ir::BuiltinCall>(call->DetachResult(), glsl::BuiltinFn::kDot,
+ args[0], args[1]);
+ } else {
+ auto* func = CreateDotPolyfill(vec_ty);
+ b.CallWithResult(call->DetachResult(), func, args[0], args[1]);
+ }
+ });
+
+ call->Destroy();
+ }
+
void ExtractBits(core::ir::Call* call) {
b.InsertBefore(call, [&] {
auto args = call->Args();
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 dfb30ed..711360c 100644
--- a/src/tint/lang/glsl/writer/raise/builtin_polyfill_test.cc
+++ b/src/tint/lang/glsl/writer/raise/builtin_polyfill_test.cc
@@ -1516,5 +1516,188 @@
EXPECT_EQ(expect, str());
}
+TEST_F(GlslWriter_BuiltinPolyfillTest, DotF32) {
+ auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+ b.Append(func->Block(), [&] {
+ auto* x = b.Let("x", b.Splat(ty.vec3<f32>(), 2_f));
+ auto* y = b.Let("y", b.Splat(ty.vec3<f32>(), 3_f));
+ b.Let("z", b.Call(ty.f32(), core::BuiltinFn::kDot, x, y));
+ b.Return(func);
+ });
+
+ auto* src = R"(
+%foo = @fragment func():void {
+ $B1: {
+ %x:vec3<f32> = let vec3<f32>(2.0f)
+ %y:vec3<f32> = let vec3<f32>(3.0f)
+ %4:f32 = dot %x, %y
+ %z:f32 = let %4
+ ret
+ }
+}
+)";
+ ASSERT_EQ(src, str());
+
+ auto* expected = R"(
+%foo = @fragment func():void {
+ $B1: {
+ %x:vec3<f32> = let vec3<f32>(2.0f)
+ %y:vec3<f32> = let vec3<f32>(3.0f)
+ %4:f32 = glsl.dot %x, %y
+ %z:f32 = let %4
+ ret
+ }
+}
+)";
+ Run(BuiltinPolyfill);
+ EXPECT_EQ(expected, str());
+}
+
+TEST_F(GlslWriter_BuiltinPolyfillTest, DotF16) {
+ auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+ b.Append(func->Block(), [&] {
+ auto* x = b.Let("x", b.Splat(ty.vec4<f16>(), 2_h));
+ auto* y = b.Let("y", b.Splat(ty.vec4<f16>(), 3_h));
+ b.Let("z", b.Call(ty.f16(), core::BuiltinFn::kDot, x, y));
+ b.Return(func);
+ });
+
+ auto* src = R"(
+%foo = @fragment func():void {
+ $B1: {
+ %x:vec4<f16> = let vec4<f16>(2.0h)
+ %y:vec4<f16> = let vec4<f16>(3.0h)
+ %4:f16 = dot %x, %y
+ %z:f16 = let %4
+ ret
+ }
+}
+)";
+ ASSERT_EQ(src, str());
+
+ auto* expected = R"(
+%foo = @fragment func():void {
+ $B1: {
+ %x:vec4<f16> = let vec4<f16>(2.0h)
+ %y:vec4<f16> = let vec4<f16>(3.0h)
+ %4:f16 = glsl.dot %x, %y
+ %z:f16 = let %4
+ ret
+ }
+}
+)";
+
+ Run(BuiltinPolyfill);
+ EXPECT_EQ(expected, str());
+}
+
+TEST_F(GlslWriter_BuiltinPolyfillTest, DotI32) {
+ auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+ b.Append(func->Block(), [&] {
+ auto* x = b.Let("x", b.Splat(ty.vec4<i32>(), 2_i));
+ auto* y = b.Let("y", b.Splat(ty.vec4<i32>(), 3_i));
+ b.Let("z", b.Call(ty.i32(), core::BuiltinFn::kDot, x, y));
+ b.Return(func);
+ });
+
+ auto* src = R"(
+%foo = @fragment func():void {
+ $B1: {
+ %x:vec4<i32> = let vec4<i32>(2i)
+ %y:vec4<i32> = let vec4<i32>(3i)
+ %4:i32 = dot %x, %y
+ %z:i32 = let %4
+ ret
+ }
+}
+)";
+ ASSERT_EQ(src, str());
+
+ auto* expected = R"(
+%foo = @fragment func():void {
+ $B1: {
+ %x:vec4<i32> = let vec4<i32>(2i)
+ %y:vec4<i32> = let vec4<i32>(3i)
+ %4:i32 = call %tint_int_dot, %x, %y
+ %z:i32 = let %4
+ ret
+ }
+}
+%tint_int_dot = func(%x_1:vec4<i32>, %y_1:vec4<i32>):i32 { # %x_1: 'x', %y_1: 'y'
+ $B2: {
+ %9:i32 = swizzle %x_1, x
+ %10:i32 = swizzle %y_1, x
+ %11:i32 = mul %9, %10
+ %12:i32 = swizzle %x_1, y
+ %13:i32 = swizzle %y_1, y
+ %14:i32 = mul %12, %13
+ %15:i32 = add %11, %14
+ %16:i32 = swizzle %x_1, z
+ %17:i32 = swizzle %y_1, z
+ %18:i32 = mul %16, %17
+ %19:i32 = add %15, %18
+ %20:i32 = swizzle %x_1, w
+ %21:i32 = swizzle %y_1, w
+ %22:i32 = mul %20, %21
+ %23:i32 = add %19, %22
+ ret %23
+ }
+}
+)";
+
+ Run(BuiltinPolyfill);
+ EXPECT_EQ(expected, str());
+}
+
+TEST_F(GlslWriter_BuiltinPolyfillTest, DotU32) {
+ auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+ b.Append(func->Block(), [&] {
+ auto* x = b.Let("x", b.Splat(ty.vec2<u32>(), 2_u));
+ auto* y = b.Let("y", b.Splat(ty.vec2<u32>(), 3_u));
+ b.Let("z", b.Call(ty.u32(), core::BuiltinFn::kDot, x, y));
+ b.Return(func);
+ });
+
+ auto* src = R"(
+%foo = @fragment func():void {
+ $B1: {
+ %x:vec2<u32> = let vec2<u32>(2u)
+ %y:vec2<u32> = let vec2<u32>(3u)
+ %4:u32 = dot %x, %y
+ %z:u32 = let %4
+ ret
+ }
+}
+)";
+ ASSERT_EQ(src, str());
+
+ auto* expected = R"(
+%foo = @fragment func():void {
+ $B1: {
+ %x:vec2<u32> = let vec2<u32>(2u)
+ %y:vec2<u32> = let vec2<u32>(3u)
+ %4:u32 = call %tint_int_dot, %x, %y
+ %z:u32 = let %4
+ ret
+ }
+}
+%tint_int_dot = func(%x_1:vec2<u32>, %y_1:vec2<u32>):u32 { # %x_1: 'x', %y_1: 'y'
+ $B2: {
+ %9:u32 = swizzle %x_1, x
+ %10:u32 = swizzle %y_1, x
+ %11:u32 = mul %9, %10
+ %12:u32 = swizzle %x_1, y
+ %13:u32 = swizzle %y_1, y
+ %14:u32 = mul %12, %13
+ %15:u32 = add %11, %14
+ ret %15
+ }
+}
+)";
+
+ Run(BuiltinPolyfill);
+ EXPECT_EQ(expected, str());
+}
+
} // namespace
} // namespace tint::glsl::writer::raise
diff --git a/test/tint/bug/tint/1534.wgsl.expected.ir.glsl b/test/tint/bug/tint/1534.wgsl.expected.ir.glsl
index 9b255e2..f7c2d79 100644
--- a/test/tint/bug/tint/1534.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/1534.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
@@ -19,18 +17,11 @@
buffer tint_symbol_4_1_ssbo {
h tint_symbol_3;
} v_1;
+uint tint_int_dot(uvec3 x, uvec3 y) {
+ return (((x.x * y.x) + (x.y * y.y)) + (x.z * y.z));
+}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
- uint l = dot(v.tint_symbol_1.a, v.tint_symbol_1.a);
+ uint l = tint_int_dot(v.tint_symbol_1.a, v.tint_symbol_1.a);
v_1.tint_symbol_3.a = v.tint_symbol_1.a.x;
}
-error: Error parsing GLSL shader:
-ERROR: 0:22: 'dot' : no matching overloaded function found
-ERROR: 0:22: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:22: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.ir.glsl
index 227bbb9..90c2569 100644
--- a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,47 +6,37 @@
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec3 x, uvec3 y) {
+ return (((x.x * y.x) + (x.y * y.y)) + (x.z * y.z));
+}
uint dot_7548a0() {
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
void main() {
v.tint_symbol = dot_7548a0();
}
-error: Error parsing GLSL shader:
-ERROR: 0:12: 'dot' : no matching overloaded function found
-ERROR: 0:12: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:12: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec3 x, uvec3 y) {
+ return (((x.x * y.x) + (x.y * y.y)) + (x.z * y.z));
+}
uint dot_7548a0() {
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = dot_7548a0();
}
-error: Error parsing GLSL shader:
-ERROR: 0:10: 'dot' : no matching overloaded function found
-ERROR: 0:10: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:10: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -58,10 +46,13 @@
};
layout(location = 0) flat out uint vertex_main_loc0_Output;
+uint tint_int_dot(uvec3 x, uvec3 y) {
+ return (((x.x * y.x) + (x.y * y.y)) + (x.z * y.z));
+}
uint dot_7548a0() {
uvec3 arg_0 = uvec3(1u);
uvec3 arg_1 = uvec3(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
VertexOutput vertex_main_inner() {
@@ -78,13 +69,3 @@
vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:13: 'dot' : no matching overloaded function found
-ERROR: 0:13: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:13: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.ir.glsl
index 850821b..e290af7 100644
--- a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,47 +6,37 @@
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec2 x, uvec2 y) {
+ return ((x.x * y.x) + (x.y * y.y));
+}
uint dot_97c7ee() {
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
void main() {
v.tint_symbol = dot_97c7ee();
}
-error: Error parsing GLSL shader:
-ERROR: 0:12: 'dot' : no matching overloaded function found
-ERROR: 0:12: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:12: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec2 x, uvec2 y) {
+ return ((x.x * y.x) + (x.y * y.y));
+}
uint dot_97c7ee() {
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = dot_97c7ee();
}
-error: Error parsing GLSL shader:
-ERROR: 0:10: 'dot' : no matching overloaded function found
-ERROR: 0:10: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:10: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -58,10 +46,13 @@
};
layout(location = 0) flat out uint vertex_main_loc0_Output;
+uint tint_int_dot(uvec2 x, uvec2 y) {
+ return ((x.x * y.x) + (x.y * y.y));
+}
uint dot_97c7ee() {
uvec2 arg_0 = uvec2(1u);
uvec2 arg_1 = uvec2(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
VertexOutput vertex_main_inner() {
@@ -78,13 +69,3 @@
vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:13: 'dot' : no matching overloaded function found
-ERROR: 0:13: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:13: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.ir.glsl
index 0444850..053c0e7 100644
--- a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,47 +6,37 @@
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint dot_e994c7() {
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
void main() {
v.tint_symbol = dot_e994c7();
}
-error: Error parsing GLSL shader:
-ERROR: 0:12: 'dot' : no matching overloaded function found
-ERROR: 0:12: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:12: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint dot_e994c7() {
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = dot_e994c7();
}
-error: Error parsing GLSL shader:
-ERROR: 0:10: 'dot' : no matching overloaded function found
-ERROR: 0:10: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:10: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -58,10 +46,13 @@
};
layout(location = 0) flat out uint vertex_main_loc0_Output;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint dot_e994c7() {
uvec4 arg_0 = uvec4(1u);
uvec4 arg_1 = uvec4(1u);
- uint res = dot(arg_0, arg_1);
+ uint res = tint_int_dot(arg_0, arg_1);
return res;
}
VertexOutput vertex_main_inner() {
@@ -78,13 +69,3 @@
vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:13: 'dot' : no matching overloaded function found
-ERROR: 0:13: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:13: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.ir.glsl
index 6b5c468..9c87e6a 100644
--- a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,47 +6,37 @@
buffer tint_symbol_1_1_ssbo {
int tint_symbol;
} v;
+int tint_int_dot(ivec4 x, ivec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
int dot_ef6b1d() {
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
void main() {
v.tint_symbol = dot_ef6b1d();
}
-error: Error parsing GLSL shader:
-ERROR: 0:12: 'dot' : no matching overloaded function found
-ERROR: 0:12: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:12: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
int tint_symbol;
} v;
+int tint_int_dot(ivec4 x, ivec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
int dot_ef6b1d() {
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = dot_ef6b1d();
}
-error: Error parsing GLSL shader:
-ERROR: 0:10: 'dot' : no matching overloaded function found
-ERROR: 0:10: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:10: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -58,10 +46,13 @@
};
layout(location = 0) flat out int vertex_main_loc0_Output;
+int tint_int_dot(ivec4 x, ivec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
int dot_ef6b1d() {
ivec4 arg_0 = ivec4(1);
ivec4 arg_1 = ivec4(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
VertexOutput vertex_main_inner() {
@@ -78,13 +69,3 @@
vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:13: 'dot' : no matching overloaded function found
-ERROR: 0:13: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:13: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.ir.glsl
index 974f6a8..ae86f20 100644
--- a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,47 +6,37 @@
buffer tint_symbol_1_1_ssbo {
int tint_symbol;
} v;
+int tint_int_dot(ivec3 x, ivec3 y) {
+ return (((x.x * y.x) + (x.y * y.y)) + (x.z * y.z));
+}
int dot_f1312c() {
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
void main() {
v.tint_symbol = dot_f1312c();
}
-error: Error parsing GLSL shader:
-ERROR: 0:12: 'dot' : no matching overloaded function found
-ERROR: 0:12: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:12: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
int tint_symbol;
} v;
+int tint_int_dot(ivec3 x, ivec3 y) {
+ return (((x.x * y.x) + (x.y * y.y)) + (x.z * y.z));
+}
int dot_f1312c() {
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = dot_f1312c();
}
-error: Error parsing GLSL shader:
-ERROR: 0:10: 'dot' : no matching overloaded function found
-ERROR: 0:10: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:10: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -58,10 +46,13 @@
};
layout(location = 0) flat out int vertex_main_loc0_Output;
+int tint_int_dot(ivec3 x, ivec3 y) {
+ return (((x.x * y.x) + (x.y * y.y)) + (x.z * y.z));
+}
int dot_f1312c() {
ivec3 arg_0 = ivec3(1);
ivec3 arg_1 = ivec3(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
VertexOutput vertex_main_inner() {
@@ -78,13 +69,3 @@
vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:13: 'dot' : no matching overloaded function found
-ERROR: 0:13: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:13: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.ir.glsl
index a7d890f..7794af2 100644
--- a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,47 +6,37 @@
buffer tint_symbol_1_1_ssbo {
int tint_symbol;
} v;
+int tint_int_dot(ivec2 x, ivec2 y) {
+ return ((x.x * y.x) + (x.y * y.y));
+}
int dot_fc5f7c() {
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
void main() {
v.tint_symbol = dot_fc5f7c();
}
-error: Error parsing GLSL shader:
-ERROR: 0:12: 'dot' : no matching overloaded function found
-ERROR: 0:12: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:12: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
int tint_symbol;
} v;
+int tint_int_dot(ivec2 x, ivec2 y) {
+ return ((x.x * y.x) + (x.y * y.y));
+}
int dot_fc5f7c() {
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = dot_fc5f7c();
}
-error: Error parsing GLSL shader:
-ERROR: 0:10: 'dot' : no matching overloaded function found
-ERROR: 0:10: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:10: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -58,10 +46,13 @@
};
layout(location = 0) flat out int vertex_main_loc0_Output;
+int tint_int_dot(ivec2 x, ivec2 y) {
+ return ((x.x * y.x) + (x.y * y.y));
+}
int dot_fc5f7c() {
ivec2 arg_0 = ivec2(1);
ivec2 arg_1 = ivec2(1);
- int res = dot(arg_0, arg_1);
+ int res = tint_int_dot(arg_0, arg_1);
return res;
}
VertexOutput vertex_main_inner() {
@@ -78,13 +69,3 @@
vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:13: 'dot' : no matching overloaded function found
-ERROR: 0:13: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:13: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.ir.glsl
index 9db1885..7d66246 100644
--- a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,6 +6,9 @@
buffer tint_symbol_1_1_ssbo {
int tint_symbol;
} v;
+int tint_int_dot(ivec4 x, ivec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
int dot4I8Packed_881e62() {
uint arg_0 = 1u;
uint arg_1 = 1u;
@@ -18,26 +19,21 @@
ivec4 v_5 = (v_4 >> uvec4(24u));
uvec4 v_6 = uvec4(24u, 16u, 8u, 0u);
ivec4 v_7 = ivec4((uvec4(v_2) << v_6));
- int res = dot(v_5, (v_7 >> uvec4(24u)));
+ int res = tint_int_dot(v_5, (v_7 >> uvec4(24u)));
return res;
}
void main() {
v.tint_symbol = dot4I8Packed_881e62();
}
-error: Error parsing GLSL shader:
-ERROR: 0:19: 'dot' : no matching overloaded function found
-ERROR: 0:19: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:19: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
int tint_symbol;
} v;
+int tint_int_dot(ivec4 x, ivec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
int dot4I8Packed_881e62() {
uint arg_0 = 1u;
uint arg_1 = 1u;
@@ -48,21 +44,13 @@
ivec4 v_5 = (v_4 >> uvec4(24u));
uvec4 v_6 = uvec4(24u, 16u, 8u, 0u);
ivec4 v_7 = ivec4((uvec4(v_2) << v_6));
- int res = dot(v_5, (v_7 >> uvec4(24u)));
+ int res = tint_int_dot(v_5, (v_7 >> uvec4(24u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = dot4I8Packed_881e62();
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'dot' : no matching overloaded function found
-ERROR: 0:17: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:17: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -72,6 +60,9 @@
};
layout(location = 0) flat out int vertex_main_loc0_Output;
+int tint_int_dot(ivec4 x, ivec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
int dot4I8Packed_881e62() {
uint arg_0 = 1u;
uint arg_1 = 1u;
@@ -82,7 +73,7 @@
ivec4 v_4 = (v_3 >> uvec4(24u));
uvec4 v_5 = uvec4(24u, 16u, 8u, 0u);
ivec4 v_6 = ivec4((uvec4(v_1) << v_5));
- int res = dot(v_4, (v_6 >> uvec4(24u)));
+ int res = tint_int_dot(v_4, (v_6 >> uvec4(24u)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -99,13 +90,3 @@
vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:20: 'dot' : no matching overloaded function found
-ERROR: 0:20: '=' : cannot convert from ' const float' to ' temp highp int'
-ERROR: 0:20: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.ir.glsl
index 8ac72bd..e8f3641 100644
--- a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,6 +6,9 @@
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint dot4U8Packed_fbed7b() {
uint arg_0 = 1u;
uint arg_1 = 1u;
@@ -18,26 +19,21 @@
uvec4 v_5 = (v_4 & uvec4(255u));
uvec4 v_6 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_7 = (uvec4(v_2) >> v_6);
- uint res = dot(v_5, (v_7 & uvec4(255u)));
+ uint res = tint_int_dot(v_5, (v_7 & uvec4(255u)));
return res;
}
void main() {
v.tint_symbol = dot4U8Packed_fbed7b();
}
-error: Error parsing GLSL shader:
-ERROR: 0:19: 'dot' : no matching overloaded function found
-ERROR: 0:19: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:19: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint dot4U8Packed_fbed7b() {
uint arg_0 = 1u;
uint arg_1 = 1u;
@@ -48,21 +44,13 @@
uvec4 v_5 = (v_4 & uvec4(255u));
uvec4 v_6 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_7 = (uvec4(v_2) >> v_6);
- uint res = dot(v_5, (v_7 & uvec4(255u)));
+ uint res = tint_int_dot(v_5, (v_7 & uvec4(255u)));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = dot4U8Packed_fbed7b();
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'dot' : no matching overloaded function found
-ERROR: 0:17: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:17: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -72,6 +60,9 @@
};
layout(location = 0) flat out uint vertex_main_loc0_Output;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint dot4U8Packed_fbed7b() {
uint arg_0 = 1u;
uint arg_1 = 1u;
@@ -82,7 +73,7 @@
uvec4 v_4 = (v_3 & uvec4(255u));
uvec4 v_5 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_6 = (uvec4(v_1) >> v_5);
- uint res = dot(v_4, (v_6 & uvec4(255u)));
+ uint res = tint_int_dot(v_4, (v_6 & uvec4(255u)));
return res;
}
VertexOutput vertex_main_inner() {
@@ -99,13 +90,3 @@
vertex_main_loc0_Output = v_7.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:20: 'dot' : no matching overloaded function found
-ERROR: 0:20: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:20: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/pack4xI8/bfce01.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/pack4xI8/bfce01.wgsl.expected.ir.glsl
index de71a0d..ac64f10 100644
--- a/test/tint/builtins/gen/var/pack4xI8/bfce01.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/pack4xI8/bfce01.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,53 +6,43 @@
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xI8_bfce01() {
ivec4 arg_0 = ivec4(1);
ivec4 v_1 = arg_0;
uvec4 v_2 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_3 = uvec4(v_1);
uvec4 v_4 = ((v_3 & uvec4(255u)) << v_2);
- uint res = dot(v_4, uvec4(1u));
+ uint res = tint_int_dot(v_4, uvec4(1u));
return res;
}
void main() {
v.tint_symbol = pack4xI8_bfce01();
}
-error: Error parsing GLSL shader:
-ERROR: 0:15: 'dot' : no matching overloaded function found
-ERROR: 0:15: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:15: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xI8_bfce01() {
ivec4 arg_0 = ivec4(1);
ivec4 v_1 = arg_0;
uvec4 v_2 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_3 = uvec4(v_1);
uvec4 v_4 = ((v_3 & uvec4(255u)) << v_2);
- uint res = dot(v_4, uvec4(1u));
+ uint res = tint_int_dot(v_4, uvec4(1u));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = pack4xI8_bfce01();
}
-error: Error parsing GLSL shader:
-ERROR: 0:13: 'dot' : no matching overloaded function found
-ERROR: 0:13: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:13: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -64,13 +52,16 @@
};
layout(location = 0) flat out uint vertex_main_loc0_Output;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xI8_bfce01() {
ivec4 arg_0 = ivec4(1);
ivec4 v = arg_0;
uvec4 v_1 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_2 = uvec4(v);
uvec4 v_3 = ((v_2 & uvec4(255u)) << v_1);
- uint res = dot(v_3, uvec4(1u));
+ uint res = tint_int_dot(v_3, uvec4(1u));
return res;
}
VertexOutput vertex_main_inner() {
@@ -87,13 +78,3 @@
vertex_main_loc0_Output = v_4.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'dot' : no matching overloaded function found
-ERROR: 0:16: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:16: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/pack4xI8Clamp/e42b2a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/pack4xI8Clamp/e42b2a.wgsl.expected.ir.glsl
index 83175f6..f660efa 100644
--- a/test/tint/builtins/gen/var/pack4xI8Clamp/e42b2a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/pack4xI8Clamp/e42b2a.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,6 +6,9 @@
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xI8Clamp_e42b2a() {
ivec4 arg_0 = ivec4(1);
ivec4 v_1 = arg_0;
@@ -15,26 +16,21 @@
ivec4 v_3 = ivec4(-128);
uvec4 v_4 = uvec4(clamp(v_1, v_3, ivec4(127)));
uvec4 v_5 = ((v_4 & uvec4(255u)) << v_2);
- uint res = dot(v_5, uvec4(1u));
+ uint res = tint_int_dot(v_5, uvec4(1u));
return res;
}
void main() {
v.tint_symbol = pack4xI8Clamp_e42b2a();
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'dot' : no matching overloaded function found
-ERROR: 0:16: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:16: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xI8Clamp_e42b2a() {
ivec4 arg_0 = ivec4(1);
ivec4 v_1 = arg_0;
@@ -42,21 +38,13 @@
ivec4 v_3 = ivec4(-128);
uvec4 v_4 = uvec4(clamp(v_1, v_3, ivec4(127)));
uvec4 v_5 = ((v_4 & uvec4(255u)) << v_2);
- uint res = dot(v_5, uvec4(1u));
+ uint res = tint_int_dot(v_5, uvec4(1u));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = pack4xI8Clamp_e42b2a();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'dot' : no matching overloaded function found
-ERROR: 0:14: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:14: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -66,6 +54,9 @@
};
layout(location = 0) flat out uint vertex_main_loc0_Output;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xI8Clamp_e42b2a() {
ivec4 arg_0 = ivec4(1);
ivec4 v = arg_0;
@@ -73,7 +64,7 @@
ivec4 v_2 = ivec4(-128);
uvec4 v_3 = uvec4(clamp(v, v_2, ivec4(127)));
uvec4 v_4 = ((v_3 & uvec4(255u)) << v_1);
- uint res = dot(v_4, uvec4(1u));
+ uint res = tint_int_dot(v_4, uvec4(1u));
return res;
}
VertexOutput vertex_main_inner() {
@@ -90,13 +81,3 @@
vertex_main_loc0_Output = v_5.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:17: 'dot' : no matching overloaded function found
-ERROR: 0:17: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:17: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/pack4xU8/b70b53.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/pack4xU8/b70b53.wgsl.expected.ir.glsl
index 545218f..f40ba5f 100644
--- a/test/tint/builtins/gen/var/pack4xU8/b70b53.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/pack4xU8/b70b53.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,51 +6,41 @@
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xU8_b70b53() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
uvec4 v_2 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_3 = ((v_1 & uvec4(255u)) << v_2);
- uint res = dot(v_3, uvec4(1u));
+ uint res = tint_int_dot(v_3, uvec4(1u));
return res;
}
void main() {
v.tint_symbol = pack4xU8_b70b53();
}
-error: Error parsing GLSL shader:
-ERROR: 0:14: 'dot' : no matching overloaded function found
-ERROR: 0:14: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:14: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xU8_b70b53() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
uvec4 v_2 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_3 = ((v_1 & uvec4(255u)) << v_2);
- uint res = dot(v_3, uvec4(1u));
+ uint res = tint_int_dot(v_3, uvec4(1u));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = pack4xU8_b70b53();
}
-error: Error parsing GLSL shader:
-ERROR: 0:12: 'dot' : no matching overloaded function found
-ERROR: 0:12: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:12: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -62,12 +50,15 @@
};
layout(location = 0) flat out uint vertex_main_loc0_Output;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xU8_b70b53() {
uvec4 arg_0 = uvec4(1u);
uvec4 v = arg_0;
uvec4 v_1 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_2 = ((v & uvec4(255u)) << v_1);
- uint res = dot(v_2, uvec4(1u));
+ uint res = tint_int_dot(v_2, uvec4(1u));
return res;
}
VertexOutput vertex_main_inner() {
@@ -84,13 +75,3 @@
vertex_main_loc0_Output = v_3.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:15: 'dot' : no matching overloaded function found
-ERROR: 0:15: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:15: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/builtins/gen/var/pack4xU8Clamp/6b8c1b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/pack4xU8Clamp/6b8c1b.wgsl.expected.ir.glsl
index d6ee185..3a83b9bd 100644
--- a/test/tint/builtins/gen/var/pack4xU8Clamp/6b8c1b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/pack4xU8Clamp/6b8c1b.wgsl.expected.ir.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision highp float;
precision highp int;
@@ -8,53 +6,43 @@
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xU8Clamp_6b8c1b() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
uvec4 v_2 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_3 = uvec4(0u);
uvec4 v_4 = (clamp(v_1, v_3, uvec4(255u)) << v_2);
- uint res = dot(v_4, uvec4(1u));
+ uint res = tint_int_dot(v_4, uvec4(1u));
return res;
}
void main() {
v.tint_symbol = pack4xU8Clamp_6b8c1b();
}
-error: Error parsing GLSL shader:
-ERROR: 0:15: 'dot' : no matching overloaded function found
-ERROR: 0:15: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:15: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uint tint_symbol;
} v;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xU8Clamp_6b8c1b() {
uvec4 arg_0 = uvec4(1u);
uvec4 v_1 = arg_0;
uvec4 v_2 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_3 = uvec4(0u);
uvec4 v_4 = (clamp(v_1, v_3, uvec4(255u)) << v_2);
- uint res = dot(v_4, uvec4(1u));
+ uint res = tint_int_dot(v_4, uvec4(1u));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = pack4xU8Clamp_6b8c1b();
}
-error: Error parsing GLSL shader:
-ERROR: 0:13: 'dot' : no matching overloaded function found
-ERROR: 0:13: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:13: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
#version 310 es
@@ -64,13 +52,16 @@
};
layout(location = 0) flat out uint vertex_main_loc0_Output;
+uint tint_int_dot(uvec4 x, uvec4 y) {
+ return ((((x.x * y.x) + (x.y * y.y)) + (x.z * y.z)) + (x.w * y.w));
+}
uint pack4xU8Clamp_6b8c1b() {
uvec4 arg_0 = uvec4(1u);
uvec4 v = arg_0;
uvec4 v_1 = uvec4(0u, 8u, 16u, 24u);
uvec4 v_2 = uvec4(0u);
uvec4 v_3 = (clamp(v, v_2, uvec4(255u)) << v_1);
- uint res = dot(v_3, uvec4(1u));
+ uint res = tint_int_dot(v_3, uvec4(1u));
return res;
}
VertexOutput vertex_main_inner() {
@@ -87,13 +78,3 @@
vertex_main_loc0_Output = v_4.prevent_dce;
gl_PointSize = 1.0f;
}
-error: Error parsing GLSL shader:
-ERROR: 0:16: 'dot' : no matching overloaded function found
-ERROR: 0:16: '=' : cannot convert from ' const float' to ' temp highp uint'
-ERROR: 0:16: '' : compilation terminated
-ERROR: 3 compilation errors. No code generated.
-
-
-
-
-tint executable returned error: exit status 1