Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d28b8bb

Browse files
authored
Merge branch 'main' into bdero/waitios
2 parents dba13f1 + 047fc60 commit d28b8bb

File tree

18 files changed

+266
-235
lines changed

18 files changed

+266
-235
lines changed

DEPS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ vars = {
4848
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
4949
# You can use //tools/dart/create_updated_flutter_deps.py to produce
5050
# updated revision list of existing dependencies.
51-
'dart_revision': '5606c2c7e1fcfeaeb5566be383fa5f5b6152e385',
51+
'dart_revision': '69867ba60bb7c3d0125777b3e2bf7c7775c18fc9',
5252

5353
# WARNING: DO NOT EDIT MANUALLY
5454
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
@@ -386,7 +386,7 @@ deps = {
386386
Var('dart_git') + '/json_rpc_2.git@0280ac6cb4f3905d81c47ba927123ba2b95f7940',
387387

388388
'src/third_party/dart/third_party/pkg/linter':
389-
Var('dart_git') + '/linter.git@9a586c9deeb53177a02b37807b0f792893092cae',
389+
Var('dart_git') + '/linter.git@e80471506fa05b097a2657e46a033effb81d975a',
390390

391391
'src/third_party/dart/third_party/pkg/logging':
392392
Var('dart_git') + '/logging.git@abef3717d958158eb8b0ddb2871f4b15a9804cd4',
@@ -832,7 +832,7 @@ deps = {
832832
'packages': [
833833
{
834834
'package': 'fuchsia/sdk/core/mac-amd64',
835-
'version': 'A7rAmHDuuQ89yV9FwX5LxcOXcTlyT1jOG20DFGDxTdoC'
835+
'version': 'mxMrU7aA6avJRQ9qfTDwpXNMWV9uB15MvWw5Cj3hC7kC'
836836
}
837837
],
838838
'condition': 'host_os == "mac" and not download_fuchsia_sdk',
@@ -842,7 +842,7 @@ deps = {
842842
'packages': [
843843
{
844844
'package': 'fuchsia/sdk/core/linux-amd64',
845-
'version': 'whJeWVcM-8gVZRdVRxZfQ_b-jnWTti3FCM07mw0QBTwC'
845+
'version': 'hiuBNrBiGQLcPYrmgez6CR9gZexeB7E9etOZd3wIZ8UC'
846846
}
847847
],
848848
'condition': 'host_os == "linux" and not download_fuchsia_sdk',

ci/licenses_golden/licenses_fuchsia

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: 381e75687cef76b0053f2a29c79e37c1
1+
Signature: 2164e2369c09b0555ac686d685ef1ef4
22

33
====================================================================================================
44
LIBRARY: fuchsia_sdk
@@ -3962,6 +3962,7 @@ ORIGIN: ../../../fuchsia/sdk/linux/dart/sl4f/lib/src/flatland_example.dart + ../
39623962
ORIGIN: ../../../fuchsia/sdk/linux/fidl/fuchsia.diagnostics/inspect_sink.fidl + ../../../fuchsia/sdk/linux/LICENSE
39633963
ORIGIN: ../../../fuchsia/sdk/linux/fidl/fuchsia.element/graphical_presenter.fidl + ../../../fuchsia/sdk/linux/LICENSE
39643964
ORIGIN: ../../../fuchsia/sdk/linux/fidl/fuchsia.hardware.network/history.fidl + ../../../fuchsia/sdk/linux/LICENSE
3965+
ORIGIN: ../../../fuchsia/sdk/linux/fidl/fuchsia.io/symlink.fidl + ../../../fuchsia/sdk/linux/LICENSE
39653966
ORIGIN: ../../../fuchsia/sdk/linux/fidl/fuchsia.lowpan.thread/feature.fidl + ../../../fuchsia/sdk/linux/LICENSE
39663967
ORIGIN: ../../../fuchsia/sdk/linux/fidl/fuchsia.net.routes/ipv4.fidl + ../../../fuchsia/sdk/linux/LICENSE
39673968
ORIGIN: ../../../fuchsia/sdk/linux/fidl/fuchsia.net.routes/ipv6.fidl + ../../../fuchsia/sdk/linux/LICENSE
@@ -3979,6 +3980,7 @@ FILE: ../../../fuchsia/sdk/linux/dart/sl4f/lib/src/flatland_example.dart
39793980
FILE: ../../../fuchsia/sdk/linux/fidl/fuchsia.diagnostics/inspect_sink.fidl
39803981
FILE: ../../../fuchsia/sdk/linux/fidl/fuchsia.element/graphical_presenter.fidl
39813982
FILE: ../../../fuchsia/sdk/linux/fidl/fuchsia.hardware.network/history.fidl
3983+
FILE: ../../../fuchsia/sdk/linux/fidl/fuchsia.io/symlink.fidl
39823984
FILE: ../../../fuchsia/sdk/linux/fidl/fuchsia.lowpan.thread/feature.fidl
39833985
FILE: ../../../fuchsia/sdk/linux/fidl/fuchsia.net.routes/ipv4.fidl
39843986
FILE: ../../../fuchsia/sdk/linux/fidl/fuchsia.net.routes/ipv6.fidl

ci/licenses_golden/licenses_third_party

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: 72511696e1c3add1bac744d5d3bb1efc
1+
Signature: 341fb597c27b8326c83120a4dfdc9e33
22

33
====================================================================================================
44
LIBRARY: angle

impeller/compiler/shader_lib/impeller/gaussian.glsl

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,53 @@
66
#define GAUSSIAN_GLSL_
77

88
#include <impeller/constants.glsl>
9+
#include <impeller/types.glsl>
910

1011
/// Gaussian distribution function.
11-
float IPGaussian(float x, float sigma) {
12-
float variance = sigma * sigma;
13-
return exp(-0.5 * x * x / variance) / (kSqrtTwoPi * sigma);
12+
float16_t IPGaussian(float16_t x, float16_t sigma) {
13+
float16_t variance = sigma * sigma;
14+
return exp(-0.5hf * x * x / variance) / (float16_t(kSqrtTwoPi) * sigma);
1415
}
1516

1617
/// Abramowitz and Stegun erf approximation.
17-
float IPErf(float x) {
18-
float a = abs(x);
18+
float16_t IPErf(float16_t x) {
19+
float16_t a = abs(x);
1920
// 0.278393*x + 0.230389*x^2 + 0.078108*x^4 + 1
20-
float b = (0.278393 + (0.230389 + 0.078108 * a * a) * a) * a + 1.0;
21-
return sign(x) * (1 - 1 / (b * b * b * b));
21+
float16_t b =
22+
(0.278393hf + (0.230389hf + 0.078108hf * a * a) * a) * a + 1.0hf;
23+
return sign(x) * (1.0hf - 1.0hf / (b * b * b * b));
2224
}
2325

2426
/// Vec2 variation for the Abramowitz and Stegun erf approximation.
25-
vec2 IPVec2Erf(vec2 x) {
26-
vec2 a = abs(x);
27+
f16vec2 IPVec2Erf(f16vec2 x) {
28+
f16vec2 a = abs(x);
2729
// 0.278393*x + 0.230389*x^2 + 0.078108*x^4 + 1
28-
vec2 b = (0.278393 + (0.230389 + 0.078108 * a * a) * a) * a + 1.0;
29-
return sign(x) * (1 - 1 / (b * b * b * b));
30+
f16vec2 b = (0.278393hf + (0.230389hf + 0.078108hf * a * a) * a) * a + 1.0hf;
31+
return sign(x) * (1.0hf - 1.0hf / (b * b * b * b));
3032
}
3133

3234
/// The indefinite integral of the Gaussian function.
3335
/// Uses a very close approximation of Erf.
34-
float IPGaussianIntegral(float x, float sigma) {
36+
float16_t IPGaussianIntegral(float16_t x, float16_t sigma) {
3537
// ( 1 + erf( x * (sqrt(2) / (2 * sigma) ) ) / 2
36-
return (1 + IPErf(x * (kHalfSqrtTwo / sigma))) * 0.5;
38+
return (1.0hf + IPErf(x * (float16_t(kHalfSqrtTwo) / sigma))) * 0.5hf;
3739
}
3840

3941
/// Vec2 variation for the indefinite integral of the Gaussian function.
4042
/// Uses a very close approximation of Erf.
41-
vec2 IPVec2GaussianIntegral(vec2 x, float sigma) {
43+
f16vec2 IPVec2GaussianIntegral(f16vec2 x, float16_t sigma) {
4244
// ( 1 + erf( x * (sqrt(2) / (2 * sigma) ) ) / 2
43-
return (1 + IPVec2Erf(x * (kHalfSqrtTwo / sigma))) * 0.5;
45+
return (1.0hf + IPVec2Erf(x * (float16_t(kHalfSqrtTwo) / sigma))) * 0.5hf;
4446
}
4547

4648
/// Simpler (but less accurate) approximation of the Gaussian integral.
47-
vec2 IPVec2FastGaussianIntegral(vec2 x, float sigma) {
48-
return 1 / (1 + exp(-kSqrtThree / sigma * x));
49+
f16vec2 IPVec2FastGaussianIntegral(f16vec2 x, float16_t sigma) {
50+
return 1.0hf / (1.0hf + exp(float16_t(-kSqrtThree) / sigma * x));
4951
}
5052

5153
/// Simple logistic sigmoid with a domain of [-1, 1] and range of [0, 1].
52-
float IPSigmoid(float x) {
53-
return 1.03731472073 / (1 + exp(-4 * x)) - 0.0186573603638;
54+
float16_t IPSigmoid(float16_t x) {
55+
return 1.03731472073hf / (1.0hf + exp(-4.0hf * x)) - 0.0186573603638hf;
5456
}
5557

5658
#endif

impeller/compiler/shader_lib/impeller/texture.glsl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ vec4 IPSampleDecal(sampler2D texture_sampler, vec2 coords) {
143143
return texture(texture_sampler, coords);
144144
}
145145

146+
/// Sample a texture with decal tile mode.
147+
f16vec4 IPHalfSampleDecal(f16sampler2D texture_sampler, f16vec2 coords) {
148+
if (any(lessThan(coords, f16vec2(0.0hf))) ||
149+
any(greaterThanEqual(coords, f16vec2(1.0)))) {
150+
return f16vec4(0.0);
151+
}
152+
return texture(texture_sampler, coords);
153+
}
154+
146155
/// Sample a texture, emulating a specific tile mode.
147156
///
148157
/// This is useful for Impeller graphics backend that don't have native support

impeller/entity/shaders/border_mask_blur.frag

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@
1515
// integral (using an erf approximation) to the 4 edges of the UV rectangle and
1616
// multiplying them.
1717

18-
uniform sampler2D texture_sampler;
18+
uniform f16sampler2D texture_sampler;
1919

2020
uniform FragInfo {
21-
float src_factor;
22-
float inner_blur_factor;
23-
float outer_blur_factor;
21+
float16_t src_factor;
22+
float16_t inner_blur_factor;
23+
float16_t outer_blur_factor;
2424

25-
vec2 sigma_uv;
25+
f16vec2 sigma_uv;
2626
}
2727
frag_info;
2828

29-
in vec2 v_texture_coords;
29+
in f16vec2 v_texture_coords;
3030

31-
out vec4 frag_color;
31+
out f16vec4 frag_color;
3232

33-
float BoxBlurMask(vec2 uv) {
33+
float16_t BoxBlurMask(f16vec2 uv) {
3434
// LTRB
35-
return IPGaussianIntegral(uv.x, frag_info.sigma_uv.x) * //
36-
IPGaussianIntegral(uv.y, frag_info.sigma_uv.y) * //
37-
IPGaussianIntegral(1 - uv.x, frag_info.sigma_uv.x) * //
38-
IPGaussianIntegral(1 - uv.y, frag_info.sigma_uv.y);
35+
return IPGaussianIntegral(uv.x, frag_info.sigma_uv.x) * //
36+
IPGaussianIntegral(uv.y, frag_info.sigma_uv.y) * //
37+
IPGaussianIntegral(1.0hf - uv.x, frag_info.sigma_uv.x) * //
38+
IPGaussianIntegral(1.0hf - uv.y, frag_info.sigma_uv.y);
3939
}
4040

4141
void main() {
42-
vec4 image_color = texture(texture_sampler, v_texture_coords);
43-
float blur_factor = BoxBlurMask(v_texture_coords);
42+
f16vec4 image_color = texture(texture_sampler, v_texture_coords);
43+
float16_t blur_factor = BoxBlurMask(v_texture_coords);
4444

45-
float within_bounds =
46-
float(v_texture_coords.x >= 0 && v_texture_coords.y >= 0 &&
47-
v_texture_coords.x < 1 && v_texture_coords.y < 1);
48-
float inner_factor =
45+
float16_t within_bounds =
46+
float16_t(v_texture_coords.x >= 0.0hf && v_texture_coords.y >= 0.0hf &&
47+
v_texture_coords.x < 1.0hf && v_texture_coords.y < 1.0hf);
48+
float16_t inner_factor =
4949
(frag_info.inner_blur_factor * blur_factor + frag_info.src_factor) *
5050
within_bounds;
51-
float outer_factor =
52-
frag_info.outer_blur_factor * blur_factor * (1 - within_bounds);
51+
float16_t outer_factor =
52+
frag_info.outer_blur_factor * blur_factor * (1.0hf - within_bounds);
5353

54-
float mask_factor = inner_factor + outer_factor;
54+
float16_t mask_factor = inner_factor + outer_factor;
5555
frag_color = image_color * mask_factor;
5656
}

impeller/entity/shaders/border_mask_blur.vert

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ frame_info;
1515
in vec2 vertices;
1616
in vec2 texture_coords;
1717

18-
out vec2 v_texture_coords;
18+
out f16vec2 v_texture_coords;
1919

2020
void main() {
2121
gl_Position = frame_info.mvp * vec4(vertices, 0.0, 1.0);
22-
v_texture_coords =
23-
IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale);
22+
v_texture_coords = f16vec2(
23+
IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale));
2424
}

impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,52 +18,52 @@
1818
#include <impeller/texture.glsl>
1919
#include <impeller/types.glsl>
2020

21-
uniform sampler2D texture_sampler;
21+
uniform f16sampler2D texture_sampler;
2222

2323
uniform BlurInfo {
24-
vec2 texture_size;
25-
vec2 blur_direction;
24+
f16vec2 texture_size;
25+
f16vec2 blur_direction;
2626

2727
// The blur sigma and radius have a linear relationship which is defined
2828
// host-side, but both are useful controls here. Sigma (pixels per standard
2929
// deviation) is used to define the gaussian function itself, whereas the
3030
// radius is used to limit how much of the function is integrated.
31-
float blur_sigma;
32-
float blur_radius;
31+
float16_t blur_sigma;
32+
float16_t blur_radius;
3333
}
3434
blur_info;
3535

3636
#if ENABLE_ALPHA_MASK
37-
uniform sampler2D alpha_mask_sampler;
37+
uniform f16sampler2D alpha_mask_sampler;
3838

3939
uniform MaskInfo {
40-
float src_factor;
41-
float inner_blur_factor;
42-
float outer_blur_factor;
40+
float16_t src_factor;
41+
float16_t inner_blur_factor;
42+
float16_t outer_blur_factor;
4343
}
4444
mask_info;
4545
#endif
4646

47-
vec4 Sample(sampler2D tex, vec2 coords) {
47+
f16vec4 Sample(f16sampler2D tex, f16vec2 coords) {
4848
#if ENABLE_DECAL_SPECIALIZATION
49-
return IPSampleDecal(tex, coords);
49+
return IPHalfSampleDecal(tex, coords);
5050
#else
5151
return texture(tex, coords);
5252
#endif
5353
}
5454

55-
in vec2 v_texture_coords;
56-
in vec2 v_src_texture_coords;
55+
in f16vec2 v_texture_coords;
56+
in f16vec2 v_src_texture_coords;
5757

58-
out vec4 frag_color;
58+
out f16vec4 frag_color;
5959

6060
void main() {
61-
vec4 total_color = vec4(0);
62-
float gaussian_integral = 0;
63-
vec2 blur_uv_offset = blur_info.blur_direction / blur_info.texture_size;
61+
f16vec4 total_color = f16vec4(0.0hf);
62+
float16_t gaussian_integral = 0.0hf;
63+
f16vec2 blur_uv_offset = blur_info.blur_direction / blur_info.texture_size;
6464

65-
for (float i = -blur_info.blur_radius; i <= blur_info.blur_radius; i++) {
66-
float gaussian = IPGaussian(i, blur_info.blur_sigma);
65+
for (float16_t i = -blur_info.blur_radius; i <= blur_info.blur_radius; i++) {
66+
float16_t gaussian = IPGaussian(i, blur_info.blur_sigma);
6767
gaussian_integral += gaussian;
6868
total_color +=
6969
gaussian *
@@ -75,11 +75,12 @@ void main() {
7575
frag_color = total_color / gaussian_integral;
7676

7777
#if ENABLE_ALPHA_MASK
78-
vec4 src_color = Sample(alpha_mask_sampler, // sampler
79-
v_src_texture_coords // texture coordinates
78+
f16vec4 src_color = Sample(alpha_mask_sampler, // sampler
79+
v_src_texture_coords // texture coordinates
8080
);
81-
float blur_factor = mask_info.inner_blur_factor * float(src_color.a > 0) +
82-
mask_info.outer_blur_factor * float(src_color.a == 0);
81+
float16_t blur_factor =
82+
mask_info.inner_blur_factor * float16_t(src_color.a > 0.0hf) +
83+
mask_info.outer_blur_factor * float16_t(src_color.a == 0.0hf);
8384

8485
frag_color = frag_color * blur_factor + src_color * mask_info.src_factor;
8586
#endif

impeller/entity/shaders/gaussian_blur/gaussian_blur.vert

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ in vec2 vertices;
1616
in vec2 texture_coords;
1717
in vec2 src_texture_coords;
1818

19-
out vec2 v_texture_coords;
20-
out vec2 v_src_texture_coords;
19+
out f16vec2 v_texture_coords;
20+
out f16vec2 v_src_texture_coords;
2121

2222
void main() {
2323
gl_Position = frame_info.mvp * vec4(vertices, 0.0, 1.0);
24-
v_texture_coords =
25-
IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale);
26-
v_src_texture_coords = IPRemapCoords(
27-
src_texture_coords, frame_info.alpha_mask_sampler_y_coord_scale);
24+
v_texture_coords = f16vec2(
25+
IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale));
26+
v_src_texture_coords = f16vec2(IPRemapCoords(
27+
src_texture_coords, frame_info.alpha_mask_sampler_y_coord_scale));
2828
}

0 commit comments

Comments
 (0)