diff --git a/BUILDING.md b/BUILDING.md index 1577e02768..d2191109cf 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -78,7 +78,7 @@ To turn an option on or off: ``` $ cd -$ cmake . -DOPTION=ON # Relace OPTION with the option name, set to ON / OFF +$ cmake . -DOPTION=ON # Replace OPTION with the option name, set to ON / OFF ``` Options can also be set with the CMake GUI. @@ -181,7 +181,7 @@ Install the following components: - [Python 3.7](https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe) - [CMake 3.14 or later](https://github.com/Kitware/CMake/releases/download/v3.14.7/cmake-3.14.7-win64-x64.msi) -The latest Windows SDK can also by installed by opening Visual Studio and selecting _Get Tools and +The latest Windows SDK can also be installed by opening Visual Studio and selecting _Get Tools and Features..._ under the _Tools_ menu. By default, Windows treats the file system as case insensitive. Please do not enable case diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index c3161a7700..4a1a9c7fa7 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -7,4 +7,3 @@ for next branch cut* header. appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). ## Release notes for next branch cut - diff --git a/README.md b/README.md index 76d5c09fd2..5919616f23 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation 'com.google.android.filament:filament-android:1.40.1' + implementation 'com.google.android.filament:filament-android:1.40.2' } ``` @@ -50,7 +50,7 @@ Here are all the libraries available in the group `com.google.android.filament`: iOS projects can use CocoaPods to install the latest release: ``` -pod 'Filament', '~> 1.40.1' +pod 'Filament', '~> 1.40.2' ``` ### Snapshots diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index b63adf8f66..af3f8746a3 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,6 +7,11 @@ 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.40.2 + +- rendering: dynamic resolution would not work with a translucent render target and quality > low +- Java/Kotlin: user callbacks were not invoked on successful texture upload + ## v1.40.1 ## v1.40.0 diff --git a/android/filament-android/src/main/cpp/Texture.cpp b/android/filament-android/src/main/cpp/Texture.cpp index bb5be8fd43..ef778056c0 100644 --- a/android/filament-android/src/main/cpp/Texture.cpp +++ b/android/filament-android/src/main/cpp/Texture.cpp @@ -511,9 +511,7 @@ public: private: void* mData = nullptr; - jobject mBitmap = nullptr; - jobject mHandler = nullptr; - jobject mCallback = nullptr; + jobject mBitmap{}; AndroidBitmapInfo mInfo{}; }; diff --git a/android/gradle.properties b/android/gradle.properties index 3177ba84cf..b8b4349e66 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.google.android.filament -VERSION_NAME=1.40.1 +VERSION_NAME=1.40.2 POM_DESCRIPTION=Real-time physically based rendering engine for Android. diff --git a/android/samples/sample-textured-object/src/main/java/com/google/android/filament/textured/MainActivity.kt b/android/samples/sample-textured-object/src/main/java/com/google/android/filament/textured/MainActivity.kt index 9e6e79dad0..4016d35f38 100644 --- a/android/samples/sample-textured-object/src/main/java/com/google/android/filament/textured/MainActivity.kt +++ b/android/samples/sample-textured-object/src/main/java/com/google/android/filament/textured/MainActivity.kt @@ -231,7 +231,7 @@ class MainActivity : Activity() { animator.repeatCount = ValueAnimator.INFINITE animator.addUpdateListener { a -> val v = (a.animatedValue as Float) - camera.lookAt(cos(v) * 4.5, 1.5, sin(v) * 4.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) + camera.lookAt(cos(v) * 5.5, 1.5, sin(v) * 5.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) } animator.start() } @@ -253,7 +253,7 @@ class MainActivity : Activity() { // Stop the animation and any pending frame choreographer.removeFrameCallback(frameScheduler) - animator.cancel(); + animator.cancel() // Always detach the surface before destroying the engine uiHelper.detach() diff --git a/android/samples/sample-transparent-view/src/main/java/com/google/android/filament/transparentrendering/MainActivity.kt b/android/samples/sample-transparent-view/src/main/java/com/google/android/filament/transparentrendering/MainActivity.kt index 19cfecd0ad..5991d7e47c 100644 --- a/android/samples/sample-transparent-view/src/main/java/com/google/android/filament/transparentrendering/MainActivity.kt +++ b/android/samples/sample-transparent-view/src/main/java/com/google/android/filament/transparentrendering/MainActivity.kt @@ -140,9 +140,9 @@ class MainActivity : Activity() { camera = engine.createCamera(engine.entityManager.create()) // clear the swapchain with transparent pixels - val options = renderer.clearOptions - options.clear = true - renderer.clearOptions = options + renderer.clearOptions = renderer.clearOptions.apply { + clear = true + } } private fun setupView() { diff --git a/build.sh b/build.sh index b7916a1623..a6b5985d01 100755 --- a/build.sh +++ b/build.sh @@ -90,8 +90,8 @@ function print_help { echo " Desktop matc target, release build:" echo " \$ ./$self_name release matc" echo "" - echo " Build gltf_viewer then immediately run it with no arguments:" - echo " \$ ./$self_name release run_gltf_viewer" + echo " Build gltf_viewer:" + echo " \$ ./$self_name release gltf_viewer" echo "" } diff --git a/filament/backend/src/vulkan/VulkanContext.cpp b/filament/backend/src/vulkan/VulkanContext.cpp index 84f456f571..b2c14cfe3c 100644 --- a/filament/backend/src/vulkan/VulkanContext.cpp +++ b/filament/backend/src/vulkan/VulkanContext.cpp @@ -85,10 +85,10 @@ VkImageSubresourceRange VulkanAttachment::getSubresourceRange(VkImageAspectFlags VulkanTimestamps::VulkanTimestamps(VkDevice device) : mDevice(device) { // Create a timestamp pool large enough to hold a pair of queries for each timer. VkQueryPoolCreateInfo tqpCreateInfo = { - .sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, - .queryType = VK_QUERY_TYPE_TIMESTAMP, + .sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, + .queryType = VK_QUERY_TYPE_TIMESTAMP, }; - std::unique_lock timestamps_lock(mMutex); + std::unique_lock lock(mMutex); tqpCreateInfo.queryCount = mUsed.size() * 2; VkResult result = vkCreateQueryPool(mDevice, &tqpCreateInfo, VKALLOC, &mPool); ASSERT_POSTCONDITION(result == VK_SUCCESS, "vkCreateQueryPool error."); @@ -115,23 +115,23 @@ void VulkanTimestamps::clearQuery(uint32_t queryIndex) { void VulkanTimestamps::beginQuery(VulkanCommandBuffer const* commands, VulkanTimerQuery* query) { - uint32_t const index = query->startingQueryIndex; + uint32_t const index = query->getStartingQueryIndex(); vkCmdResetQueryPool(commands->cmdbuffer, mPool, index, 2); vkCmdWriteTimestamp(commands->cmdbuffer, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, mPool, index); // We stash this because getResult might come before the query is actually processed. - query->fence = commands->fence; + query->setFence(commands->fence); } void VulkanTimestamps::endQuery(VulkanCommandBuffer const* commands, VulkanTimerQuery const* query) { - uint32_t const index = query->stoppingQueryIndex; + uint32_t const index = query->getStoppingQueryIndex(); vkCmdWriteTimestamp(commands->cmdbuffer, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, mPool, index); } VulkanTimestamps::QueryResult VulkanTimestamps::getResult(VulkanTimerQuery const* query) { - uint32_t const index = query->startingQueryIndex; + uint32_t const index = query->getStartingQueryIndex(); QueryResult result; size_t const dataSize = result.size() * sizeof(uint64_t); VkDeviceSize const stride = sizeof(uint64_t) * 2; diff --git a/filament/backend/src/vulkan/VulkanHandles.cpp b/filament/backend/src/vulkan/VulkanHandles.cpp index 53bd59baef..e3d4579cd3 100644 --- a/filament/backend/src/vulkan/VulkanHandles.cpp +++ b/filament/backend/src/vulkan/VulkanHandles.cpp @@ -297,20 +297,25 @@ void VulkanRenderPrimitive::setBuffers(VulkanVertexBuffer* vertexBuffer, } VulkanTimerQuery::VulkanTimerQuery(std::tuple indices) - : startingQueryIndex(std::get<0>(indices)), stoppingQueryIndex(std::get<1>(indices)) {} + : mStartingQueryIndex(std::get<0>(indices)), mStoppingQueryIndex(std::get<1>(indices)) {} -bool VulkanTimerQuery::isCompleted() const noexcept { +void VulkanTimerQuery::setFence(std::shared_ptr fence) noexcept { + std::unique_lock lock(mFenceMutex); + mFence = fence; +} + +bool VulkanTimerQuery::isCompleted() noexcept { + std::unique_lock lock(mFenceMutex); // QueryValue is a synchronous call and might occur before beginTimerQuery has written anything // into the command buffer, which is an error according to the validation layer that ships in // the Android NDK. Even when AVAILABILITY_BIT is set, validation seems to require that the // timestamp has at least been written into a processed command buffer. // This fence indicates that the corresponding buffer has been completed. - if (!fence) { + if (!mFence) { return false; } - - VkResult status = fence->status.load(std::memory_order_relaxed); + VkResult status = mFence->status.load(std::memory_order_relaxed); if (status != VK_SUCCESS) { return false; } diff --git a/filament/backend/src/vulkan/VulkanHandles.h b/filament/backend/src/vulkan/VulkanHandles.h index e7ae830c51..c234cf5394 100644 --- a/filament/backend/src/vulkan/VulkanHandles.h +++ b/filament/backend/src/vulkan/VulkanHandles.h @@ -26,6 +26,8 @@ #include "private/backend/SamplerGroup.h" +#include "utils/Mutex.h" + namespace filament::backend { class VulkanTimestamps; @@ -106,7 +108,7 @@ struct VulkanBufferObject : public HwBufferObject { VulkanStagePool& stagePool, uint32_t byteCount, BufferObjectBinding bindingType, BufferUsage usage); void terminate() { - buffer.terminate(); + buffer.terminate(); } VulkanBuffer buffer; const BufferObjectBinding bindingType; @@ -141,14 +143,24 @@ struct VulkanTimerQuery : public HwTimerQuery { explicit VulkanTimerQuery(std::tuple indices); ~VulkanTimerQuery(); - bool isCompleted() const noexcept; + void setFence(std::shared_ptr fence) noexcept; + + bool isCompleted() noexcept; + + uint32_t getStartingQueryIndex() const { + return mStartingQueryIndex; + } + + uint32_t getStoppingQueryIndex() const { + return mStoppingQueryIndex; + } private: - uint32_t startingQueryIndex; - uint32_t stoppingQueryIndex; + uint32_t mStartingQueryIndex; + uint32_t mStoppingQueryIndex; - std::shared_ptr fence; - friend class VulkanTimestamps; + std::shared_ptr mFence; + utils::Mutex mFenceMutex; }; inline constexpr VkBufferUsageFlagBits getBufferObjectUsage( diff --git a/filament/src/details/Renderer.cpp b/filament/src/details/Renderer.cpp index ec09b44bc4..3b01c13420 100644 --- a/filament/src/details/Renderer.cpp +++ b/filament/src/details/Renderer.cpp @@ -1050,7 +1050,7 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) { if (scaled) { mightNeedFinalBlit = false; auto viewport = DEBUG_DYNAMIC_SCALING ? xvp : vp; - input = ppm.upscale(fg, blendModeTranslucent, dsrOptions, input, xvp, { + input = ppm.upscale(fg, needsAlphaChannel, dsrOptions, input, xvp, { .width = viewport.width, .height = viewport.height, .format = colorGradingConfig.ldrFormat }); xvp.left = xvp.bottom = 0; diff --git a/ios/CocoaPods/Filament.podspec b/ios/CocoaPods/Filament.podspec index 7ea3d981eb..f8bd423974 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.40.1" + spec.version = "1.40.2" 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.40.1/filament-v1.40.1-ios.tgz" } + spec.source = { :http => "https://github.com/google/filament/releases/download/v1.40.2/filament-v1.40.2-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/libs/gltfio/src/ArchiveCache.cpp b/libs/gltfio/src/ArchiveCache.cpp index 07a08e428b..118beec0fd 100644 --- a/libs/gltfio/src/ArchiveCache.cpp +++ b/libs/gltfio/src/ArchiveCache.cpp @@ -120,6 +120,11 @@ Material* ArchiveCache::getMaterial(const ArchiveRequirements& reqs) { .build(mEngine); } + // Don't attempt to precompile shaders on WebGL. + // Chrome already suffers from slow shader compilation: + // https://github.com/google/filament/issues/6615 + // Precompiling shaders exacerbates the problem. +#if !defined(__EMSCRIPTEN__) // compile everything at low priority mMaterials[i]->compile(Material::CompilerPriorityQueue::LOW); @@ -128,6 +133,7 @@ Material* ArchiveCache::getMaterial(const ArchiveRequirements& reqs) { UserVariantFilterBit::DIRECTIONAL_LIGHTING | UserVariantFilterBit::DYNAMIC_LIGHTING | UserVariantFilterBit::SHADOW_RECEIVER); +#endif return mMaterials[i]; } diff --git a/libs/utils/src/Path.cpp b/libs/utils/src/Path.cpp index ae94641e1b..be70140fad 100644 --- a/libs/utils/src/Path.cpp +++ b/libs/utils/src/Path.cpp @@ -50,8 +50,13 @@ Path::Path(const std::string& path) } bool Path::exists() const { +#if defined(_WIN64) || defined(_M_X64) + struct _stat64 file; + return _stat64(c_str(), &file) == 0; +#else struct stat file; return stat(c_str(), &file) == 0; +#endif } bool Path::isFile() const { diff --git a/tnt/README.md b/third_party/getopt/tnt/README.md similarity index 100% rename from tnt/README.md rename to third_party/getopt/tnt/README.md diff --git a/web/filament-js/package.json b/web/filament-js/package.json index fe2497447a..759485c4e7 100644 --- a/web/filament-js/package.json +++ b/web/filament-js/package.json @@ -1,6 +1,6 @@ { "name": "filament", - "version": "1.40.1", + "version": "1.40.2", "description": "Real-time physically based rendering engine", "main": "filament.js", "module": "filament.js",