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

Commit 82f0224

Browse files
author
Jonah Williams
authored
[Impeller] fix OES texture usage. (#55331)
Fixes flutter/flutter#141636 by ensuring that oes textures create a tiled texture contents. This needs a real test though. probably an intergration test with camera.
1 parent 7cd3d0b commit 82f0224

File tree

3 files changed

+137
-0
lines changed

3 files changed

+137
-0
lines changed

.ci.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,27 @@ targets:
9494
- testing/scenario_app/**
9595
- testing/skia_gold_client/**
9696

97+
- name: Linux linux_android_emulator_opengles_tests_34
98+
bringup: true
99+
enabled_branches:
100+
- main
101+
recipe: engine_v2/engine_v2
102+
properties:
103+
config_name: linux_android_emulator_opengles_34
104+
dependencies: >-
105+
[
106+
{"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}
107+
]
108+
timeout: 90
109+
runIf:
110+
- .ci.yaml
111+
- ci/builders/linux_android_emulator_opengles_34.json
112+
- DEPS
113+
- lib/ui/**
114+
- shell/platform/android/**
115+
- testing/scenario_app/**
116+
- testing/skia_gold_client/**
117+
97118
- name: Linux linux_android_emulator_skia_tests
98119
bringup: true
99120
enabled_branches:
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"builds": [
3+
{
4+
"drone_dimensions": [
5+
"device_type=none",
6+
"os=Linux",
7+
"kvm=1",
8+
"cores=8"
9+
],
10+
"gclient_variables": {
11+
"use_rbe": true
12+
},
13+
"gn": [
14+
"--android",
15+
"--android-cpu=x64",
16+
"--no-lto",
17+
"--rbe",
18+
"--no-goma",
19+
"--target-dir",
20+
"ci/android_emulator_debug_x64"
21+
],
22+
"dependencies": [
23+
{
24+
"dependency": "goldctl",
25+
"version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"
26+
}
27+
],
28+
"name": "ci/android_emulator_debug_x64",
29+
"description": "Build for debug mode x64 Android emulator tests, and Impeller scenario app tests.",
30+
"ninja": {
31+
"config": "ci/android_emulator_debug_x64",
32+
"targets": [
33+
"flutter/impeller/toolkit/android:unittests",
34+
"flutter/shell/platform/android:flutter_shell_native_unittests",
35+
"flutter/testing/scenario_app"
36+
]
37+
},
38+
"tests": [
39+
{
40+
"language": "python3",
41+
"name": "Android Unit Tests",
42+
"test_dependencies": [
43+
{
44+
"dependency": "android_virtual_device",
45+
"version": "android_34_google_apis_x64.textpb"
46+
},
47+
{
48+
"dependency": "avd_cipd_version",
49+
"version": "build_id:8740267484269553649"
50+
}
51+
],
52+
"contexts": [
53+
"android_virtual_device"
54+
],
55+
"script": "flutter/testing/run_tests.py",
56+
"parameters": [
57+
"--android-variant",
58+
"ci/android_emulator_debug_x64",
59+
"--type",
60+
"android"
61+
]
62+
},
63+
{
64+
"language": "dart",
65+
"name": "skia_gold_client/e2e_test",
66+
"script": "flutter/testing/skia_gold_client/tool/e2e_test.dart",
67+
"max_attempts": 1
68+
},
69+
{
70+
"language": "dart",
71+
"name": "Android Scenario App Integration Tests (Impeller/GLES)",
72+
"test_timeout_secs": 900,
73+
"max_attempts": 2,
74+
"test_dependencies": [
75+
{
76+
"dependency": "android_virtual_device",
77+
"version": "android_34_google_apis_x64.textpb"
78+
},
79+
{
80+
"dependency": "avd_cipd_version",
81+
"version": "build_id:8740267484269553649"
82+
}
83+
],
84+
"contexts": [
85+
"android_virtual_device"
86+
],
87+
"script": "flutter/testing/scenario_app/bin/run_android_tests.dart",
88+
"parameters": [
89+
"--out-dir=../out/ci/android_emulator_debug_x64",
90+
"--enable-impeller",
91+
"--impeller-backend=opengles"
92+
]
93+
}
94+
]
95+
}
96+
]
97+
}

impeller/aiks/canvas.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "impeller/entity/contents/solid_rrect_blur_contents.h"
2222
#include "impeller/entity/contents/text_contents.h"
2323
#include "impeller/entity/contents/texture_contents.h"
24+
#include "impeller/entity/contents/tiled_texture_contents.h"
2425
#include "impeller/entity/contents/vertices_contents.h"
2526
#include "impeller/entity/geometry/geometry.h"
2627
#include "impeller/entity/geometry/superellipse_geometry.h"
@@ -743,6 +744,24 @@ void Canvas::DrawImageRect(const std::shared_ptr<Texture>& image,
743744
return;
744745
}
745746

747+
if (image->GetTextureDescriptor().type == TextureType::kTextureExternalOES) {
748+
auto texture_contents = std::make_shared<TiledTextureContents>();
749+
texture_contents->SetTexture(image);
750+
texture_contents->SetGeometry(Geometry::MakeRect(dest));
751+
texture_contents->SetSamplerDescriptor(std::move(sampler));
752+
texture_contents->SetInheritedOpacity(paint.color.alpha);
753+
754+
std::shared_ptr<Contents> contents = texture_contents;
755+
756+
Entity entity;
757+
entity.SetBlendMode(paint.blend_mode);
758+
entity.SetContents(paint.WithFilters(contents));
759+
entity.SetTransform(GetCurrentTransform());
760+
761+
AddRenderEntityToCurrentPass(std::move(entity));
762+
return;
763+
}
764+
746765
auto texture_contents = TextureContents::MakeRect(dest);
747766
texture_contents->SetTexture(image);
748767
texture_contents->SetSourceRect(source);

0 commit comments

Comments
 (0)