From 0bb96f0b62b903399456d198d3d97773acf976f1 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Fri, 28 Mar 2025 15:38:42 -0700 Subject: [PATCH 1/4] Update MATERIAL_VERSION to 59 --- libs/filabridge/include/filament/MaterialEnums.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/filabridge/include/filament/MaterialEnums.h b/libs/filabridge/include/filament/MaterialEnums.h index 18bca04540..abe3b1ba7d 100644 --- a/libs/filabridge/include/filament/MaterialEnums.h +++ b/libs/filabridge/include/filament/MaterialEnums.h @@ -28,7 +28,7 @@ namespace filament { // update this when a new version of filament wouldn't work with older materials -static constexpr size_t MATERIAL_VERSION = 58; +static constexpr size_t MATERIAL_VERSION = 59; /** * Supported shading models From 3c02eb9a6341f8e6b1cc27de090957ba09db439c Mon Sep 17 00:00:00 2001 From: Juan Caldas Date: Mon, 31 Mar 2025 18:03:04 -0400 Subject: [PATCH 2/4] WebGPU initial handle implementation (#8566) * initial handle pass --- .../include/private/backend/HandleAllocator.h | 8 ++++--- filament/backend/src/HandleAllocator.cpp | 4 ++++ filament/backend/src/webgpu/WebGPUDriver.cpp | 17 ++++++++++---- filament/backend/src/webgpu/WebGPUDriver.h | 23 ++++++++++++++++--- .../src/webgpu/platform/WebGPUPlatform.cpp | 4 ++-- 5 files changed, 43 insertions(+), 13 deletions(-) diff --git a/filament/backend/include/private/backend/HandleAllocator.h b/filament/backend/include/private/backend/HandleAllocator.h index 389ff98293..38754af3a2 100644 --- a/filament/backend/include/private/backend/HandleAllocator.h +++ b/filament/backend/include/private/backend/HandleAllocator.h @@ -40,9 +40,11 @@ #include #include -#define HandleAllocatorGL HandleAllocator<32, 96, 184> // ~4520 / pool / MiB -#define HandleAllocatorVK HandleAllocator<64, 160, 312> // ~1820 / pool / MiB -#define HandleAllocatorMTL HandleAllocator<32, 64, 552> // ~1660 / pool / MiB +#define HandleAllocatorGL HandleAllocator<32, 96, 184> // ~4520 / pool / MiB +#define HandleAllocatorVK HandleAllocator<64, 160, 312> // ~1820 / pool / MiB +#define HandleAllocatorMTL HandleAllocator<32, 64, 552> // ~1660 / pool / MiB +// TODO WebGPU examine right size of handles +#define HandleAllocatorWGPU HandleAllocator<64, 160, 552> // ~1820 / pool / MiB namespace filament::backend { diff --git a/filament/backend/src/HandleAllocator.cpp b/filament/backend/src/HandleAllocator.cpp index 4e457c75e4..3638ad4dfc 100644 --- a/filament/backend/src/HandleAllocator.cpp +++ b/filament/backend/src/HandleAllocator.cpp @@ -211,4 +211,8 @@ template class HandleAllocatorVK; template class HandleAllocatorMTL; #endif +#if defined (FILAMENT_SUPPORTS_WEBGPU) +template class HandleAllocatorWGPU; +#endif + } // namespace filament::backend diff --git a/filament/backend/src/webgpu/WebGPUDriver.cpp b/filament/backend/src/webgpu/WebGPUDriver.cpp index 88a3a42c69..5e26369df6 100644 --- a/filament/backend/src/webgpu/WebGPUDriver.cpp +++ b/filament/backend/src/webgpu/WebGPUDriver.cpp @@ -252,12 +252,19 @@ void printDeviceDetails(wgpu::Device const& device) { }// namespace -Driver* WebGPUDriver::create(WebGPUPlatform& platform) noexcept { - return new WebGPUDriver(platform); +Driver* WebGPUDriver::create(WebGPUPlatform& platform, const Platform::DriverConfig& driverConfig) noexcept { + constexpr size_t defaultSize = FILAMENT_WEBGPU_HANDLE_ARENA_SIZE_IN_MB * 1024U * 1024U; + Platform::DriverConfig validConfig {driverConfig}; + validConfig.handleArenaSize = std::max(driverConfig.handleArenaSize, defaultSize); + return new WebGPUDriver(platform, validConfig); } -WebGPUDriver::WebGPUDriver(WebGPUPlatform& platform) noexcept - : mPlatform(platform) { +WebGPUDriver::WebGPUDriver(WebGPUPlatform& platform, const Platform::DriverConfig& driverConfig) noexcept + : mPlatform(platform), + mHandleAllocator("Handles", + driverConfig.handleArenaSize, + driverConfig.disableHandleUseAfterFreeCheck, + driverConfig.disableHeapHandleTags) { #if FWGPU_ENABLED(FWGPU_PRINT_SYSTEM) printInstanceDetails(mPlatform.getInstance()); #endif @@ -385,7 +392,7 @@ Handle WebGPUDriver::createTimerQueryS() noexcept { } Handle WebGPUDriver::createIndexBufferS() noexcept { - return Handle((Handle::HandleId) mNextFakeHandle++); + return allocHandle(); } Handle WebGPUDriver::createTextureViewS() noexcept { diff --git a/filament/backend/src/webgpu/WebGPUDriver.h b/filament/backend/src/webgpu/WebGPUDriver.h index dd061d8609..9bdc4e1d1a 100644 --- a/filament/backend/src/webgpu/WebGPUDriver.h +++ b/filament/backend/src/webgpu/WebGPUDriver.h @@ -22,6 +22,7 @@ #include "DriverBase.h" #include "private/backend/Dispatcher.h" #include "private/backend/Driver.h" +#include "private/backend/HandleAllocator.h" #include #include @@ -30,6 +31,10 @@ #include +#ifndef FILAMENT_WEBGPU_HANDLE_ARENA_SIZE_IN_MB +# define FILAMENT_WEBGPU_HANDLE_ARENA_SIZE_IN_MB 8 +#endif + namespace filament::backend { /** @@ -40,10 +45,10 @@ public: ~WebGPUDriver() noexcept override; [[nodiscard]] Dispatcher getDispatcher() const noexcept final; - [[nodiscard]] static Driver* create(WebGPUPlatform& platform) noexcept; + [[nodiscard]] static Driver* create(WebGPUPlatform& platform, const Platform::DriverConfig& driverConfig) noexcept; private: - explicit WebGPUDriver(WebGPUPlatform& platform) noexcept; + explicit WebGPUDriver(WebGPUPlatform& platform, const Platform::DriverConfig& driverConfig) noexcept; [[nodiscard]] ShaderModel getShaderModel() const noexcept final; [[nodiscard]] ShaderLanguage getShaderLanguage() const noexcept final; @@ -74,8 +79,20 @@ private: UTILS_ALWAYS_INLINE inline void methodName##R(RetType, paramsDecl); #include "private/backend/DriverAPI.inc" + + /* + * Memory management + */ + + HandleAllocatorWGPU mHandleAllocator; + + template + Handle allocHandle() { + return mHandleAllocator.allocate(); + } + }; }// namespace filament::backend -#endif// TNT_FILAMENT_BACKEND_WEBGPUDRIVER_H +#endif // TNT_FILAMENT_BACKEND_WEBGPUDRIVER_H diff --git a/filament/backend/src/webgpu/platform/WebGPUPlatform.cpp b/filament/backend/src/webgpu/platform/WebGPUPlatform.cpp index 51d7d1ebf3..be2c5f0233 100644 --- a/filament/backend/src/webgpu/platform/WebGPUPlatform.cpp +++ b/filament/backend/src/webgpu/platform/WebGPUPlatform.cpp @@ -144,13 +144,13 @@ wgpu::Device WebGPUPlatform::requestDevice(wgpu::Adapter const& adapter) { } Driver* WebGPUPlatform::createDriver(void* sharedContext, - const Platform::DriverConfig& /*driverConfig*/) noexcept { + const Platform::DriverConfig& driverConfig) noexcept { if (sharedContext) { FWGPU_LOGW << "sharedContext is ignored/unused in the WebGPU backend. A non-null " "sharedContext was provided, but it will be ignored." << utils::io::endl; } - return WebGPUDriver::create(*this); + return WebGPUDriver::create(*this, driverConfig); } WebGPUPlatform::WebGPUPlatform() From 87dbd592755355f297f1e304204d89b443e264d4 Mon Sep 17 00:00:00 2001 From: Sungun Park Date: Mon, 31 Mar 2025 22:23:11 +0000 Subject: [PATCH 3/4] Release Filament 1.59.0 --- 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 69c8121740..b60dcb9361 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation 'com.google.android.filament:filament-android:1.58.2' + implementation 'com.google.android.filament:filament-android:1.59.0' } ``` @@ -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.58.2' +pod 'Filament', '~> 1.59.0' ``` ## Documentation diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4e1eced50b..bc201acb00 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.59.1 + + ## v1.59.0 - materials: five custom variables (varyings) are now available on the condition that the `color` attribute is not requested (b/404930099). [⚠️ **New Material Version**] diff --git a/android/gradle.properties b/android/gradle.properties index 629265d608..949f266383 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.google.android.filament -VERSION_NAME=1.58.2 +VERSION_NAME=1.59.0 POM_DESCRIPTION=Real-time physically based rendering engine for Android. diff --git a/ios/CocoaPods/Filament.podspec b/ios/CocoaPods/Filament.podspec index 1a05da8368..251251212f 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.58.2" + spec.version = "1.59.0" 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.58.2/filament-v1.58.2-ios.tgz" } + spec.source = { :http => "https://github.com/google/filament/releases/download/v1.59.0/filament-v1.59.0-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 face610b61..81163ca882 100644 --- a/web/filament-js/package.json +++ b/web/filament-js/package.json @@ -1,6 +1,6 @@ { "name": "filament", - "version": "1.58.2", + "version": "1.59.0", "description": "Real-time physically based rendering engine", "main": "filament.js", "module": "filament.js", From c24e5089c4456d2706b506c197939e49de9b4e72 Mon Sep 17 00:00:00 2001 From: Sungun Park Date: Mon, 31 Mar 2025 22:23:27 +0000 Subject: [PATCH 4/4] Bump version to 1.59.1 --- README.md | 4 ++-- android/gradle.properties | 2 +- ios/CocoaPods/Filament.podspec | 4 ++-- web/filament-js/package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b60dcb9361..0fce055b2e 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation 'com.google.android.filament:filament-android:1.59.0' + implementation 'com.google.android.filament:filament-android:1.59.1' } ``` @@ -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.59.0' +pod 'Filament', '~> 1.59.1' ``` ## Documentation diff --git a/android/gradle.properties b/android/gradle.properties index 949f266383..6b5314581c 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.google.android.filament -VERSION_NAME=1.59.0 +VERSION_NAME=1.59.1 POM_DESCRIPTION=Real-time physically based rendering engine for Android. diff --git a/ios/CocoaPods/Filament.podspec b/ios/CocoaPods/Filament.podspec index 251251212f..7ab449f6b4 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.59.0" + spec.version = "1.59.1" 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.59.0/filament-v1.59.0-ios.tgz" } + spec.source = { :http => "https://github.com/google/filament/releases/download/v1.59.1/filament-v1.59.1-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 81163ca882..e4e18dd319 100644 --- a/web/filament-js/package.json +++ b/web/filament-js/package.json @@ -1,6 +1,6 @@ { "name": "filament", - "version": "1.59.0", + "version": "1.59.1", "description": "Real-time physically based rendering engine", "main": "filament.js", "module": "filament.js",