[Flutter GPU] Remove the redundant smoketest. (flutter/engine#55267)

This is placeholder stuff that I added before the rest of the API to prove that we can call the engine symbols.

Today this is totally redundant as Flutter GPU has a bunch of automated tests which exercise every FFI call.
This commit is contained in:
Brandon DeRosier
2024-09-17 15:24:07 -07:00
committed by GitHub
parent c62d331944
commit a2fe41a763
7 changed files with 0 additions and 178 deletions

View File

@@ -43340,7 +43340,6 @@ ORIGIN: ../../../flutter/lib/gpu/lib/src/render_pass.dart + ../../../flutter/LIC
ORIGIN: ../../../flutter/lib/gpu/lib/src/render_pipeline.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/lib/src/shader.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/lib/src/shader_library.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/lib/src/smoketest.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/lib/src/texture.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/render_pass.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/render_pass.h + ../../../flutter/LICENSE
@@ -43350,8 +43349,6 @@ ORIGIN: ../../../flutter/lib/gpu/shader.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/shader.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/shader_library.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/shader_library.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/smoketest.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/smoketest.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/texture.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/gpu/texture.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/lib/io/dart_io.cc + ../../../flutter/LICENSE
@@ -46188,7 +46185,6 @@ FILE: ../../../flutter/lib/gpu/lib/src/render_pass.dart
FILE: ../../../flutter/lib/gpu/lib/src/render_pipeline.dart
FILE: ../../../flutter/lib/gpu/lib/src/shader.dart
FILE: ../../../flutter/lib/gpu/lib/src/shader_library.dart
FILE: ../../../flutter/lib/gpu/lib/src/smoketest.dart
FILE: ../../../flutter/lib/gpu/lib/src/texture.dart
FILE: ../../../flutter/lib/gpu/render_pass.cc
FILE: ../../../flutter/lib/gpu/render_pass.h
@@ -46198,8 +46194,6 @@ FILE: ../../../flutter/lib/gpu/shader.cc
FILE: ../../../flutter/lib/gpu/shader.h
FILE: ../../../flutter/lib/gpu/shader_library.cc
FILE: ../../../flutter/lib/gpu/shader_library.h
FILE: ../../../flutter/lib/gpu/smoketest.cc
FILE: ../../../flutter/lib/gpu/smoketest.h
FILE: ../../../flutter/lib/gpu/texture.cc
FILE: ../../../flutter/lib/gpu/texture.h
FILE: ../../../flutter/lib/io/dart_io.cc

View File

@@ -54,8 +54,6 @@ source_set("gpu") {
"shader.h",
"shader_library.cc",
"shader_library.h",
"smoketest.cc",
"smoketest.h",
"texture.cc",
"texture.h",
]

View File

@@ -26,8 +26,6 @@ import 'dart:typed_data';
// ignore: uri_does_not_exist
import 'dart:ui' as ui;
export 'src/smoketest.dart';
part 'src/buffer.dart';
part 'src/command_buffer.dart';
part 'src/context.dart';

View File

@@ -1,40 +0,0 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ffi';
import 'dart:nativewrappers';
/// This is a simple test fuction.
@Native<Int32 Function()>(symbol: 'InternalFlutterGpuTestProc')
external int testProc();
/// A single parameter callback.
typedef Callback<T> = void Function(T result);
/// This is a test callback that follows the same pattern as much of dart:ui --
/// immediately returning an error string and supplying an asynchronous result
/// via callback later.
@Native<Handle Function(Handle)>(
symbol: 'InternalFlutterGpuTestProcWithCallback')
external String? testProcWithCallback(Callback<int> callback);
/// This is a test of NativeFieldWrapperClass1, which is commonly used in
/// dart:ui to enable Dart to dictate the lifetime of a C counterpart.
base class FlutterGpuTestClass extends NativeFieldWrapperClass1 {
/// Default constructor for the test class
FlutterGpuTestClass() {
_constructor();
}
/// This "constructor" is used to instantiate and wrap the C counterpart.
/// This is a common pattern in dart:ui.
@Native<Void Function(Handle)>(symbol: 'InternalFlutterGpuTestClass_Create')
external void _constructor();
/// This is a method that will supply a pointer to the C data counterpart when
/// calling the function
@Native<Void Function(Pointer<Void>, Int)>(
symbol: 'InternalFlutterGpuTestClass_Method')
external void coolMethod(int something);
}

View File

@@ -1,58 +0,0 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/lib/gpu/smoketest.h"
#include "flutter/fml/memory/ref_ptr.h"
#include "flutter/lib/ui/dart_wrapper.h"
#include "flutter/lib/ui/ui_dart_state.h"
#include "third_party/dart/runtime/include/dart_api.h"
#include "third_party/tonic/converter/dart_converter.h"
#include "third_party/tonic/dart_state.h"
#include "third_party/tonic/dart_wrappable.h"
#include "third_party/tonic/dart_wrapper_info.h"
#include "third_party/tonic/logging/dart_invoke.h"
namespace flutter {
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
IMPLEMENT_WRAPPERTYPEINFO(flutter_gpu, FlutterGpuTestClass);
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
FlutterGpuTestClass::~FlutterGpuTestClass() = default;
} // namespace flutter
//----------------------------------------------------------------------------
/// Exports
///
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
uint32_t InternalFlutterGpuTestProc() {
return 1;
}
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
Dart_Handle InternalFlutterGpuTestProcWithCallback(Dart_Handle callback) {
flutter::UIDartState::ThrowIfUIOperationsProhibited();
if (!Dart_IsClosure(callback)) {
return tonic::ToDart("Callback must be a function");
}
tonic::DartInvoke(callback, {tonic::ToDart(1234)});
return Dart_Null();
}
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
void InternalFlutterGpuTestClass_Create(Dart_Handle wrapper) {
auto res = fml::MakeRefCounted<flutter::FlutterGpuTestClass>();
res->AssociateWithDartWrapper(wrapper);
FML_LOG(INFO) << "FlutterGpuTestClass Wrapped.";
}
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
void InternalFlutterGpuTestClass_Method(flutter::FlutterGpuTestClass* self,
int something) {
FML_LOG(INFO) << "Something: " << something;
}

View File

@@ -1,56 +0,0 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_LIB_GPU_SMOKETEST_H_
#define FLUTTER_LIB_GPU_SMOKETEST_H_
#include <cstdint>
#include "flutter/lib/gpu/export.h"
#include "flutter/lib/ui/dart_wrapper.h"
#include "third_party/dart/runtime/include/dart_api.h"
#include "third_party/tonic/dart_state.h"
#include "third_party/tonic/dart_wrapper_info.h"
namespace flutter {
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
class FlutterGpuTestClass
: public RefCountedDartWrappable<FlutterGpuTestClass> {
DEFINE_WRAPPERTYPEINFO();
FML_FRIEND_MAKE_REF_COUNTED(FlutterGpuTestClass);
public:
~FlutterGpuTestClass() override;
};
} // namespace flutter
//----------------------------------------------------------------------------
/// Exports
///
extern "C" {
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
FLUTTER_GPU_EXPORT
extern uint32_t InternalFlutterGpuTestProc();
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
FLUTTER_GPU_EXPORT
extern Dart_Handle InternalFlutterGpuTestProcWithCallback(Dart_Handle callback);
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
FLUTTER_GPU_EXPORT
extern void InternalFlutterGpuTestClass_Create(Dart_Handle wrapper);
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
FLUTTER_GPU_EXPORT
extern void InternalFlutterGpuTestClass_Method(
flutter::FlutterGpuTestClass* self,
int something);
} // extern "C"
#endif // FLUTTER_LIB_GPU_SMOKETEST_H_

View File

@@ -35,20 +35,6 @@ gpu.RenderPipeline createUnlitRenderPipeline() {
void main() async {
final ImageComparer comparer = await ImageComparer.create();
// TODO(131346): Remove this once we migrate the Dart GPU API into this space.
test('smoketest', () async {
final int result = gpu.testProc();
expect(result, 1);
final String? message = gpu.testProcWithCallback((int result) {
expect(result, 1234);
});
expect(message, null);
final gpu.FlutterGpuTestClass a = gpu.FlutterGpuTestClass();
a.coolMethod(9847);
});
test('gpu.context throws exception for incompatible embedders', () async {
try {
// ignore: unnecessary_statements