remove custom platform creation from FlutterAngleTexture

This commit is contained in:
Nick Fisher
2023-10-23 01:36:03 +11:00
parent 0a612555b8
commit 69a7a07ec7

View File

@@ -137,7 +137,7 @@ void render_callback(void* owner) {
// this is the method on PolyvoxFilamentPlugin that will copy between D3D textures // this is the method on PolyvoxFilamentPlugin that will copy between D3D textures
void PolyvoxFilamentPlugin::RenderCallback() { void PolyvoxFilamentPlugin::RenderCallback() {
std::lock_guard<std::mutex> guard(*(_renderMutex.get())); // std::lock_guard<std::mutex> guard(*(_renderMutex.get()));
if (_active) { if (_active) {
#ifdef USE_ANGLE #ifdef USE_ANGLE
_active->RenderCallback(); _active->RenderCallback();
@@ -148,6 +148,11 @@ void PolyvoxFilamentPlugin::RenderCallback() {
#ifdef USE_ANGLE #ifdef USE_ANGLE
bool PolyvoxFilamentPlugin::CreateSharedEGLContext() { bool PolyvoxFilamentPlugin::CreateSharedEGLContext() {
//platform = new filament::backend::PlatformANGLE(_internalD3DTextureHandle,
// width, height);
_platform = new filament::backend::PlatformEGL();
// D3D starts here // D3D starts here
IDXGIAdapter* adapter_ = nullptr; IDXGIAdapter* adapter_ = nullptr;
@@ -222,9 +227,8 @@ bool PolyvoxFilamentPlugin::CreateSharedEGLContext() {
assert_invariant(_eglDisplay != EGL_NO_DISPLAY); assert_invariant(_eglDisplay != EGL_NO_DISPLAY);
EGLint major, minor; EGLint major, minor;
EGLBoolean initialized = false; // = eglInitialize(_eglDisplay, &major, &minor); EGLBoolean initialized = false;
// if (!initialized) {
EGLDeviceEXT eglDevice; EGLDeviceEXT eglDevice;
EGLint numDevices; EGLint numDevices;
@@ -442,6 +446,7 @@ void PolyvoxFilamentPlugin::DestroyTexture(
const flutter::MethodCall<flutter::EncodableValue> &methodCall, const flutter::MethodCall<flutter::EncodableValue> &methodCall,
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) { std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
const auto *flutterTextureId = const auto *flutterTextureId =
std::get_if<int64_t>(methodCall.arguments()); std::get_if<int64_t>(methodCall.arguments());
@@ -450,7 +455,6 @@ void PolyvoxFilamentPlugin::DestroyTexture(
return; return;
} }
if(!_active) { if(!_active) {
result->Success("Texture has already been detroyed, ignoring"); result->Success("Texture has already been detroyed, ignoring");
return; return;
@@ -463,11 +467,10 @@ void PolyvoxFilamentPlugin::DestroyTexture(
auto sh = std::make_shared<std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>>>(std::move(result)); auto sh = std::make_shared<std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>>>(std::move(result));
// result->Error("NOT_IMPLEMENTED", "Method is not implemented %s", methodCall.method_name());
_textureRegistrar->UnregisterTexture(_active->flutterTextureId, [=, _textureRegistrar->UnregisterTexture(_active->flutterTextureId, [=,
sharedResult=std::move(sh) sharedResult=std::move(sh)
]() { ]() {
#ifdef USE_ANGLE #ifdef USE_ANGLE
this->_active = nullptr; this->_active = nullptr;
#else #else
@@ -514,7 +517,7 @@ void PolyvoxFilamentPlugin::HandleMethodCall(
result->Success(resultList); result->Success(resultList);
} else if(methodCall.method_name() == "getDriverPlatform") { } else if(methodCall.method_name() == "getDriverPlatform") {
#ifdef USE_ANGLE #ifdef USE_ANGLE
result->Success(flutter::EncodableValue((int64_t)_active->platform)); result->Success(flutter::EncodableValue((int64_t)_platform));
#else #else
result->Success(flutter::EncodableValue((int64_t)nullptr)); result->Success(flutter::EncodableValue((int64_t)nullptr));
#endif #endif