[Webkit-unassigned] [Bug 195808] New: [WHLSL] Implement loop expressions
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Mar 15 11:45:31 PDT 2019
https://bugs.webkit.org/show_bug.cgi?id=195808
Bug ID: 195808
Summary: [WHLSL] Implement loop expressions
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebGPU
Assignee: webkit-unassigned at lists.webkit.org
Reporter: mmaxfield at apple.com
We transform WHLSL expressions like "a < b * c" into something like:
auto temporary1 = b * c;
auto result = a < temporary1;
This works in the general case, but not if we have something like:
while (a < b * c) { ... }
MSL doesn't support lambdas, so we can't just throw the statements into a lambda.
There are two solutions to this problem:
1) Turn all loops into infinite loops, and emulate their expressions by emitting code in all the necessary places. So, something like:
while (true) {
auto temporary1 = b * c;
auto result = a < temporary1;
if (!result)
break;
}
2) Generate a functor class, passing in references to all referenced variables. So, something like:
class Functor {
Functor(int& a, int& b, int& c) : a(a), b(b), c(c) {}
bool operator()() {
auto temporary1 = b * c;
auto result = a < temporary1;
return result;
}
private:
int& a;
int& b;
int& c;
};
while (Functor(a, b, c)()) {
...
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190315/7d372b26/attachment-0001.html>
More information about the webkit-unassigned
mailing list