Skip to content

Commit

Permalink
Merge branch 'rc/1.52.3' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Jun 11, 2024
2 parents 74751a0 + 5d5f53e commit bbd4177
Show file tree
Hide file tree
Showing 29 changed files with 62 additions and 10,084 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,6 @@ add_subdirectory(${FILAMENT}/filament)
add_subdirectory(${FILAMENT}/shaders)
add_subdirectory(${EXTERNAL}/basisu/tnt)
add_subdirectory(${EXTERNAL}/civetweb/tnt)
add_subdirectory(${EXTERNAL}/hat-trie/tnt)
add_subdirectory(${EXTERNAL}/imgui/tnt)
add_subdirectory(${EXTERNAL}/robin-map/tnt)
add_subdirectory(${EXTERNAL}/smol-v/tnt)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.52.2'
implementation 'com.google.android.filament:filament-android:1.52.3'
}
```

Expand All @@ -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:

```shell
pod 'Filament', '~> 1.52.2'
pod 'Filament', '~> 1.52.3'
```

### Snapshots
Expand Down
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ A new header is inserted each time a *tag* is created.
Instead, if you are authoring a PR for the main branch, add your release note to
[NEW_RELEASE_NOTES.md](./NEW_RELEASE_NOTES.md).

## v1.52.3


## v1.52.2


Expand Down
1 change: 0 additions & 1 deletion android/gltfio-android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ set(GLTFIO_INCLUDE_DIRS
../../third_party/cgltf
../../third_party/meshoptimizer/src
../../third_party/robin-map
../../third_party/hat-trie
../../third_party/stb
../../libs/utils/include
../../libs/ktxreader/include
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.52.2
VERSION_NAME=1.52.3

POM_DESCRIPTION=Real-time physically based rendering engine for Android.

Expand Down
1 change: 1 addition & 0 deletions filament/backend/src/metal/MetalHandles.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class MetalSwapChain : public HwSwapChain {
NSUInteger headlessWidth = 0;
NSUInteger headlessHeight = 0;
CAMetalLayer* layer = nullptr;
std::mutex layerDrawableMutex;
MetalExternalImage externalImage;
SwapChainType type;

Expand Down
36 changes: 26 additions & 10 deletions filament/backend/src/metal/MetalHandles.mm
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,21 @@ static inline MTLTextureUsage getMetalTextureUsage(TextureUsage usage) {
}

assert_invariant(isCaMetalLayer());
drawable = [layer nextDrawable];

// CAMetalLayer's drawable pool is not thread safe. Use a mutex when
// calling -nextDrawable, or when releasing the last known reference
// to any CAMetalDrawable returned from a previous -nextDrawable.
{
std::lock_guard<std::mutex> lock(layerDrawableMutex);
drawable = [layer nextDrawable];
}

FILAMENT_CHECK_POSTCONDITION(drawable != nil) << "Could not obtain drawable.";
return drawable.texture;
}

void MetalSwapChain::releaseDrawable() {
std::lock_guard<std::mutex> lock(layerDrawableMutex);
drawable = nil;
}

Expand Down Expand Up @@ -256,9 +264,11 @@ static inline MTLTextureUsage getMetalTextureUsage(TextureUsage usage) {
PresentDrawableData(const PresentDrawableData&) = delete;
PresentDrawableData& operator=(const PresentDrawableData&) = delete;

static PresentDrawableData* create(id<CAMetalDrawable> drawable, MetalDriver* driver) {
static PresentDrawableData* create(id<CAMetalDrawable> drawable,
std::mutex* drawableMutex, MetalDriver* driver) {
assert_invariant(drawableMutex);
assert_invariant(driver);
return new PresentDrawableData(drawable, driver);
return new PresentDrawableData(drawable, drawableMutex, driver);
}

static void maybePresentAndDestroyAsync(PresentDrawableData* that, bool shouldPresent) {
Expand All @@ -277,16 +287,22 @@ static void maybePresentAndDestroyAsync(PresentDrawableData* that, bool shouldPr
}

private:
PresentDrawableData(id<CAMetalDrawable> drawable, MetalDriver* driver)
: mDrawable(drawable), mDriver(driver) {}
PresentDrawableData(id<CAMetalDrawable> drawable, std::mutex* drawableMutex,
MetalDriver* driver)
: mDrawable(drawable), mDrawableMutex(drawableMutex), mDriver(driver) {}

static void cleanupAndDestroy(PresentDrawableData *that) {
that->mDrawable = nil;
{
std::lock_guard<std::mutex> lock(*(that->mDrawableMutex));
that->mDrawable = nil;
}
that->mDrawableMutex = nullptr;
that->mDriver = nullptr;
delete that;
}

id<CAMetalDrawable> mDrawable;
std::mutex* mDrawableMutex = nullptr;
MetalDriver* mDriver = nullptr;
};

Expand All @@ -304,8 +320,8 @@ void presentDrawable(bool presentFrame, void* user) {

struct Callback {
Callback(std::shared_ptr<FrameScheduledCallback> callback, id<CAMetalDrawable> drawable,
MetalDriver* driver)
: f(callback), data(PresentDrawableData::create(drawable, driver)) {}
std::mutex* drawableMutex, MetalDriver* driver)
: f(callback), data(PresentDrawableData::create(drawable, drawableMutex, driver)) {}
std::shared_ptr<FrameScheduledCallback> f;
// PresentDrawableData* is destroyed by maybePresentAndDestroyAsync() later.
std::unique_ptr<PresentDrawableData> data;
Expand All @@ -320,8 +336,8 @@ static void func(void* user) {

// This callback pointer will be captured by the block. Even if the scheduled handler is never
// called, the unique_ptr will still ensure we don't leak memory.
__block auto callback =
std::make_unique<Callback>(frameScheduled.callback, drawable, context.driver);
__block auto callback = std::make_unique<Callback>(
frameScheduled.callback, drawable, &layerDrawableMutex, context.driver);

backend::CallbackHandler* handler = frameScheduled.handler;
MetalDriver* driver = context.driver;
Expand Down
4 changes: 4 additions & 0 deletions filament/backend/src/vulkan/VulkanDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ ShaderModel VulkanDriver::getShaderModel() const noexcept {
}

void VulkanDriver::terminate() {
// Flush and wait here to make sure all queued commands are executed and resources that are tied
// to those commands are no longer referenced.
finish(0);

delete mEmptyBufferObject;
delete mEmptyTexture;

Expand Down
4 changes: 2 additions & 2 deletions ios/CocoaPods/Filament.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |spec|
spec.name = "Filament"
spec.version = "1.52.2"
spec.version = "1.52.3"
spec.license = { :type => "Apache 2.0", :file => "LICENSE" }
spec.homepage = "https://google.github.io/filament"
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.platform = :ios, "11.0"
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.52.2/filament-v1.52.2-ios.tgz" }
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.52.3/filament-v1.52.3-ios.tgz" }

# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
spec.pod_target_xcconfig = {
Expand Down
2 changes: 1 addition & 1 deletion libs/gltfio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ set_target_properties(uberarchive PROPERTIES FOLDER Libs)
# ==================================================================================================

include_directories(${PUBLIC_HDR_DIR} ${RESOURCE_DIR})
link_libraries(math utils filament cgltf stb ktxreader geometry tsl trie uberzlib)
link_libraries(math utils filament cgltf stb ktxreader geometry tsl uberzlib)

add_library(gltfio_core STATIC ${PUBLIC_HDRS} ${SRCS})

Expand Down
6 changes: 3 additions & 3 deletions libs/gltfio/src/FFilamentAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
#include "FFilamentInstance.h"
#include "Utility.h"

#include <tsl/htrie_map.h>

#include <string>
#include <unordered_map>
#include <variant>
#include <vector>

Expand Down Expand Up @@ -273,7 +273,7 @@ struct FFilamentAsset : public FilamentAsset {
bool mResourcesLoaded = false;

DependencyGraph mDependencyGraph;
tsl::htrie_map<char, std::vector<utils::Entity>> mNameToEntity;
std::unordered_map<std::string, std::vector<utils::Entity>> mNameToEntity;
utils::CString mAssetExtras;
bool mDetachedFilamentComponents = false;

Expand Down
31 changes: 13 additions & 18 deletions libs/gltfio/src/FilamentAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Entity FFilamentAsset::getFirstEntityByName(const char* name) noexcept {
if (iter == mNameToEntity.end()) {
return {};
}
return iter->front();
return iter->second.front();
}

size_t FFilamentAsset::getEntitiesByName(const char* name, Entity* entities,
Expand All @@ -220,7 +220,7 @@ size_t FFilamentAsset::getEntitiesByName(const char* name, Entity* entities,
if (iter == mNameToEntity.end()) {
return 0;
}
const auto& source = *iter;
const auto& source = iter->second;
if (entities == nullptr) {
return source.size();
}
Expand All @@ -240,25 +240,20 @@ size_t FFilamentAsset::getEntitiesByName(const char* name, Entity* entities,

size_t FFilamentAsset::getEntitiesByPrefix(const char* prefix, Entity* entities,
size_t maxCount) const noexcept {
const auto range = mNameToEntity.equal_prefix_range(prefix);
size_t count = 0;
for (auto iter = range.first; iter != range.second; ++iter) {
count += iter->size();
}
if (entities == nullptr) {
return count;
}
maxCount = std::min(maxCount, count);
if (maxCount == 0) {
return 0;
}
count = 0;
for (auto iter = range.first; iter != range.second; ++iter) {
const auto& source = *iter;
for (Entity entity : source) {
entities[count] = entity;
if (++count >= maxCount) {
return count;
std::string_view prefixString(prefix);
size_t count = 0;
for (auto& [k, v] : mNameToEntity) {
if (k.compare(0, prefixString.size(), prefixString) == 0) {
for (Entity entity : v) {
if (entities) {
entities[count] = entity;
}
if (++count >= maxCount) {
return count;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/utils/include/utils/Panic.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ struct Voidify final {
void operator&&(const T&) const&& {}
};

class PanicStream {
class UTILS_PUBLIC PanicStream {
public:
PanicStream(
char const* function,
Expand Down
5 changes: 4 additions & 1 deletion libs/utils/include/utils/sstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
#ifndef TNT_UTILS_SSTREAM_H
#define TNT_UTILS_SSTREAM_H

#include <utils/compiler.h>
#include <utils/ostream.h>

#include <stddef.h>

namespace utils::io {

class sstream : public ostream {
class UTILS_PUBLIC sstream : public ostream {
public:
ostream& flush() noexcept override;
const char* c_str() const noexcept;
Expand Down
22 changes: 0 additions & 22 deletions third_party/hat-trie/CMakeLists.txt

This file was deleted.

21 changes: 0 additions & 21 deletions third_party/hat-trie/LICENSE

This file was deleted.

Loading

0 comments on commit bbd4177

Please sign in to comment.