re-implement pixel buffer on Windows with compile-time switch
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -594,3 +594,4 @@ windows/lib/Debug/angle/* filter=lfs diff=lfs merge=lfs -text
|
||||
windows/lib/Debug/opengl/* filter=lfs diff=lfs merge=lfs -text
|
||||
windows/lib/Release/opengl/* filter=lfs diff=lfs merge=lfs -text
|
||||
windows/lib/Release/angle/* filter=lfs diff=lfs merge=lfs -text
|
||||
windows/lib/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
@@ -166,7 +166,7 @@ class FilamentControllerFFI extends FilamentController {
|
||||
size.height.toInt());
|
||||
if (nativeTexture != 0) {
|
||||
assert(surfaceAddress == 0);
|
||||
_lib.create_render_target(
|
||||
_lib.create_render_target_ffi(
|
||||
_viewer!, nativeTexture, size.width.toInt(), size.height.toInt());
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,10 @@ list(APPEND PLUGIN_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/TimeIt.cpp"
|
||||
)
|
||||
|
||||
set(USE_ANGLE TRUE)
|
||||
|
||||
add_compile_definitions(USE_ANGLE=${USE_ANGLE})
|
||||
set(USE_ANGLE FALSE)
|
||||
|
||||
if(USE_ANGLE)
|
||||
add_compile_definitions(USE_ANGLE)
|
||||
list(APPEND PLUGIN_SOURCES "PlatformAngle.cpp")
|
||||
endif()
|
||||
|
||||
@@ -68,6 +67,8 @@ if(USE_ANGLE)
|
||||
else()
|
||||
list(APPEND GL_LIBS
|
||||
bluegl
|
||||
bluevk
|
||||
vkshaders
|
||||
opengl32
|
||||
)
|
||||
set(ANGLE_OR_OPENGL_DIR opengl)
|
||||
@@ -88,9 +89,9 @@ set_property(TARGET geometry PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_S
|
||||
set_property(TARGET geometry PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/geometry.lib")
|
||||
|
||||
add_library(filament SHARED IMPORTED)
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/filament.lib")
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filament.lib")
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filament.lib")
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/${ANGLE_OR_OPENGL_DIR}/filament.lib")
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/${ANGLE_OR_OPENGL_DIR}/filament.lib")
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/${ANGLE_OR_OPENGL_DIR}/filament.lib")
|
||||
|
||||
add_library(filameshio SHARED IMPORTED)
|
||||
set_property(TARGET filameshio PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/filameshio.lib")
|
||||
|
||||
3
windows/lib/Debug/bluevk.lib
Normal file
3
windows/lib/Debug/bluevk.lib
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8d5482809fcb58a23bae84219e39939740da3bddf8d6c13593f2cb1fa0c17c5a
|
||||
size 1179532
|
||||
3
windows/lib/Debug/opengl/backend.lib
Normal file
3
windows/lib/Debug/opengl/backend.lib
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1a92c10991b982967746b267ba90e0e4e766dc41f2648232fece244c35981981
|
||||
size 54897670
|
||||
3
windows/lib/Debug/opengl/filament.lib
Normal file
3
windows/lib/Debug/opengl/filament.lib
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:13b87d4eefacd3e4136d368697279c0e9c60da4ed2fb8dd5ce3490be1874ca8d
|
||||
size 155917302
|
||||
3
windows/lib/Debug/opengl/uberarchive.lib
Normal file
3
windows/lib/Debug/opengl/uberarchive.lib
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8aec12bdd40d4ac62d0d1ee3d7bd84b5719cf117e68acc0b75cbc85cb335970e
|
||||
size 8271488
|
||||
3
windows/lib/Debug/vkshaders.lib
Normal file
3
windows/lib/Debug/vkshaders.lib
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6e37d424407789cf7bb86e0af691ddb9a7e810465424db6225c4b43bed2c7454
|
||||
size 9806
|
||||
@@ -387,6 +387,7 @@ bool PolyvoxFilamentPlugin::MakeOpenGLTexture(uint32_t width, uint32_t height,st
|
||||
result->Error("ERROR", "Failed to generate texture, GL error was %d", err);
|
||||
return false;
|
||||
}
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
|
||||
_pixelData.reset(new uint8_t[width * height * 4]);
|
||||
_pixelBuffer = std::make_unique<FlutterDesktopPixelBuffer>();
|
||||
@@ -431,6 +432,16 @@ bool PolyvoxFilamentPlugin::MakeOpenGLTexture(uint32_t width, uint32_t height,st
|
||||
return _pixelBuffer.get();
|
||||
}));
|
||||
|
||||
_flutterTextureId = _textureRegistrar->RegisterTexture(_texture.get());
|
||||
std::cout << "Registered Flutter texture ID " << _flutterTextureId << std::endl;
|
||||
|
||||
std::vector<flutter::EncodableValue> resultList;
|
||||
resultList.push_back(flutter::EncodableValue(_flutterTextureId));
|
||||
resultList.push_back(flutter::EncodableValue((int64_t)nullptr));
|
||||
resultList.push_back(flutter::EncodableValue(_glTextureId));
|
||||
result->Success(resultList);
|
||||
return true;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -448,11 +459,7 @@ void PolyvoxFilamentPlugin::CreateTexture(
|
||||
bool success = MakeD3DTexture(width, height, std::move(result));
|
||||
#else
|
||||
bool success = MakeOpenGLTexture(width, height, std::move(result));
|
||||
#endif
|
||||
if(!success) {
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void PolyvoxFilamentPlugin::HandleMethodCall(
|
||||
@@ -461,7 +468,11 @@ void PolyvoxFilamentPlugin::HandleMethodCall(
|
||||
|
||||
// std::cout << methodCall.method_name() << std::endl;
|
||||
if (methodCall.method_name() == "getSharedContext") {
|
||||
#ifdef USE_ANGLE
|
||||
result->Success(flutter::EncodableValue((int64_t)nullptr));
|
||||
#else
|
||||
result->Success(flutter::EncodableValue((int64_t)_context));
|
||||
#endif
|
||||
} else if (methodCall.method_name() == "getResourceLoaderWrapper") {
|
||||
const ResourceLoaderWrapper *const resourceLoader =
|
||||
new ResourceLoaderWrapper(_loadResource, _freeResource, this);
|
||||
@@ -474,7 +485,11 @@ void PolyvoxFilamentPlugin::HandleMethodCall(
|
||||
resultList.push_back(flutter::EncodableValue((int64_t)this));
|
||||
result->Success(resultList);
|
||||
} else if(methodCall.method_name() == "getDriverPlatform") {
|
||||
result->Success(flutter::EncodableValue((int64_t)_platform));
|
||||
#ifdef USE_ANGLE
|
||||
result->Success(flutter::EncodableValue((int64_t)_platform));
|
||||
#else
|
||||
result->Success(flutter::EncodableValue((int64_t)nullptr));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
result->Error("NOT_IMPLEMENTED", "Method is not implemented %s", methodCall.method_name());
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#include "EGL/eglplatform.h"
|
||||
#include "GLES2/gl2.h"
|
||||
#include "GLES2/gl2ext.h"
|
||||
#include "PlatformAngle.h"
|
||||
#endif
|
||||
|
||||
#include "PolyvoxFilamentApi.h"
|
||||
#include "PlatformAngle.h"
|
||||
|
||||
namespace polyvox_filament {
|
||||
|
||||
@@ -73,11 +73,15 @@ public:
|
||||
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
|
||||
// OpenGL
|
||||
HGLRC _context = NULL;
|
||||
GLuint _glTextureId = 0;
|
||||
std::mutex _renderMutex;
|
||||
|
||||
bool MakeOpenGLTexture(uint32_t width, uint32_t height, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
#endif
|
||||
|
||||
void CreateTexture(
|
||||
@@ -88,11 +92,6 @@ public:
|
||||
|
||||
ResourceBuffer loadResource(const char *path);
|
||||
void freeResource(ResourceBuffer rbuf);
|
||||
#ifdef USE_ANGLE
|
||||
bool MakeD3DTexture(uint32_t width, uint32_t height, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
#else
|
||||
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