Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/AppExampleFabric/scripts/compile-materials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# Make sure the filament matc tool is available:
matc_path=../../../filament/out/cmake-release/tools/matc/matc
matc_path=../../filament/out/cmake-release/tools/matc/matc
if [ ! -f "$matc_path" ]; then
echo "The filament matc tool is missing. Did you build Filament properly?"
exit 1
Expand Down
Binary file modified examples/Shared/assets/background_image.filamat
Binary file not shown.
Binary file modified examples/Shared/assets/transparent_shadow_material.filamat
Binary file not shown.
2 changes: 1 addition & 1 deletion filament
Submodule filament updated 38791 files
2 changes: 2 additions & 0 deletions package/android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ target_include_directories(
"${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/react/turbomodule" # <-- CallInvokerHolder JNI wrapper
"${FILAMENT_DIR}/include"
"${BULLET3_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../filament/filament/backend/include" # <-- Filament backend private headers (dev)
"${FILAMENT_DIR}/include/private" # <-- Filament private headers (distributed package)
)

# Link everything together
Expand Down
8 changes: 4 additions & 4 deletions package/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Filament_kotlinVersion=1.7.0
Filament_minSdkVersion=21
Filament_targetSdkVersion=31
Filament_compileSdkVersion=31
Filament_ndkversion=25.1.8937393
Filament_minSdkVersion=24
Filament_targetSdkVersion=35
Filament_compileSdkVersion=35
Filament_ndkversion=27.1.12297006
15 changes: 8 additions & 7 deletions package/android/libs/filament/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ Copy your platform's Makefile below into a `Makefile` inside the same directory.
### Linux

```make
FILAMENT_LIBS=-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v -lvkshaders -libl
FILAMENT_LIBS=-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v -libl -labseil
CC=clang++

main: main.o
$(CC) -Llib/x86_64/ main.o $(FILAMENT_LIBS) -lpthread -lc++ -ldl -o main

main.o: main.cpp
$(CC) -Iinclude/ -std=c++17 -pthread -c main.cpp
$(CC) -Iinclude/ -std=c++20 -pthread -c main.cpp

clean:
rm -f main main.o
Expand All @@ -110,15 +110,16 @@ clean:
### macOS

```make
FILAMENT_LIBS=-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v -lvkshaders -libl
FILAMENT_LIBS=-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v -libl -labseil
FRAMEWORKS=-framework Cocoa -framework Metal -framework CoreVideo
CC=clang++
ARCH ?= $(shell uname -m)

main: main.o
$(CC) -Llib/x86_64/ main.o $(FILAMENT_LIBS) $(FRAMEWORKS) -o main
$(CC) -Llib/$(ARCH)/ main.o $(FILAMENT_LIBS) $(FRAMEWORKS) -o main

main.o: main.cpp
$(CC) -Iinclude/ -std=c++17 -c main.cpp
$(CC) -Iinclude/ -std=c++20 -c main.cpp

clean:
rm -f main main.o
Expand All @@ -139,15 +140,15 @@ used to change the run-time library version.

```make
FILAMENT_LIBS=filament.lib backend.lib bluegl.lib bluevk.lib filabridge.lib filaflat.lib \
utils.lib geometry.lib smol-v.lib ibl.lib vkshaders.lib
utils.lib geometry.lib smol-v.lib ibl.lib abseil.lib
CC=cl.exe

main.exe: main.obj
$(CC) main.obj /link /libpath:"lib\\x86_64\\mt\\" $(FILAMENT_LIBS) \
gdi32.lib user32.lib opengl32.lib

main.obj: main.cpp
$(CC) /MT /Iinclude\\ /std:c++17 /c main.cpp
$(CC) /MT /Iinclude\\ /std:c++20 /c main.cpp

clean:
del main.exe main.obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define TNT_FILAMENT_BACKEND_PRIVATE_ACQUIREDIMAGE_H

#include <backend/DriverEnums.h>
#include <math/mat3.h>

namespace filament::backend {

Expand Down
23 changes: 15 additions & 8 deletions package/android/libs/filament/include/backend/BufferDescriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@
#define TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H

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

#include <utility>

#include <stddef.h>

namespace utils::io {
class ostream;
} // namespace utils::io

namespace filament::backend {

class CallbackHandler;
Expand Down Expand Up @@ -89,20 +94,21 @@ class UTILS_PUBLIC BufferDescriptor {
* @param callback A callback used to release the CPU buffer from this BufferDescriptor
* @param user An opaque user pointer passed to the callback function when it's called
*/
BufferDescriptor(void const* buffer, size_t size,
Callback callback = nullptr, void* user = nullptr) noexcept
BufferDescriptor(void const* buffer, size_t const size,
Callback const callback = nullptr, void* user = nullptr) noexcept
: buffer(const_cast<void*>(buffer)), size(size), mCallback(callback), mUser(user) {
}

/**
* Creates a BufferDescriptor that references a CPU memory-buffer
* @param buffer Memory address of the CPU buffer to reference
* @param size Size of the CPU buffer in bytes
* @param handler A custom handler for the callback
* @param callback A callback used to release the CPU buffer from this BufferDescriptor
* @param user An opaque user pointer passed to the callback function when it's called
*/
BufferDescriptor(void const* buffer, size_t size,
CallbackHandler* handler, Callback callback, void* user = nullptr) noexcept
BufferDescriptor(void const* buffer, size_t const size,
CallbackHandler* handler, Callback const callback, void* user = nullptr) noexcept
: buffer(const_cast<void*>(buffer)), size(size),
mCallback(callback), mUser(user), mHandler(handler) {
}
Expand All @@ -116,8 +122,9 @@ class UTILS_PUBLIC BufferDescriptor {
*
* @param buffer Memory address of the CPU buffer to reference
* @param size Size of the CPU buffer in bytes
* @param data A pointer to the data
* @param handler Handler to use to dispatch the callback, or nullptr for the default handler
* @return a new BufferDescriptor
* @return A new BufferDescriptor
*/
template<typename T, void(T::*method)(void const*, size_t)>
static BufferDescriptor make(void const* buffer, size_t size, T* data,
Expand Down Expand Up @@ -164,7 +171,7 @@ class UTILS_PUBLIC BufferDescriptor {
* @param callback The new callback function
* @param user An opaque user pointer passed to the callbeck function when it's called
*/
void setCallback(Callback callback, void* user = nullptr) noexcept {
void setCallback(Callback const callback, void* user = nullptr) noexcept {
this->mCallback = callback;
this->mUser = user;
this->mHandler = nullptr;
Expand All @@ -176,7 +183,7 @@ class UTILS_PUBLIC BufferDescriptor {
* @param callback The new callback function
* @param user An opaque user pointer passed to the callbeck function when it's called
*/
void setCallback(CallbackHandler* handler, Callback callback, void* user = nullptr) noexcept {
void setCallback(CallbackHandler* handler, Callback const callback, void* user = nullptr) noexcept {
mCallback = callback;
mUser = user;
mHandler = handler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CallbackHandler {
virtual void post(void* user, Callback callback) = 0;

protected:
virtual ~CallbackHandler() = default;
virtual ~CallbackHandler();
};

} // namespace filament::backend
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* 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.
*/

#ifndef TNT_FILAMENT_BACKEND_COMMANDSTREAMVECTOR_H
#define TNT_FILAMENT_BACKEND_COMMANDSTREAMVECTOR_H

#include <backend/DriverApiForward.h>

#include <initializer_list>
#include <memory>

#include <stddef.h>
#include <stdint.h>


namespace utils::io {
class ostream;
} // namespace utils::io

namespace filament::backend {

void* allocateFromCommandStream(DriverApi& driver, size_t size, size_t alignment) noexcept;

class DescriptorSetOffsetArray {
public:
using value_type = uint32_t;
using reference = value_type&;
using const_reference = value_type const&;
using size_type = uint32_t;
using difference_type = int32_t;
using pointer = value_type*;
using const_pointer = value_type const*;
using iterator = pointer;
using const_iterator = const_pointer;

DescriptorSetOffsetArray() noexcept = default;

~DescriptorSetOffsetArray() noexcept = default;

DescriptorSetOffsetArray(size_type size, DriverApi& driver) noexcept {
mOffsets = (value_type *)allocateFromCommandStream(driver,
size * sizeof(value_type), alignof(value_type));
std::uninitialized_fill_n(mOffsets, size, 0);
}

DescriptorSetOffsetArray(std::initializer_list<uint32_t> list, DriverApi& driver) noexcept {
mOffsets = (value_type *)allocateFromCommandStream(driver,
list.size() * sizeof(value_type), alignof(value_type));
std::uninitialized_copy(list.begin(), list.end(), mOffsets);
}

DescriptorSetOffsetArray(DescriptorSetOffsetArray const&) = delete;
DescriptorSetOffsetArray& operator=(DescriptorSetOffsetArray const&) = delete;

DescriptorSetOffsetArray(DescriptorSetOffsetArray&& rhs) noexcept
: mOffsets(rhs.mOffsets) {
rhs.mOffsets = nullptr;
}

DescriptorSetOffsetArray& operator=(DescriptorSetOffsetArray&& rhs) noexcept {
if (this != &rhs) {
mOffsets = rhs.mOffsets;
rhs.mOffsets = nullptr;
}
return *this;
}

bool empty() const noexcept { return mOffsets == nullptr; }

value_type* data() noexcept { return mOffsets; }
const value_type* data() const noexcept { return mOffsets; }


reference operator[](size_type n) noexcept {
return *(data() + n);
}

const_reference operator[](size_type n) const noexcept {
return *(data() + n);
}

void clear() noexcept {
mOffsets = nullptr;
}

private:
value_type *mOffsets = nullptr;
};

} // namespace filament::backend

#if !defined(NDEBUG)
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::DescriptorSetOffsetArray& rhs);
#endif

#endif //TNT_FILAMENT_BACKEND_COMMANDSTREAMVECTOR_H
Loading
Loading