use shared EGLContext for ANGLE on Windows
This commit is contained in:
@@ -11,21 +11,11 @@
|
||||
#include <Windows.h>
|
||||
#include <wrl.h>
|
||||
|
||||
#ifdef USE_ANGLE
|
||||
#include <d3d.h>
|
||||
#include <d3d11.h>
|
||||
#endif
|
||||
|
||||
#include "GL/GL.h"
|
||||
#include "GL/GLu.h"
|
||||
|
||||
#ifdef USE_ANGLE
|
||||
#include "EGL/egl.h"
|
||||
#include "EGL/eglext.h"
|
||||
#include "EGL/eglplatform.h"
|
||||
#include "GLES2/gl2.h"
|
||||
#include "GLES2/gl2ext.h"
|
||||
#include "PlatformAngle.h"
|
||||
#include "flutter_angle_texture.h"
|
||||
#else
|
||||
#include "opengl_texture_buffer.h"
|
||||
#endif
|
||||
@@ -53,33 +43,9 @@ public:
|
||||
|
||||
flutter::PluginRegistrarWindows *_pluginRegistrar;
|
||||
flutter::TextureRegistrar *_textureRegistrar;
|
||||
|
||||
std::map<uint32_t, ResourceBuffer> _resources;
|
||||
|
||||
std::unique_ptr<FlutterDesktopGpuSurfaceDescriptor> _textureDescriptor = nullptr;
|
||||
|
||||
#ifdef USE_ANGLE
|
||||
// Device
|
||||
ID3D11Device* _D3D11Device = nullptr;
|
||||
ID3D11DeviceContext* _D3D11DeviceContext = nullptr;
|
||||
// Texture objects/shared handles
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> _externalD3DTexture2D;
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> _internalD3DTexture2D;
|
||||
HANDLE _externalD3DTextureHandle = nullptr;
|
||||
HANDLE _internalD3DTextureHandle = nullptr;
|
||||
filament::backend::PlatformANGLE* _platform = nullptr;
|
||||
|
||||
bool MakeD3DTexture(uint32_t width, uint32_t height, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
#else
|
||||
std::shared_ptr<std::mutex> _renderMutex;
|
||||
std::unique_ptr<OpenGLTextureBuffer> _active = nullptr;
|
||||
std::unique_ptr<OpenGLTextureBuffer> _inactive = nullptr;
|
||||
|
||||
// shared OpenGLContext
|
||||
HGLRC _context = NULL;
|
||||
bool MakeOpenGLTexture(uint32_t width, uint32_t height, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
#endif
|
||||
|
||||
|
||||
void CreateTexture(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &methodCall,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
@@ -90,6 +56,25 @@ public:
|
||||
|
||||
ResourceBuffer loadResource(const char *path);
|
||||
void freeResource(ResourceBuffer rbuf);
|
||||
|
||||
private:
|
||||
#ifdef USE_ANGLE
|
||||
EGLContext _context = NULL;
|
||||
EGLConfig _eglConfig = NULL;
|
||||
EGLDisplay _eglDisplay = NULL;
|
||||
std::unique_ptr<FlutterAngleTexture> _active = nullptr;
|
||||
ID3D11Device* _D3D11Device = nullptr;
|
||||
ID3D11DeviceContext* _D3D11DeviceContext = nullptr;
|
||||
bool CreateSharedEGLContext();
|
||||
bool MakeD3DTexture(uint32_t width, uint32_t height, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
#else
|
||||
std::unique_ptr<OpenGLTextureBuffer> _active = nullptr;
|
||||
std::unique_ptr<OpenGLTextureBuffer> _inactive = nullptr;
|
||||
// shared OpenGLContext
|
||||
HGLRC _context = NULL;
|
||||
bool CreateSharedWGLContext();
|
||||
bool MakeOpenGLTexture(uint32_t width, uint32_t height, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace polyvox_filament
|
||||
|
||||
Reference in New Issue
Block a user