Skip to content

Commit

Permalink
Merge branch 'rc/1.45.0' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
poweifeng committed Oct 25, 2023
2 parents 13afbc2 + 9c0cbed commit b2e0b97
Show file tree
Hide file tree
Showing 238 changed files with 17,034 additions and 19,139 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/android-continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ jobs:
with:
name: filamat-android-full
path: out/filamat-android-release.aar
- uses: actions/upload-artifact@v1.0.0
with:
name: filamat-android-lite
path: out/filamat-android-lite-release.aar
- uses: actions/upload-artifact@v1.0.0
with:
name: gltfio-android-release
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ jobs:
cd ../..
mv out/filament-android-release.aar out/filament-${TAG}-android.aar
mv out/filamat-android-release.aar out/filamat-${TAG}-android.aar
mv out/filamat-android-lite-release.aar out/filamat-${TAG}-lite-android.aar
mv out/gltfio-android-release.aar out/gltfio-${TAG}-android.aar
mv out/filament-utils-android-release.aar out/filament-utils-${TAG}-android.aar
- name: Sign sample-gltf-viewer
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.44.0'
implementation 'com.google.android.filament:filament-android:1.45.0'
}
```

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.44.0'
pod 'Filament', '~> 1.45.0'
```

### Snapshots
Expand Down
7 changes: 7 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ 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.45.0

- materials: fix alpha masked materials when MSAA is turned on [⚠️ **Recompile materials**]
- materials: better support materials with custom depth [**Recompile Materials**]
- engine: fade shadows at shadowFar distance instead of hard cutoff [⚠️ **New Material Version**]
- engine: Add support for stencil buffer when post-processing is disabled (Metal backend only).

## v1.44.0

- engine: add support for skinning with more than four bones per vertex.
Expand Down
3 changes: 0 additions & 3 deletions android/filamat-android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ option(FILAMENT_ENABLE_MATDBG "Enables Material debugger" OFF)
set(FILAMENT_DIR ${FILAMENT_DIST_DIR})

set(FILAMAT_FLAVOR "filamat")
if(FILAMAT_LITE)
set(FILAMAT_FLAVOR "filamat_lite")
endif()

if (FILAMENT_SUPPORTS_VULKAN)
message("Library filamat ignores Vulkan settings")
Expand Down
32 changes: 3 additions & 29 deletions android/filamat-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
android {
namespace 'com.google.android.filament.filamat'

flavorDimensions "functionality"
productFlavors {
full {
dimension "functionality"
}

lite {
dimension "functionality"

externalNativeBuild {
cmake {
arguments.add("-DFILAMAT_LITE=ON")
}
}
}
}

publishing {
singleVariant("fullRelease") {
withSourcesJar()
withJavadocJar()
}
singleVariant("liteRelease") {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
Expand All @@ -39,14 +18,9 @@ apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
afterEvaluate { project ->
publishing {
publications {
fullRelease(MavenPublication) {
release(MavenPublication) {
artifactId = POM_ARTIFACT_ID_FULL
from components.fullRelease
}

liteRelease(MavenPublication) {
artifactId = POM_ARTIFACT_ID_LITE
from components.liteRelease
from components.release
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,31 @@ public class SwapChain {
*/
public static final long CONFIG_SRGB_COLORSPACE = 0x10;

/**
* Indicates that this SwapChain should allocate a stencil buffer in addition to a depth buffer.
*
* This flag is necessary when using View::setStencilBufferEnabled and rendering directly into
* the SwapChain (when post-processing is disabled).
*
* The specific format of the stencil buffer depends on platform support. The following pixel
* formats are tried, in order of preference:
*
* Depth only (without CONFIG_HAS_STENCIL_BUFFER):
* - DEPTH32F
* - DEPTH24
*
* Depth + stencil (with CONFIG_HAS_STENCIL_BUFFER):
* - DEPTH32F_STENCIL8
* - DEPTH24F_STENCIL8
*
* Note that enabling the stencil buffer may hinder depth precision and should only be used if
* necessary.
*
* @see View#setStencilBufferEnabled
* @see View#setPostProcessingEnabled
*/
public static final long CONFIG_HAS_STENCIL_BUFFER = 0x20;

SwapChain(long nativeSwapChain, Object surface) {
mNativeObject = nativeSwapChain;
mSurface = surface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,8 @@ public DepthOfFieldOptions getDepthOfFieldOptions() {
* </p>
*
* <p>
* Post-processing must be enabled in order to use the stencil buffer.
* If post-processing is disabled, then the SwapChain must have the CONFIG_HAS_STENCIL_BUFFER
* flag set in order to use the stencil buffer.
* </p>
*
* <p>
Expand Down
3 changes: 0 additions & 3 deletions android/filament-utils-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ android {
}
}

defaultConfig {
missingDimensionStrategy 'functionality', 'full'
}
packagingOptions {
// No need to package up the following shared libs, which arise as a side effect of our
// externalNativeBuild dependencies. When clients pick and choose from project-level gradle
Expand Down
12 changes: 3 additions & 9 deletions android/gltfio-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
android {
namespace 'com.google.android.filament.gltfio'

flavorDimensions "functionality"
productFlavors {
full {
dimension "functionality"
}
}
packagingOptions {
// No need to package up the following shared libs, which arise as a side effect of our
// externalNativeBuild dependencies. When clients pick and choose from project-level gradle
Expand All @@ -18,7 +12,7 @@ android {
}

publishing {
singleVariant("fullRelease") {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
Expand All @@ -36,9 +30,9 @@ apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
afterEvaluate { project ->
publishing {
publications {
fullRelease(MavenPublication) {
release(MavenPublication) {
artifactId = POM_ARTIFACT_ID_FULL
from components.fullRelease
from components.release
}
}
}
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.44.0
VERSION_NAME=1.45.0

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

Expand Down
1 change: 0 additions & 1 deletion android/samples/sample-gltf-viewer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ android {
applicationId "com.google.android.filament.gltf"
minSdkVersion 19
targetSdkVersion versions.targetSdk
missingDimensionStrategy 'functionality', 'full'
}

// NOTE: This is a workaround required because the AGP task collectReleaseDependencies
Expand Down
7 changes: 0 additions & 7 deletions android/samples/sample-material-builder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ android {
targetSdkVersion versions.targetSdk
}

// The filamat library has two variants: full and lite. Here we default to the "full" variant.
// Replace "full" with "lite" to use the filamat-lite variant, which has a smaller binary size
// but comes with certain restrictions. See "Filamat Lite" in libs/filamat/README.md.
defaultConfig {
missingDimensionStrategy 'functionality', 'full'
}

// NOTE: This is a workaround required because the AGP task collectReleaseDependencies
// is not configuration-cache friendly yet; this is only useful for Play publication
dependenciesInfo {
Expand Down
1 change: 0 additions & 1 deletion android/samples/sample-textured-object/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ android {
applicationId "com.google.android.filament.textured"
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
missingDimensionStrategy 'functionality', 'full'
}

// NOTE: This is a workaround required because the AGP task collectReleaseDependencies
Expand Down
9 changes: 4 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,13 @@ function build_android {

if [[ "${INSTALL_COMMAND}" ]]; then
echo "Installing out/filamat-android-debug.aar..."
cp filamat-android/build/outputs/aar/filamat-android-full-debug.aar ../out/filamat-android-debug.aar
cp filamat-android/build/outputs/aar/filamat-android-debug.aar ../out/filamat-android-debug.aar

echo "Installing out/filament-android-debug.aar..."
cp filament-android/build/outputs/aar/filament-android-debug.aar ../out/

echo "Installing out/gltfio-android-debug.aar..."
cp gltfio-android/build/outputs/aar/gltfio-android-full-debug.aar ../out/gltfio-android-debug.aar
cp gltfio-android/build/outputs/aar/gltfio-android-debug.aar ../out/gltfio-android-debug.aar

echo "Installing out/filament-utils-android-debug.aar..."
cp filament-utils-android/build/outputs/aar/filament-utils-android-debug.aar ../out/filament-utils-android-debug.aar
Expand Down Expand Up @@ -544,14 +544,13 @@ function build_android {

if [[ "${INSTALL_COMMAND}" ]]; then
echo "Installing out/filamat-android-release.aar..."
cp filamat-android/build/outputs/aar/filamat-android-lite-release.aar ../out/
cp filamat-android/build/outputs/aar/filamat-android-full-release.aar ../out/filamat-android-release.aar
cp filamat-android/build/outputs/aar/filamat-android-release.aar ../out/filamat-android-release.aar

echo "Installing out/filament-android-release.aar..."
cp filament-android/build/outputs/aar/filament-android-release.aar ../out/

echo "Installing out/gltfio-android-release.aar..."
cp gltfio-android/build/outputs/aar/gltfio-android-full-release.aar ../out/gltfio-android-release.aar
cp gltfio-android/build/outputs/aar/gltfio-android-release.aar ../out/gltfio-android-release.aar

echo "Installing out/filament-utils-android-release.aar..."
cp filament-utils-android/build/outputs/aar/filament-utils-android-release.aar ../out/filament-utils-android-release.aar
Expand Down
1 change: 0 additions & 1 deletion build/common/test_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ libs/math/test_math
libs/image/test_image compare libs/image/tests/reference/
libs/utils/test_utils
libs/filamat/test_filamat
libs/filamat/test_filamat_lite
tools/matc/test_matc
tools/cmgen/test_cmgen compare
tools/glslminifier/test_glslminifier
Expand Down
5 changes: 5 additions & 0 deletions filament/backend/include/backend/DriverEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ static constexpr uint64_t SWAP_CHAIN_CONFIG_APPLE_CVPIXELBUFFER = 0x8;
*/
static constexpr uint64_t SWAP_CHAIN_CONFIG_SRGB_COLORSPACE = 0x10;

/**
* Indicates that the SwapChain should also contain a stencil component.
*/
static constexpr uint64_t SWAP_CHAIN_HAS_STENCIL_BUFFER = 0x20;


static constexpr size_t MAX_VERTEX_ATTRIBUTE_COUNT = 16; // This is guaranteed by OpenGL ES.
static constexpr size_t MAX_SAMPLER_COUNT = 62; // Maximum needed at feature level 3.
Expand Down
7 changes: 7 additions & 0 deletions filament/backend/include/backend/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class UTILS_PUBLIC Platform {
* Driver clamps to valid values.
*/
size_t handleArenaSize = 0;

/*
* this number of most-recently destroyed textures will be tracked for use-after-free.
* Throws an exception when a texture is freed but still bound to a SamplerGroup and used in
* a draw call. 0 disables completely. Currently only respected by the Metal backend.
*/
size_t textureUseAfterFreePoolSize = 0;
};

Platform() noexcept;
Expand Down
1 change: 1 addition & 0 deletions filament/backend/include/private/backend/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <backend/PipelineState.h>
#include <backend/TargetBufferInfo.h>

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

#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion filament/backend/include/private/backend/DriverAPI.inc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ DECL_DRIVER_API_R_N(backend::TextureHandle, importTexture,
backend::TextureUsage, usage)

DECL_DRIVER_API_R_N(backend::SamplerGroupHandle, createSamplerGroup,
uint32_t, size)
uint32_t, size, utils::FixedSizeString<32>, debugName)

DECL_DRIVER_API_R_N(backend::RenderPrimitiveHandle, createRenderPrimitive,
backend::VertexBufferHandle, vbh,
Expand Down
13 changes: 13 additions & 0 deletions filament/backend/src/metal/MetalContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <Metal/Metal.h>
#include <QuartzCore/QuartzCore.h>

#include <utils/FixedCircularBuffer.h>

#include <array>
#include <atomic>
#include <stack>
Expand Down Expand Up @@ -53,6 +55,9 @@ struct MetalVertexBuffer;
constexpr static uint8_t MAX_SAMPLE_COUNT = 8; // Metal devices support at most 8 MSAA samples

struct MetalContext {
explicit MetalContext(size_t metalFreedTextureListSize)
: texturesToDestroy(metalFreedTextureListSize) {}

MetalDriver* driver;
id<MTLDevice> device = nullptr;
id<MTLCommandQueue> commandQueue = nullptr;
Expand Down Expand Up @@ -111,6 +116,14 @@ struct MetalContext {
tsl::robin_set<MetalSamplerGroup*> samplerGroups;
tsl::robin_set<MetalTexture*> textures;

// This circular buffer implements delayed destruction for Metal texture handles. It keeps a
// handle to a fixed number of the most recently destroyed texture handles. When we're asked to
// destroy a texture handle, we free its texture memory, but keep the MetalTexture object alive,
// marking it as "terminated". If we later are asked to use that texture, we can check its
// terminated status and throw an Objective-C error instead of crashing, which is helpful for
// debugging use-after-free issues in release builds.
utils::FixedCircularBuffer<Handle<HwTexture>> texturesToDestroy;

MetalBufferPool* bufferPool;

MetalSwapChain* currentDrawSwapChain = nil;
Expand Down
Loading

0 comments on commit b2e0b97

Please sign in to comment.