-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Impeller] split downsample shader into GLES variant. (#56376)
This fixes a crash reported on a moto g4 where the on device shader compiler fails to process the ifdef.
- Loading branch information
1 parent
371c8fe
commit 58ac1da
Showing
9 changed files
with
279 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
precision mediump float; | ||
|
||
#include <impeller/constants.glsl> | ||
#include <impeller/types.glsl> | ||
|
||
uniform f16sampler2D texture_sampler; | ||
|
||
uniform FragInfo { | ||
float edge; | ||
float ratio; | ||
vec2 pixel_size; | ||
} | ||
frag_info; | ||
|
||
in highp vec2 v_texture_coords; | ||
|
||
out vec4 frag_color; | ||
|
||
vec4 Sample(vec2 uv) { | ||
#ifdef SUPPORTS_DECAL | ||
return texture(texture_sampler, uv, float16_t(kDefaultMipBias)); | ||
#else | ||
if ((uv.x < 0 || uv.y < 0 || uv.x > 1 || uv.y > 1)) { | ||
return vec4(0); | ||
} else { | ||
return texture(texture_sampler, uv, float16_t(kDefaultMipBias)); | ||
} | ||
#endif | ||
} | ||
|
||
void main() { | ||
vec4 total = vec4(0.0); | ||
for (float i = -frag_info.edge; i <= frag_info.edge; i += 2) { | ||
for (float j = -frag_info.edge; j <= frag_info.edge; j += 2) { | ||
total += (Sample(v_texture_coords + frag_info.pixel_size * vec2(i, j)) * | ||
frag_info.ratio); | ||
} | ||
} | ||
frag_color = total; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <downsample.glsl> |
Oops, something went wrong.