Compare commits
4 Commits
MapAsyncEx
...
pf/test-os
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3fa1c7035 | ||
|
|
66abb75bc4 | ||
|
|
9e1ee2f290 | ||
|
|
22bb67e0b0 |
@@ -31,7 +31,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.google.android.filament:filament-android:1.55.0'
|
implementation 'com.google.android.filament:filament-android:1.55.1'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ Here are all the libraries available in the group `com.google.android.filament`:
|
|||||||
iOS projects can use CocoaPods to install the latest release:
|
iOS projects can use CocoaPods to install the latest release:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pod 'Filament', '~> 1.55.0'
|
pod 'Filament', '~> 1.55.1'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
GROUP=com.google.android.filament
|
GROUP=com.google.android.filament
|
||||||
VERSION_NAME=1.55.0
|
VERSION_NAME=1.55.1
|
||||||
|
|
||||||
POM_DESCRIPTION=Real-time physically based rendering engine for Android.
|
POM_DESCRIPTION=Real-time physically based rendering engine for Android.
|
||||||
|
|
||||||
|
|||||||
@@ -371,10 +371,6 @@ set(LINUX_LINKER_OPTIMIZATION_FLAGS
|
|||||||
if (LINUX AND FILAMENT_SUPPORTS_OSMESA)
|
if (LINUX AND FILAMENT_SUPPORTS_OSMESA)
|
||||||
set(OSMESA_COMPILE_FLAGS
|
set(OSMESA_COMPILE_FLAGS
|
||||||
-I${FILAMENT_OSMESA_PATH}/include/GL)
|
-I${FILAMENT_OSMESA_PATH}/include/GL)
|
||||||
set(OSMESA_LINKER_FLAGS
|
|
||||||
-Wl,-L${FILAMENT_OSMESA_PATH}/lib/x86_64-linux-gnu/
|
|
||||||
-lOSMesa
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
@@ -540,6 +536,8 @@ if (APPLE AND NOT IOS)
|
|||||||
|
|
||||||
add_executable(metal_utils_test test/MetalTest.mm)
|
add_executable(metal_utils_test test/MetalTest.mm)
|
||||||
|
|
||||||
|
target_compile_options(metal_utils_test PRIVATE "-fobjc-arc")
|
||||||
|
|
||||||
target_link_libraries(metal_utils_test PRIVATE
|
target_link_libraries(metal_utils_test PRIVATE
|
||||||
backend
|
backend
|
||||||
getopt
|
getopt
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "bluegl/BlueGL.h"
|
#include "bluegl/BlueGL.h"
|
||||||
|
|
||||||
#include "osmesa.h"
|
#include <osmesa.h>
|
||||||
|
|
||||||
#include <backend/platforms/OpenGLPlatform.h>
|
#include <backend/platforms/OpenGLPlatform.h>
|
||||||
#include <backend/DriverEnums.h>
|
#include <backend/DriverEnums.h>
|
||||||
@@ -56,6 +56,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
OSMesaContext mContext;
|
OSMesaContext mContext;
|
||||||
|
void* mOsMesaApi = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace filament::backend
|
} // namespace filament::backend
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static_assert(N <= 8);
|
static_assert(N <= 8);
|
||||||
std::array<__unsafe_unretained id<MTLBuffer>, N> mBuffers = { nil };
|
std::array<__weak id<MTLBuffer>, N> mBuffers = { nil };
|
||||||
std::array<NSUInteger, N> mOffsets = { 0 };
|
std::array<NSUInteger, N> mOffsets = { 0 };
|
||||||
utils::bitset8 mDirtyBuffers;
|
utils::bitset8 mDirtyBuffers;
|
||||||
utils::bitset8 mDirtyOffsets;
|
utils::bitset8 mDirtyOffsets;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
#include <utils/Panic.h>
|
#include <utils/Panic.h>
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace filament::backend {
|
namespace filament::backend {
|
||||||
@@ -41,13 +42,56 @@ struct OSMesaSwapchain {
|
|||||||
std::unique_ptr<uint8_t[]> buffer;
|
std::unique_ptr<uint8_t[]> buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // anonymous namespace
|
struct OSMesaAPI {
|
||||||
|
private:
|
||||||
|
using CreateContextFunc = OSMesaContext (*)(GLenum format, OSMesaContext);
|
||||||
|
using DestroyContextFunc = GLboolean (*)(OSMesaContext);
|
||||||
|
using MakeCurrentFunc = GLboolean (*)(OSMesaContext ctx, void* buffer, GLenum type,
|
||||||
|
GLsizei width, GLsizei height);
|
||||||
|
using GetProcAddressFunc = OSMESAproc (*)(const char* funcName);
|
||||||
|
|
||||||
|
public:
|
||||||
|
CreateContextFunc OSMesaCreateContext;
|
||||||
|
DestroyContextFunc OSMesaDestroyContext;
|
||||||
|
MakeCurrentFunc OSMesaMakeCurrent;
|
||||||
|
GetProcAddressFunc OSMesaGetProcAddress;
|
||||||
|
|
||||||
|
OSMesaAPI() {
|
||||||
|
constexpr char const* libraryNames[] = {"libOSMesa.so", "libosmesa.so"};
|
||||||
|
for (char const* libName: libraryNames) {
|
||||||
|
mLib = dlopen(libName, RTLD_GLOBAL | RTLD_NOW);
|
||||||
|
if (mLib) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FILAMENT_CHECK_PRECONDITION(mLib)
|
||||||
|
<< "Unable to dlopen libOSMesa to create a software GL context";
|
||||||
|
|
||||||
|
OSMesaGetProcAddress = (GetProcAddressFunc) dlsym(mLib, "OSMesaGetProcAddress");
|
||||||
|
|
||||||
|
OSMesaCreateContext = (CreateContextFunc) OSMesaGetProcAddress("OSMesaCreateContext");
|
||||||
|
OSMesaDestroyContext =
|
||||||
|
(DestroyContextFunc) OSMesaGetProcAddress("OSMesaDestroyContext");
|
||||||
|
OSMesaMakeCurrent = (MakeCurrentFunc) OSMesaGetProcAddress("OSMesaMakeCurrent");
|
||||||
|
}
|
||||||
|
|
||||||
|
~OSMesaAPI() {
|
||||||
|
dlclose(mLib);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
void* mLib = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
}// anonymous namespace
|
||||||
|
|
||||||
Driver* PlatformOSMesa::createDriver(void* const sharedGLContext,
|
Driver* PlatformOSMesa::createDriver(void* const sharedGLContext,
|
||||||
const DriverConfig& driverConfig) noexcept {
|
const DriverConfig& driverConfig) noexcept {
|
||||||
|
OSMesaAPI* api = new OSMesaAPI();
|
||||||
|
mOsMesaApi = api;
|
||||||
|
|
||||||
FILAMENT_CHECK_PRECONDITION(sharedGLContext == nullptr)
|
FILAMENT_CHECK_PRECONDITION(sharedGLContext == nullptr)
|
||||||
<< "shared GL context is not supported with PlatformOSMesa";
|
<< "shared GL context is not supported with PlatformOSMesa";
|
||||||
mContext = OSMesaCreateContext(GL_RGBA, NULL);
|
mContext = api->OSMesaCreateContext(GL_RGBA, NULL);
|
||||||
|
|
||||||
// We need to do a no-op makecurrent here so that the context will be in a correct state before
|
// We need to do a no-op makecurrent here so that the context will be in a correct state before
|
||||||
// any GL calls.
|
// any GL calls.
|
||||||
@@ -62,7 +106,11 @@ Driver* PlatformOSMesa::createDriver(void* const sharedGLContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlatformOSMesa::terminate() noexcept {
|
void PlatformOSMesa::terminate() noexcept {
|
||||||
OSMesaDestroyContext(mContext);
|
OSMesaAPI* api = (OSMesaAPI*) mOsMesaApi;
|
||||||
|
api->OSMesaDestroyContext(mContext);
|
||||||
|
delete api;
|
||||||
|
mOsMesaApi = nullptr;
|
||||||
|
|
||||||
bluegl::unbind();
|
bluegl::unbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,11 +132,12 @@ void PlatformOSMesa::destroySwapChain(Platform::SwapChain* swapChain) noexcept {
|
|||||||
|
|
||||||
bool PlatformOSMesa::makeCurrent(ContextType type, SwapChain* drawSwapChain,
|
bool PlatformOSMesa::makeCurrent(ContextType type, SwapChain* drawSwapChain,
|
||||||
SwapChain* readSwapChain) noexcept {
|
SwapChain* readSwapChain) noexcept {
|
||||||
|
OSMesaAPI* api = (OSMesaAPI*) mOsMesaApi;
|
||||||
OSMesaSwapchain* impl = (OSMesaSwapchain*) drawSwapChain;
|
OSMesaSwapchain* impl = (OSMesaSwapchain*) drawSwapChain;
|
||||||
|
|
||||||
auto result = OSMesaMakeCurrent(mContext, (BackingType*) impl->buffer.get(), BACKING_GL_TYPE,
|
auto result = api->OSMesaMakeCurrent(mContext, (BackingType*) impl->buffer.get(),
|
||||||
impl->width, impl->height);
|
BACKING_GL_TYPE, impl->width, impl->height);
|
||||||
FILAMENT_CHECK_POSTCONDITION(result) << "OSMesaMakeCurrent failed!";
|
FILAMENT_CHECK_POSTCONDITION(result == GL_TRUE) << "OSMesaMakeCurrent failed!";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1293,8 +1293,6 @@ void VulkanDriver::beginRenderPass(Handle<HwRenderTarget> rth, const RenderPassP
|
|||||||
rpkey.colorFormat[i] = info.getFormat();
|
rpkey.colorFormat[i] = info.getFormat();
|
||||||
if (rpkey.samples > 1) {
|
if (rpkey.samples > 1) {
|
||||||
const VulkanTexture* sidecar = info.texture->getSidecar();
|
const VulkanTexture* sidecar = info.texture->getSidecar();
|
||||||
assert_invariant(sidecar);
|
|
||||||
assert_invariant(sidecar->samples > 1);
|
|
||||||
if (sidecar && sidecar->isTransientAttachment()) {
|
if (sidecar && sidecar->isTransientAttachment()) {
|
||||||
rpkey.usesLazilyAllocatedMemory |= (1 << i);
|
rpkey.usesLazilyAllocatedMemory |= (1 << i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
Pod::Spec.new do |spec|
|
Pod::Spec.new do |spec|
|
||||||
spec.name = "Filament"
|
spec.name = "Filament"
|
||||||
spec.version = "1.55.0"
|
spec.version = "1.55.1"
|
||||||
spec.license = { :type => "Apache 2.0", :file => "LICENSE" }
|
spec.license = { :type => "Apache 2.0", :file => "LICENSE" }
|
||||||
spec.homepage = "https://google.github.io/filament"
|
spec.homepage = "https://google.github.io/filament"
|
||||||
spec.authors = "Google LLC."
|
spec.authors = "Google LLC."
|
||||||
spec.summary = "Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WASM/WebGL."
|
spec.summary = "Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WASM/WebGL."
|
||||||
spec.platform = :ios, "11.0"
|
spec.platform = :ios, "11.0"
|
||||||
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.55.0/filament-v1.55.0-ios.tgz" }
|
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.55.1/filament-v1.55.1-ios.tgz" }
|
||||||
|
|
||||||
# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
|
# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
|
||||||
spec.pod_target_xcconfig = {
|
spec.pod_target_xcconfig = {
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ elseif (APPLE AND NOT IOS)
|
|||||||
elseif(LINUX)
|
elseif(LINUX)
|
||||||
if(FILAMENT_SUPPORTS_EGL_ON_LINUX)
|
if(FILAMENT_SUPPORTS_EGL_ON_LINUX)
|
||||||
set(SRCS ${SRCS} src/BlueGLLinuxEGL.cpp)
|
set(SRCS ${SRCS} src/BlueGLLinuxEGL.cpp)
|
||||||
|
elseif(FILAMENT_SUPPORTS_OSMESA)
|
||||||
|
set(SRCS ${SRCS} src/BlueGLLinuxOSMesa.cpp)
|
||||||
else()
|
else()
|
||||||
set(SRCS ${SRCS} src/BlueGLLinux.cpp)
|
set(SRCS ${SRCS} src/BlueGLLinux.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
59
libs/bluegl/src/BlueGLLinuxOSMesa.cpp
Normal file
59
libs/bluegl/src/BlueGLLinuxOSMesa.cpp
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
namespace bluegl {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
using ProcAddressFunc = void*(*)(char const* funcName);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Driver {
|
||||||
|
ProcAddressFunc OSMesaGetProcAddress;
|
||||||
|
void* library;
|
||||||
|
} g_driver = {nullptr, nullptr};
|
||||||
|
|
||||||
|
bool initBinder() {
|
||||||
|
constexpr char const* libraryNames[] = {"libOSMesa.so", "libosmesa.so"};
|
||||||
|
for (char const* name : libraryNames) {
|
||||||
|
g_driver.library = dlopen(name, RTLD_GLOBAL | RTLD_NOW);
|
||||||
|
if (g_driver.library) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!g_driver.library) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_driver.OSMesaGetProcAddress = (ProcAddressFunc)
|
||||||
|
dlsym(g_driver.library, "OSMesaGetProcAddress");
|
||||||
|
|
||||||
|
return g_driver.OSMesaGetProcAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* loadFunction(const char* name) {
|
||||||
|
return (void*) g_driver.OSMesaGetProcAddress(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void shutdownBinder() {
|
||||||
|
dlclose(g_driver.library);
|
||||||
|
memset(&g_driver, 0, sizeof(g_driver));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace bluegl
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "filament",
|
"name": "filament",
|
||||||
"version": "1.55.0",
|
"version": "1.55.1",
|
||||||
"description": "Real-time physically based rendering engine",
|
"description": "Real-time physically based rendering engine",
|
||||||
"main": "filament.js",
|
"main": "filament.js",
|
||||||
"module": "filament.js",
|
"module": "filament.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user