[Flutter GPU] Run unittests on CI and fix HostBuffer. (flutter/engine#49789)

The Flutter GPU tests were broken, and it turns out that I had never set them up to run on CI. This fixes the HostBuffer and gets the test suite running on CI.
This commit is contained in:
Brandon DeRosier
2024-01-16 11:01:54 -08:00
committed by GitHub
parent 37233b0ec3
commit c38b3676d9
5 changed files with 19 additions and 3 deletions

View File

@@ -149,12 +149,15 @@ impeller_component("renderer_dart_unittests") {
sources = [ "renderer_dart_unittests.cc" ]
public_configs = [ "//flutter:export_dynamic_symbols" ]
deps = [
":renderer",
"../fixtures:flutter_gpu_fixtures",
"../fixtures:flutter_gpu_shaders",
"../playground:playground_test",
"//flutter/lib/gpu",
"//flutter/lib/snapshot",
"//flutter/runtime:runtime",
"//flutter/testing:fixture_test",
"//flutter/testing:testing",

View File

@@ -31,8 +31,9 @@ size_t HostBuffer::EmplaceBytes(const tonic::DartByteData& byte_data) {
host_buffer_->Emplace(byte_data.data(), byte_data.length_in_bytes(),
impeller::DefaultUniformAlignment());
emplacements_[current_offset_] = view;
size_t previous_offset = current_offset_;
current_offset_ += view.range.length;
return view.range.offset;
return previous_offset;
}
std::optional<impeller::BufferView> HostBuffer::GetBufferViewForOffset(

View File

@@ -48,7 +48,9 @@ class HostBuffer : public RefCountedDartWrappable<HostBuffer> {
extern "C" {
FLUTTER_GPU_EXPORT
extern void InternalFlutterGpu_HostBuffer_Initialize(Dart_Handle wrapper);
extern void InternalFlutterGpu_HostBuffer_Initialize(
Dart_Handle wrapper,
flutter::gpu::Context* context);
FLUTTER_GPU_EXPORT
extern size_t InternalFlutterGpu_HostBuffer_EmplaceBytes(

View File

@@ -161,7 +161,7 @@ base class HostBuffer extends NativeFieldWrapperClass1 with Buffer {
}
/// Wrap with native counterpart.
@Native<Void Function(Handle, Handle)>(
@Native<Void Function(Handle, Pointer<Void>)>(
symbol: 'InternalFlutterGpu_HostBuffer_Initialize')
external void _initialize(GpuContext gpuContext);

View File

@@ -553,6 +553,16 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
extra_env=extra_env,
)
# Run the Flutter GPU test suite.
run_engine_executable(
build_dir,
'impeller_dart_unittests',
executable_filter,
shuffle_flags + ['--enable_vulkan_validation'],
coverage=coverage,
extra_env=extra_env,
)
def run_engine_benchmarks(build_dir, executable_filter):
logger.info('Running Engine Benchmarks.')