From 2d21fcbe55f74ccec8d75b0b6a234a6fad3cd374 Mon Sep 17 00:00:00 2001 From: Balaji M Date: Tue, 30 Jul 2024 22:12:04 -0400 Subject: [PATCH 1/5] [gltfio] Initialize mCgltfBuffersLoaded to fix crash (#7999) Value of mCgltfBuffersLoaded is sometimes retained across creation of FAssetLoader which skips loading the buffer in AssetLoaderExtended#createPrimitive leading to null pointer crash --- libs/gltfio/src/extended/AssetLoaderExtended.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/gltfio/src/extended/AssetLoaderExtended.h b/libs/gltfio/src/extended/AssetLoaderExtended.h index a803fb4f13..bac61c85f0 100644 --- a/libs/gltfio/src/extended/AssetLoaderExtended.h +++ b/libs/gltfio/src/extended/AssetLoaderExtended.h @@ -70,7 +70,8 @@ struct AssetLoaderExtended { : mEngine(engine), mGltfPath(config.gltfPath), mMaterials(materials), - mUriDataCache(std::make_shared()) {} + mUriDataCache(std::make_shared()), + mCgltfBuffersLoaded(false) {} ~AssetLoaderExtended() = default; From 4125802644d666ce1b431465244c781de027f5c2 Mon Sep 17 00:00:00 2001 From: Sungun Park Date: Wed, 31 Jul 2024 16:22:54 +0000 Subject: [PATCH 2/5] Release Filament 1.53.3 --- README.md | 4 ++-- RELEASE_NOTES.md | 3 +++ android/gradle.properties | 2 +- ios/CocoaPods/Filament.podspec | 4 ++-- web/filament-js/package.json | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 97e81b5e08..51e921b31d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation 'com.google.android.filament:filament-android:1.53.2' + implementation 'com.google.android.filament:filament-android:1.53.3' } ``` @@ -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.53.2' +pod 'Filament', '~> 1.53.3' ``` ### Snapshots diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d1392c5a60..805b8f277c 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -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.53.4 + + ## v1.53.3 - Add drag and drop support for IBL files for desktop gltf_viewer. diff --git a/android/gradle.properties b/android/gradle.properties index 7994c61d4a..79f3285970 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.google.android.filament -VERSION_NAME=1.53.2 +VERSION_NAME=1.53.3 POM_DESCRIPTION=Real-time physically based rendering engine for Android. diff --git a/ios/CocoaPods/Filament.podspec b/ios/CocoaPods/Filament.podspec index f1f1105fa3..07eccef0bd 100644 --- a/ios/CocoaPods/Filament.podspec +++ b/ios/CocoaPods/Filament.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |spec| spec.name = "Filament" - spec.version = "1.53.2" + spec.version = "1.53.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.53.2/filament-v1.53.2-ios.tgz" } + spec.source = { :http => "https://github.com/google/filament/releases/download/v1.53.3/filament-v1.53.3-ios.tgz" } # Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon. spec.pod_target_xcconfig = { diff --git a/web/filament-js/package.json b/web/filament-js/package.json index c381eef571..a79fd893ab 100644 --- a/web/filament-js/package.json +++ b/web/filament-js/package.json @@ -1,6 +1,6 @@ { "name": "filament", - "version": "1.53.2", + "version": "1.53.3", "description": "Real-time physically based rendering engine", "main": "filament.js", "module": "filament.js", From 324dcd3c86f3964e8526232c45168e75822109ae Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 30 Jul 2024 15:06:44 -0700 Subject: [PATCH 3/5] early exit in fog to improve performance --- shaders/src/fog.fs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shaders/src/fog.fs b/shaders/src/fog.fs index 17029480ca..fbd41720a4 100644 --- a/shaders/src/fog.fs +++ b/shaders/src/fog.fs @@ -7,6 +7,11 @@ vec4 fog(vec4 color, highp vec3 view) { // note: d can be +inf with the skybox highp float d = length(view); + // early exit for object "in front" of the fog + if (d < frameUniforms.fogStart) { + return color; + } + // fogCutOffDistance is set to +inf to disable the cutoff distance if (d > frameUniforms.fogCutOffDistance) { return color; From a2f5b635d130040e2a7b10bf0e2430a4e01dacfb Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 30 Jul 2024 09:39:09 -0700 Subject: [PATCH 4/5] don't mix seq_cst with other memory orders this change shouldn't have any impact on ARM, however, according to cppreference it's not safe to mix seq_cst with other memory orders: "as soon as atomic operations that are not tagged memory_order_seq_cst enter the picture, the sequential consistency guarantee for the program is lost" --- libs/utils/include/utils/WorkStealingDequeue.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/utils/include/utils/WorkStealingDequeue.h b/libs/utils/include/utils/WorkStealingDequeue.h index f9f5b5fbc2..43735f0a57 100644 --- a/libs/utils/include/utils/WorkStealingDequeue.h +++ b/libs/utils/include/utils/WorkStealingDequeue.h @@ -92,9 +92,11 @@ void WorkStealingDequeue::push(TYPE item) noexcept { index_t bottom = mBottom.load(std::memory_order_relaxed); setItemAt(bottom, item); - // std::memory_order_release is used because we release the item we just pushed to other + // Here we need std::memory_order_release because we release, the item we just pushed, to other // threads which are calling steal(). - mBottom.store(bottom + 1, std::memory_order_release); + // However, generally seq_cst cannot be mixed with other memory orders. So we must use seq_cst. + // see: https://plv.mpi-sws.org/scfix/paper.pdf + mBottom.store(bottom + 1, std::memory_order_seq_cst); } /* @@ -154,9 +156,11 @@ TYPE WorkStealingDequeue::pop() noexcept { assert(top - bottom == 1); } - // std::memory_order_relaxed used because we're not publishing any data. + // Here, we only need std::memory_order_relaxed because we're not publishing any data. // No concurrent writes to mBottom possible, it's always safe to write mBottom. - mBottom.store(top, std::memory_order_relaxed); + // However, generally seq_cst cannot be mixed with other memory orders. So we must use seq_cst. + // see: https://plv.mpi-sws.org/scfix/paper.pdf + mBottom.store(top, std::memory_order_seq_cst); return item; } From 14ddadd2f6b18ad994d437439c70f31f9744bee0 Mon Sep 17 00:00:00 2001 From: Eliza Velasquez Date: Tue, 30 Jul 2024 17:05:19 -0700 Subject: [PATCH 5/5] Fix ES2/anisotropy bug in updateSamplerGroup This function attempts to set texture parameters in these two cases, but the texture is not guaranteed to be bound. Perhaps it once was, but the assumption broke at some point. --- NEW_RELEASE_NOTES.md | 3 +++ filament/backend/src/opengl/OpenGLDriver.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index 4a1a9c7fa7..598b7a4210 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -7,3 +7,6 @@ for next branch cut* header. appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). ## Release notes for next branch cut + +- engine: Fix bug causing certain sampler parameters to not be applied correctly in GLES 2.0 and on + certain GLES 3.0 drivers. diff --git a/filament/backend/src/opengl/OpenGLDriver.cpp b/filament/backend/src/opengl/OpenGLDriver.cpp index 5b011ee625..5523dd038e 100644 --- a/filament/backend/src/opengl/OpenGLDriver.cpp +++ b/filament/backend/src/opengl/OpenGLDriver.cpp @@ -2341,6 +2341,15 @@ void OpenGLDriver::updateSamplerGroup(Handle sbh, GLTexture const* const t = handle_cast(th); assert_invariant(t); + if (UTILS_UNLIKELY(es2) +#if defined(GL_EXT_texture_filter_anisotropic) + || UTILS_UNLIKELY(anisotropyWorkaround) + #endif + ) { + // We must set texture parameters on the texture itself. + bindTexture(OpenGLContext::DUMMY_TEXTURE_BINDING, t); + } + SamplerParams params = pSamplers[i].s; if (UTILS_UNLIKELY(t->target == SamplerType::SAMPLER_EXTERNAL)) { // From OES_EGL_image_external spec: