Skip to content

Commit 29625ca

Browse files
authored
Fix supports_decal check in framebuffer_blend.frag (flutter#196227)
The callers of this shader only ever pass 0.0 or 1.0 for supports_decal, so prior to this change `supports_decal > 1` was always false. Even when the hardware sampler was configured with `SamplerAddressMode::kDecal`, the shader always took the fallback branch and called `IPSampleDecal`. Prior to this change, a user-visible difference could only occur when all of the following happen at once: 1. The device supports both frame buffer fetch and decal sampling (iOS/macOS Metal, most Android Vulkan GPUs, or Android GLES with both extensions). 2. An image is drawn directly via `TextureContents::RenderToSnapshot`'s passthrough fast-path. 3. The image is downscaled using both an advanced BlendMode and mipmapped minification filtering like `FilterQuality.medium`. Fixes flutter#196266 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent e0d804f commit 29625ca

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎engine/src/flutter/impeller/entity/shaders/blending/framebuffer_blend.frag‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ in vec2 v_src_texture_coords;
5454
out vec4 frag_color;
5555

5656
vec4 Sample(sampler2D texture_sampler, vec2 texture_coords) {
57-
if (supports_decal > 1) {
58-
return texture(texture_sampler, texture_coords);
57+
if (supports_decal > 0.0) {
58+
return texture(texture_sampler, texture_coords, kDefaultMipBias);
5959
}
6060
return IPSampleDecal(texture_sampler, texture_coords);
6161
}

‎engine/src/flutter/impeller/tools/malioc.json‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,8 +1729,8 @@
17291729
"longest_path_cycles": [
17301730
0.78125,
17311731
0.78125,
1732-
0.625,
1733-
0.625,
1732+
0.4375,
1733+
0.5625,
17341734
0.0,
17351735
0.25,
17361736
1.25
@@ -1746,25 +1746,25 @@
17461746
],
17471747
"shortest_path_bound_pipelines": [
17481748
"arith_total",
1749-
"arith_sfu"
1749+
"arith_fma"
17501750
],
17511751
"shortest_path_cycles": [
1752-
0.625,
17531752
0.59375,
1754-
0.421875,
1755-
0.625,
1753+
0.59375,
1754+
0.3125,
1755+
0.5625,
17561756
0.0,
17571757
0.25,
1758-
0.0
1758+
0.25
17591759
],
17601760
"total_bound_pipelines": [
17611761
"texture"
17621762
],
17631763
"total_cycles": [
17641764
0.78125,
17651765
0.78125,
1766-
0.625,
1767-
0.625,
1766+
0.4375,
1767+
0.5625,
17681768
0.0,
17691769
0.25,
17701770
1.25
@@ -4520,8 +4520,8 @@
45204520
"longest_path_cycles": [
45214521
0.53125,
45224522
0.53125,
4523-
0.40625,
4524-
0.1875,
4523+
0.21875,
4524+
0.125,
45254525
0.0,
45264526
0.25,
45274527
0.25
@@ -4542,11 +4542,11 @@
45424542
"shortest_path_cycles": [
45434543
0.53125,
45444544
0.53125,
4545-
0.296875,
45464545
0.1875,
4546+
0.125,
45474547
0.0,
45484548
0.25,
4549-
0.0
4549+
0.25
45504550
],
45514551
"total_bound_pipelines": [
45524552
"arith_total",
@@ -4555,8 +4555,8 @@
45554555
"total_cycles": [
45564556
0.53125,
45574557
0.53125,
4558-
0.40625,
4559-
0.1875,
4558+
0.21875,
4559+
0.125,
45604560
0.0,
45614561
0.25,
45624562
0.25
@@ -4565,7 +4565,7 @@
45654565
"stack_spill_bytes": 0,
45664566
"thread_occupancy": 100,
45674567
"uniform_registers_used": 6,
4568-
"work_registers_used": 21
4568+
"work_registers_used": 25
45694569
}
45704570
}
45714571
}

0 commit comments

Comments
 (0)