From 17ea9569da31b2d718fe3f9114d8b1b251b95f8b Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 11 Feb 2025 20:15:07 -0800 Subject: [PATCH] [Impeller] mirror tile mode requires highp for Adreno. (#163066) Fixes https://github.com/flutter/flutter/issues/162891 On Adreno GPU the mediump precision causes mirror to drop this number to zero. --- .../compiler/shader_lib/impeller/texture.glsl | 6 +- engine/src/flutter/impeller/tools/malioc.json | 174 +++++++++--------- 2 files changed, 89 insertions(+), 91 deletions(-) diff --git a/engine/src/flutter/impeller/compiler/shader_lib/impeller/texture.glsl b/engine/src/flutter/impeller/compiler/shader_lib/impeller/texture.glsl index f699d70035..98628069bb 100644 --- a/engine/src/flutter/impeller/compiler/shader_lib/impeller/texture.glsl +++ b/engine/src/flutter/impeller/compiler/shader_lib/impeller/texture.glsl @@ -45,14 +45,14 @@ vec4 IPSampleLinear(sampler2D texture_sampler, /// returned. In all other cases, a value between 0 and 1 is returned by tiling /// `t`. /// When `t` is between [0 to 1), the original unchanged `t` is always returned. -float IPFloatTile(float t, float tile_mode) { +highp float IPFloatTile(highp float t, float tile_mode) { if (tile_mode == kTileModeClamp) { t = clamp(t, 0.0, 1.0); } else if (tile_mode == kTileModeRepeat) { t = fract(t); } else if (tile_mode == kTileModeMirror) { - float t1 = t - 1; - float t2 = t1 - 2 * floor(t1 * 0.5) - 1; + highp float t1 = t - 1; + highp float t2 = t1 - 2 * floor(t1 * 0.5) - 1; t = abs(t2); } return t; diff --git a/engine/src/flutter/impeller/tools/malioc.json b/engine/src/flutter/impeller/tools/malioc.json index 75311a5678..ffdb6a6235 100644 --- a/engine/src/flutter/impeller/tools/malioc.json +++ b/engine/src/flutter/impeller/tools/malioc.json @@ -3291,7 +3291,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 52, + "fp16_arithmetic": 4, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -3299,9 +3299,9 @@ "arith_cvt" ], "longest_path_cycles": [ - 0.390625, + 0.40625, 0.296875, - 0.390625, + 0.40625, 0.125, 0.0, 0.25, @@ -3333,9 +3333,9 @@ "arith_cvt" ], "total_cycles": [ - 0.515625, + 0.53125, 0.328125, - 0.515625, + 0.53125, 0.125, 0.0, 0.25, @@ -3362,7 +3362,7 @@ "arithmetic" ], "longest_path_cycles": [ - 6.929999828338623, + 7.260000228881836, 1.0, 1.0 ], @@ -3383,7 +3383,7 @@ "arithmetic" ], "total_cycles": [ - 7.666666507720947, + 8.0, 1.0, 1.0 ] @@ -3408,7 +3408,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 13, + "fp16_arithmetic": 2, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -3449,7 +3449,7 @@ ], "total_cycles": [ 0.8125, - 0.46875, + 0.453125, 0.8125, 0.1875, 4.0, @@ -4033,7 +4033,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 44, + "fp16_arithmetic": 3, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -4041,9 +4041,9 @@ "arith_cvt" ], "longest_path_cycles": [ - 0.421875, + 0.4375, 0.3125, - 0.421875, + 0.4375, 0.1875, 0.0, 0.25, @@ -4075,9 +4075,9 @@ "arith_cvt" ], "total_cycles": [ - 0.546875, + 0.5625, 0.34375, - 0.546875, + 0.5625, 0.1875, 0.0, 0.25, @@ -4104,7 +4104,7 @@ "arithmetic" ], "longest_path_cycles": [ - 6.929999828338623, + 7.260000228881836, 1.0, 1.0 ], @@ -4125,7 +4125,7 @@ "arithmetic" ], "total_cycles": [ - 7.666666507720947, + 8.0, 1.0, 1.0 ] @@ -4150,7 +4150,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 67, + "fp16_arithmetic": 28, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -4178,10 +4178,10 @@ "varying" ], "shortest_path_cycles": [ - 0.1875, + 0.203125, 0.171875, - 0.1875, - 0.0625, + 0.203125, + 0.125, 0.0, 0.25, 0.0 @@ -4190,10 +4190,10 @@ "load_store" ], "total_cycles": [ - 0.762499988079071, - 0.359375, - 0.762499988079071, - 0.1875, + 0.800000011920929, + 0.375, + 0.800000011920929, + 0.25, 4.0, 0.25, 0.0 @@ -4240,7 +4240,7 @@ "arithmetic" ], "total_cycles": [ - 9.666666984558105, + 10.0, 4.0, 0.0 ] @@ -5039,18 +5039,17 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 31, + "fp16_arithmetic": 2, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ "arith_total", - "arith_fma", "arith_cvt" ], "longest_path_cycles": [ + 0.484375, 0.46875, - 0.46875, - 0.46875, + 0.484375, 0.375, 0.0, 0.25, @@ -5083,9 +5082,9 @@ "arith_cvt" ], "total_cycles": [ - 0.5625, + 0.578125, 0.5, - 0.5625, + 0.578125, 0.375, 0.0, 0.25, @@ -5112,7 +5111,7 @@ "arithmetic" ], "longest_path_cycles": [ - 7.590000152587891, + 7.920000076293945, 1.0, 1.0 ], @@ -5133,7 +5132,7 @@ "arithmetic" ], "total_cycles": [ - 8.333333015441895, + 8.666666984558105, 1.0, 1.0 ] @@ -6840,20 +6839,18 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 90, + "fp16_arithmetic": 28, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ "arith_total", - "arith_cvt", - "varying", - "texture" + "arith_cvt" ], "longest_path_cycles": [ - 0.25, + 0.296875, 0.234375, - 0.25, - 0.0, + 0.296875, + 0.0625, 0.0, 0.25, 0.25 @@ -6871,10 +6868,10 @@ "varying" ], "shortest_path_cycles": [ + 0.171875, 0.140625, - 0.140625, - 0.140625, - 0.0, + 0.171875, + 0.0625, 0.0, 0.25, 0.0 @@ -6884,10 +6881,10 @@ "arith_cvt" ], "total_cycles": [ - 0.34375, + 0.390625, 0.265625, - 0.34375, - 0.0, + 0.390625, + 0.0625, 0.0, 0.25, 0.25 @@ -6895,7 +6892,7 @@ }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 16, + "uniform_registers_used": 18, "work_registers_used": 7 } } @@ -6914,7 +6911,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 43, + "fp16_arithmetic": 32, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -6956,7 +6953,7 @@ ], "total_cycles": [ 0.699999988079071, - 0.40625, + 0.390625, 0.699999988079071, 0.5625, 4.0, @@ -6985,7 +6982,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 41, + "fp16_arithmetic": 30, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -7026,7 +7023,7 @@ ], "total_cycles": [ 0.84375, - 0.359375, + 0.34375, 0.84375, 0.25, 4.0, @@ -7382,7 +7379,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 64, + "fp16_arithmetic": 16, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -7390,10 +7387,10 @@ "arith_cvt" ], "longest_path_cycles": [ - 0.28125, + 0.328125, 0.25, - 0.28125, - 0.0625, + 0.328125, + 0.125, 0.0, 0.25, 0.25 @@ -7411,10 +7408,10 @@ "varying" ], "shortest_path_cycles": [ - 0.171875, + 0.203125, 0.15625, - 0.171875, - 0.0625, + 0.203125, + 0.125, 0.0, 0.25, 0.0 @@ -7424,10 +7421,10 @@ "arith_cvt" ], "total_cycles": [ - 0.375, + 0.421875, 0.28125, - 0.375, - 0.0625, + 0.421875, + 0.125, 0.0, 0.25, 0.25 @@ -7436,7 +7433,7 @@ "stack_spill_bytes": 0, "thread_occupancy": 100, "uniform_registers_used": 16, - "work_registers_used": 7 + "work_registers_used": 8 } } } @@ -7454,7 +7451,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 54, + "fp16_arithmetic": 26, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -7483,10 +7480,10 @@ "arith_sfu" ], "shortest_path_cycles": [ - 0.5625, + 0.625, 0.21875, - 0.265625, - 0.5625, + 0.28125, + 0.625, 0.0, 0.25, 0.0 @@ -7495,10 +7492,10 @@ "load_store" ], "total_cycles": [ - 0.699999988079071, - 0.421875, - 0.699999988079071, - 0.625, + 0.737500011920929, + 0.4375, + 0.737500011920929, + 0.6875, 4.0, 0.25, 0.0 @@ -7525,7 +7522,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 58, + "fp16_arithmetic": 28, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -7553,10 +7550,10 @@ "varying" ], "shortest_path_cycles": [ + 0.1875, 0.171875, - 0.171875, - 0.171875, - 0.0625, + 0.1875, + 0.125, 0.0, 0.25, 0.0 @@ -7565,10 +7562,10 @@ "load_store" ], "total_cycles": [ - 0.84375, - 0.359375, - 0.84375, - 0.25, + 0.875, + 0.375, + 0.875, + 0.3125, 4.0, 0.25, 0.0 @@ -8099,7 +8096,7 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 43, + "fp16_arithmetic": 10, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ @@ -8109,8 +8106,8 @@ "longest_path_cycles": [ 0.40625, 0.40625, + 0.359375, 0.3125, - 0.25, 0.0, 0.25, 0.25 @@ -8126,26 +8123,27 @@ ], "shortest_path_bound_pipelines": [ "arith_total", - "arith_fma" + "arith_fma", + "arith_sfu" ], "shortest_path_cycles": [ 0.3125, 0.3125, - 0.203125, - 0.25, + 0.234375, + 0.3125, 0.0, 0.25, 0.0 ], "total_bound_pipelines": [ "arith_total", - "arith_fma" + "arith_cvt" ], "total_cycles": [ + 0.453125, 0.4375, - 0.4375, - 0.40625, - 0.25, + 0.453125, + 0.3125, 0.0, 0.25, 0.25 @@ -8154,7 +8152,7 @@ "stack_spill_bytes": 0, "thread_occupancy": 100, "uniform_registers_used": 22, - "work_registers_used": 14 + "work_registers_used": 15 } } }