Skip to content

Commit

Permalink
Merge branch 'rc/1.52.2' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
z3moon committed Jun 3, 2024
2 parents 3603202 + a8596ae commit 74751a0
Show file tree
Hide file tree
Showing 95 changed files with 1,223 additions and 921 deletions.
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.1'
implementation 'com.google.android.filament:filament-android:1.52.2'
}
```

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.1'
pod 'Filament', '~> 1.52.2'
```

### 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.2


## v1.52.1

- Add instructions for using Mesa for software rasterization
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.1
VERSION_NAME=1.52.2

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

Expand Down
8 changes: 4 additions & 4 deletions filament/backend/include/private/backend/HandleAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ class HandleAllocator {
uint8_t const age = (tag & HANDLE_AGE_MASK) >> HANDLE_AGE_SHIFT;
auto const pNode = static_cast<typename Allocator::Node*>(p);
uint8_t const expectedAge = pNode[-1].age;
ASSERT_POSTCONDITION(expectedAge == age,
"use-after-free of Handle with id=%d", handle.getId());
FILAMENT_CHECK_POSTCONDITION(expectedAge == age) <<
"use-after-free of Handle with id=" << handle.getId();
}
}

Expand Down Expand Up @@ -240,8 +240,8 @@ class HandleAllocator {
Node* const pNode = static_cast<Node*>(p);
uint8_t& expectedAge = pNode[-1].age;
if (UTILS_UNLIKELY(!mUseAfterFreeCheckDisabled)) {
ASSERT_POSTCONDITION(expectedAge == age,
"double-free of Handle of size %d at %p", size, p);
FILAMENT_CHECK_POSTCONDITION(expectedAge == age) <<
"double-free of Handle of size " << size << " at " << p;
}
expectedAge = (expectedAge + 1) & 0xF; // fixme

Expand Down
4 changes: 2 additions & 2 deletions filament/backend/src/Callable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ PresentCallable::PresentCallable(PresentFn fn, void* user) noexcept
}

void PresentCallable::operator()(bool presentFrame) noexcept {
ASSERT_PRECONDITION(mPresentFn, "This PresentCallable was already called. " \
"PresentCallables should be called exactly once.");
FILAMENT_CHECK_PRECONDITION(mPresentFn) << "This PresentCallable was already called. "
"PresentCallables should be called exactly once.";
mPresentFn(presentFrame, mUser);
// Set mPresentFn to nullptr to denote that the callable has been called.
mPresentFn = nullptr;
Expand Down
6 changes: 3 additions & 3 deletions filament/backend/src/CircularBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ void* CircularBuffer::alloc(size_t size) noexcept {
data = mmap(nullptr, size * 2 + BLOCK_SIZE,
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

ASSERT_POSTCONDITION(data,
"couldn't allocate %u KiB of virtual address space for the command buffer",
(size * 2 / 1024));
FILAMENT_CHECK_POSTCONDITION(data) <<
"couldn't allocate " << (size * 2 / 1024) <<
" KiB of virtual address space for the command buffer";

slog.d << "WARNING: Using soft CircularBuffer (" << (size * 2 / 1024) << " KiB)"
<< io::endl;
Expand Down
18 changes: 7 additions & 11 deletions filament/backend/src/CommandBufferQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ void CommandBufferQueue::setPaused(bool paused) {

bool CommandBufferQueue::isExitRequested() const {
std::lock_guard<utils::Mutex> const lock(mLock);
ASSERT_PRECONDITION( mExitRequested == 0 || mExitRequested == EXIT_REQUESTED,
"mExitRequested is corrupted (value = 0x%08x)!", mExitRequested);
return (bool)mExitRequested;
}

Expand Down Expand Up @@ -108,11 +106,11 @@ void CommandBufferQueue::flush() noexcept {
mCondition.notify_one();

// circular buffer is too small, we corrupted the stream
ASSERT_POSTCONDITION(used <= mFreeSpace,
FILAMENT_CHECK_POSTCONDITION(used <= mFreeSpace) <<
"Backend CommandStream overflow. Commands are corrupted and unrecoverable.\n"
"Please increase minCommandBufferSizeMB inside the Config passed to Engine::create.\n"
"Space used at this time: %u bytes, overflow: %u bytes",
(unsigned)used, unsigned(used - mFreeSpace));
"Space used at this time: " << used <<
" bytes, overflow: " << used - mFreeSpace << " bytes";

// wait until there is enough space in the buffer
mFreeSpace -= used;
Expand All @@ -131,9 +129,11 @@ void CommandBufferQueue::flush() noexcept {
#endif

SYSTRACE_NAME("waiting: CircularBuffer::flush()");
ASSERT_POSTCONDITION(!mPaused,

FILAMENT_CHECK_POSTCONDITION(!mPaused) <<
"CommandStream is full, but since the rendering thread is paused, "
"the buffer cannot flush and we will deadlock. Instead, abort.");
"the buffer cannot flush and we will deadlock. Instead, abort.";

mCondition.wait(lock, [this, requiredSize]() -> bool {
// TODO: on macOS, we need to call pumpEvents from time to time
return mFreeSpace >= requiredSize;
Expand All @@ -149,10 +149,6 @@ std::vector<CommandBufferQueue::Range> CommandBufferQueue::waitForCommands() con
while ((mCommandBuffersToExecute.empty() || mPaused) && !mExitRequested) {
mCondition.wait(lock);
}

ASSERT_PRECONDITION( mExitRequested == 0 || mExitRequested == EXIT_REQUESTED,
"mExitRequested is corrupted (value = 0x%08x)!", mExitRequested);

return std::move(mCommandBuffersToExecute);
}

Expand Down
4 changes: 2 additions & 2 deletions filament/backend/src/HandleAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ HandleBase::HandleId HandleAllocator<P0, P1, P2>::allocateHandleSlow(size_t size

HandleBase::HandleId id = (++mId) | HANDLE_HEAP_FLAG;

ASSERT_POSTCONDITION(mId < HANDLE_HEAP_FLAG,
FILAMENT_CHECK_POSTCONDITION(mId < HANDLE_HEAP_FLAG) <<
"No more Handle ids available! This can happen if HandleAllocator arena has been full"
" for a while. Please increase FILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB");
" for a while. Please increase FILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB";

mOverflowMap.emplace(id, p);
lock.unlock();
Expand Down
11 changes: 6 additions & 5 deletions filament/backend/src/metal/MetalBlitter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ inline bool MTLSizeEqual(T a, T b) noexcept {
MetalBlitter::MetalBlitter(MetalContext& context) noexcept : mContext(context) { }

void MetalBlitter::blit(id<MTLCommandBuffer> cmdBuffer, const BlitArgs& args, const char* label) {

ASSERT_PRECONDITION(args.source.region.size.depth == args.destination.region.size.depth,
"Blitting requires the source and destination regions to have the same depth.");
FILAMENT_CHECK_PRECONDITION(args.source.region.size.depth == args.destination.region.size.depth)
<< "Blitting requires the source and destination regions to have the same depth.";

// Determine if the blit for color or depth are eligible to use a MTLBlitCommandEncoder.
// blitFastPath returns true upon success.
Expand Down Expand Up @@ -327,7 +326,8 @@ inline bool MTLSizeEqual(T a, T b) noexcept {
utils::slog.e << description << utils::io::endl;
}
}
ASSERT_POSTCONDITION(library && function, "Unable to compile fragment shader for MetalBlitter.");
FILAMENT_CHECK_POSTCONDITION(library && function)
<< "Unable to compile fragment shader for MetalBlitter.";

return function;
}
Expand All @@ -352,7 +352,8 @@ inline bool MTLSizeEqual(T a, T b) noexcept {
utils::slog.e << description << utils::io::endl;
}
}
ASSERT_POSTCONDITION(library && function, "Unable to compile vertex shader for MetalBlitter.");
FILAMENT_CHECK_POSTCONDITION(library && function)
<< "Unable to compile vertex shader for MetalBlitter.";

mVertexFunction = function;

Expand Down
11 changes: 6 additions & 5 deletions filament/backend/src/metal/MetalBuffer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
mBuffer = { [context.device newBufferWithLength:size options:MTLResourceStorageModePrivate],
TrackedMetalBuffer::Type::GENERIC };
}
ASSERT_POSTCONDITION(mBuffer, "Could not allocate Metal buffer of size %zu.", size);
FILAMENT_CHECK_POSTCONDITION(mBuffer)
<< "Could not allocate Metal buffer of size " << size << ".";
}

MetalBuffer::~MetalBuffer() {
Expand All @@ -57,9 +58,9 @@
if (size <= 0) {
return;
}
ASSERT_PRECONDITION(size + byteOffset <= mBufferSize,
"Attempting to copy %zu bytes into a buffer of size %zu at offset %zu",
size, mBufferSize, byteOffset);
FILAMENT_CHECK_PRECONDITION(size + byteOffset <= mBufferSize)
<< "Attempting to copy " << size << " bytes into a buffer of size " << mBufferSize
<< " at offset " << byteOffset;

// Either copy into the Metal buffer or into our cpu buffer.
if (mCpuBuffer) {
Expand All @@ -73,7 +74,7 @@
memcpy(staging->buffer.get().contents, src, size);

// The blit below requires that byteOffset be a multiple of 4.
ASSERT_PRECONDITION(!(byteOffset & 0x3u), "byteOffset must be a multiple of 4");
FILAMENT_CHECK_PRECONDITION(!(byteOffset & 0x3u)) << "byteOffset must be a multiple of 4";

// Encode a blit from the staging buffer into the private GPU buffer.
id<MTLCommandBuffer> cmdBuffer = getPendingCommandBuffer(&mContext);
Expand Down
3 changes: 2 additions & 1 deletion filament/backend/src/metal/MetalBufferPool.mm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
buffer = [mContext.device newBufferWithLength:numBytes
options:MTLResourceStorageModeShared];
}
ASSERT_POSTCONDITION(buffer, "Could not allocate Metal staging buffer of size %zu.", numBytes);
FILAMENT_CHECK_POSTCONDITION(buffer)
<< "Could not allocate Metal staging buffer of size " << numBytes << ".";
MetalBufferPoolEntry* stage = new MetalBufferPoolEntry {
.buffer = { buffer, TrackedMetalBuffer::Type::STAGING },
.capacity = numBytes,
Expand Down
3 changes: 2 additions & 1 deletion filament/backend/src/metal/MetalContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ void initializeSupportedGpuFamilies(MetalContext* context) {
}
}
}];
ASSERT_POSTCONDITION(context->pendingCommandBuffer, "Could not obtain command buffer.");
FILAMENT_CHECK_POSTCONDITION(context->pendingCommandBuffer)
<< "Could not obtain command buffer.";
return context->pendingCommandBuffer;
}

Expand Down
Loading

0 comments on commit 74751a0

Please sign in to comment.