[Impeller] fix OES texture usage. (flutter/engine#55331)

Fixes https://github.com/flutter/flutter/issues/141636 by ensuring that oes textures create a tiled texture contents. This needs a real test though. probably an intergration test with camera.
This commit is contained in:
Jonah Williams 2024-09-24 12:25:04 -07:00 committed by GitHub
parent 2c82447739
commit a800331240
3 changed files with 137 additions and 0 deletions

View File

@ -94,6 +94,27 @@ targets:
- testing/scenario_app/**
- testing/skia_gold_client/**
- name: Linux linux_android_emulator_opengles_tests_34
bringup: true
enabled_branches:
- main
recipe: engine_v2/engine_v2
properties:
config_name: linux_android_emulator_opengles_34
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}
]
timeout: 90
runIf:
- .ci.yaml
- ci/builders/linux_android_emulator_opengles_34.json
- DEPS
- lib/ui/**
- shell/platform/android/**
- testing/scenario_app/**
- testing/skia_gold_client/**
- name: Linux linux_android_emulator_skia_tests
bringup: true
enabled_branches:

View File

@ -0,0 +1,97 @@
{
"builds": [
{
"drone_dimensions": [
"device_type=none",
"os=Linux",
"kvm=1",
"cores=8"
],
"gclient_variables": {
"use_rbe": true
},
"gn": [
"--android",
"--android-cpu=x64",
"--no-lto",
"--rbe",
"--no-goma",
"--target-dir",
"ci/android_emulator_debug_x64"
],
"dependencies": [
{
"dependency": "goldctl",
"version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"
}
],
"name": "ci/android_emulator_debug_x64",
"description": "Build for debug mode x64 Android emulator tests, and Impeller scenario app tests.",
"ninja": {
"config": "ci/android_emulator_debug_x64",
"targets": [
"flutter/impeller/toolkit/android:unittests",
"flutter/shell/platform/android:flutter_shell_native_unittests",
"flutter/testing/scenario_app"
]
},
"tests": [
{
"language": "python3",
"name": "Android Unit Tests",
"test_dependencies": [
{
"dependency": "android_virtual_device",
"version": "android_34_google_apis_x64.textpb"
},
{
"dependency": "avd_cipd_version",
"version": "build_id:8740267484269553649"
}
],
"contexts": [
"android_virtual_device"
],
"script": "flutter/testing/run_tests.py",
"parameters": [
"--android-variant",
"ci/android_emulator_debug_x64",
"--type",
"android"
]
},
{
"language": "dart",
"name": "skia_gold_client/e2e_test",
"script": "flutter/testing/skia_gold_client/tool/e2e_test.dart",
"max_attempts": 1
},
{
"language": "dart",
"name": "Android Scenario App Integration Tests (Impeller/GLES)",
"test_timeout_secs": 900,
"max_attempts": 2,
"test_dependencies": [
{
"dependency": "android_virtual_device",
"version": "android_34_google_apis_x64.textpb"
},
{
"dependency": "avd_cipd_version",
"version": "build_id:8740267484269553649"
}
],
"contexts": [
"android_virtual_device"
],
"script": "flutter/testing/scenario_app/bin/run_android_tests.dart",
"parameters": [
"--out-dir=../out/ci/android_emulator_debug_x64",
"--enable-impeller",
"--impeller-backend=opengles"
]
}
]
}
]
}

View File

@ -21,6 +21,7 @@
#include "impeller/entity/contents/solid_rrect_blur_contents.h"
#include "impeller/entity/contents/text_contents.h"
#include "impeller/entity/contents/texture_contents.h"
#include "impeller/entity/contents/tiled_texture_contents.h"
#include "impeller/entity/contents/vertices_contents.h"
#include "impeller/entity/geometry/geometry.h"
#include "impeller/entity/geometry/superellipse_geometry.h"
@ -743,6 +744,24 @@ void Canvas::DrawImageRect(const std::shared_ptr<Texture>& image,
return;
}
if (image->GetTextureDescriptor().type == TextureType::kTextureExternalOES) {
auto texture_contents = std::make_shared<TiledTextureContents>();
texture_contents->SetTexture(image);
texture_contents->SetGeometry(Geometry::MakeRect(dest));
texture_contents->SetSamplerDescriptor(std::move(sampler));
texture_contents->SetInheritedOpacity(paint.color.alpha);
std::shared_ptr<Contents> contents = texture_contents;
Entity entity;
entity.SetBlendMode(paint.blend_mode);
entity.SetContents(paint.WithFilters(contents));
entity.SetTransform(GetCurrentTransform());
AddRenderEntityToCurrentPass(std::move(entity));
return;
}
auto texture_contents = TextureContents::MakeRect(dest);
texture_contents->SetTexture(image);
texture_contents->SetSourceRect(source);