Bug 1720841 - Clamp loop condition variable to static value in cs_blur. r=gw

In the cs_blur fragment shader there is a for loop with a number of
iterations determined by a flat varying. On some old Adreno drivers
this causes severe issues including hangs and crashes. These can be
avoided by clamping the number of iterations to a statically known
value.

Differential Revision: https://phabricator.services.mozilla.com/D120281
This commit is contained in:
Jamie Nicol 2021-07-19 21:17:07 +00:00
Родитель 1b9596a92c
Коммит 90f29c4458
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -154,8 +154,12 @@ void main(void) {
// //
// for some t. So we can let `t = k1/(k0 + k1)` and effectively evaluate // for some t. So we can let `t = k1/(k0 + k1)` and effectively evaluate
// Equation 1 with a single texture lookup. // Equation 1 with a single texture lookup.
//
for (int i = 1; i <= vSupport; i += 2) { // Clamp loop condition variable to a statically known value to workaround
// driver bug on Adreno 3xx. vSupport should not exceed 300 anyway, due to
// the max blur radius being 100. See bug 1720841 for details.
int support = min(vSupport, 300);
for (int i = 1; i <= support; i += 2) {
gauss_coefficient.xy *= gauss_coefficient.yz; gauss_coefficient.xy *= gauss_coefficient.yz;
float gauss_coefficient_subtotal = gauss_coefficient.x; float gauss_coefficient_subtotal = gauss_coefficient.x;