diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index ad978f29d1..4a1a9c7fa7 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -7,5 +7,3 @@ for next branch cut* header. appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). ## Release notes for next branch cut - -- Fix a crash when compiling shaders on IMG devices diff --git a/README.md b/README.md index 9f4ffb12b2..66dfda7840 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation 'com.google.android.filament:filament-android:1.53.4' + implementation 'com.google.android.filament:filament-android:1.53.5' } ``` @@ -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.4' +pod 'Filament', '~> 1.53.5' ``` ### Snapshots diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d8d83f372f..84193ace37 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.54.0 + +- materials: add a new `stereoscopicType` material parameter. [⚠️ **New Material Version**] +- Fix a crash when compiling shaders on IMG devices + ## v1.53.5 - engine: Fix bug causing certain sampler parameters to not be applied correctly in GLES 2.0 and on diff --git a/android/gradle.properties b/android/gradle.properties index 4b7e670a41..a9eb5d0046 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.google.android.filament -VERSION_NAME=1.53.4 +VERSION_NAME=1.53.5 POM_DESCRIPTION=Real-time physically based rendering engine for Android. diff --git a/filament/src/MaterialParser.cpp b/filament/src/MaterialParser.cpp index 8beb83c5e5..e2e62be505 100644 --- a/filament/src/MaterialParser.cpp +++ b/filament/src/MaterialParser.cpp @@ -355,6 +355,12 @@ bool MaterialParser::getSpecularAntiAliasingThreshold(float* value) const noexce return mImpl.getFromSimpleChunk(ChunkType::MaterialSpecularAntiAliasingThreshold, value); } +bool MaterialParser::getStereoscopicType(backend::StereoscopicType* value) const noexcept { + static_assert(sizeof(StereoscopicType) == sizeof(uint8_t), + "StereoscopicType expected size is wrong"); + return mImpl.getFromSimpleChunk(ChunkType::MaterialStereoscopicType, reinterpret_cast(value)); +} + bool MaterialParser::getRequiredAttributes(AttributeBitset* value) const noexcept { uint32_t rawAttributes = 0; if (!mImpl.getFromSimpleChunk(ChunkType::MaterialRequiredAttributes, &rawAttributes)) { diff --git a/filament/src/MaterialParser.h b/filament/src/MaterialParser.h index 544fdcf810..4883a0dbba 100644 --- a/filament/src/MaterialParser.h +++ b/filament/src/MaterialParser.h @@ -125,6 +125,7 @@ public: bool hasSpecularAntiAliasing(bool* value) const noexcept; bool getSpecularAntiAliasingVariance(float* value) const noexcept; bool getSpecularAntiAliasingThreshold(float* value) const noexcept; + bool getStereoscopicType(backend::StereoscopicType*) const noexcept; bool getShader(filaflat::ShaderContent& shader, backend::ShaderModel shaderModel, Variant variant, backend::ShaderStage stage) noexcept; diff --git a/filament/src/PostProcessManager.cpp b/filament/src/PostProcessManager.cpp index 4612505870..e8a0ac31ac 100644 --- a/filament/src/PostProcessManager.cpp +++ b/filament/src/PostProcessManager.cpp @@ -513,7 +513,6 @@ PostProcessManager::StructurePassOutput PostProcessManager::structure(FrameGraph struct StructureMipmapData { FrameGraphId depth; - uint32_t rt[8]; }; fg.addPass("StructureMipmap", @@ -524,7 +523,7 @@ PostProcessManager::StructurePassOutput PostProcessManager::structure(FrameGraph .level = uint8_t(i) }); out = builder.write(out, FrameGraphTexture::Usage::DEPTH_ATTACHMENT); - data.rt[i - 1] = builder.declareRenderPass("Structure mip target", { + builder.declareRenderPass("Structure mip target", { .attachments = { .depth = out } }); } diff --git a/filament/src/details/Material.cpp b/filament/src/details/Material.cpp index 3bba853151..0a8809a0e6 100644 --- a/filament/src/details/Material.cpp +++ b/filament/src/details/Material.cpp @@ -195,6 +195,22 @@ Material* Material::Builder::build(Engine& engine) { return nullptr; } + MaterialDomain materialDomain; + materialParser->getMaterialDomain(&materialDomain); + if (materialDomain == MaterialDomain::SURFACE) { + StereoscopicType const engineStereoscopicType = engine.getConfig().stereoscopicType; + StereoscopicType materialStereoscopicType = StereoscopicType::NONE; + materialParser->getStereoscopicType(&materialStereoscopicType); + if (materialStereoscopicType != engineStereoscopicType) { + CString name; + materialParser->getName(&name); + slog.w << "The stereoscopic type in the compiled material '" << name.c_str_safe() + << "' is " << (int)materialStereoscopicType + << ", which is not compatiable with the engine's setting " + << (int)engineStereoscopicType << "." << io::endl; + } + } + return downcast(engine).createMaterial(*this, std::move(materialParser)); } @@ -203,8 +219,7 @@ FMaterial::FMaterial(FEngine& engine, const Material::Builder& builder, : mIsDefaultMaterial(builder->mDefaultMaterial), mEngine(engine), mMaterialId(engine.getMaterialId()), - mMaterialParser(std::move(materialParser)) -{ + mMaterialParser(std::move(materialParser)) { MaterialParser* const parser = mMaterialParser.get(); UTILS_UNUSED_IN_RELEASE bool const nameOk = parser->getName(&mName); diff --git a/ios/CocoaPods/Filament.podspec b/ios/CocoaPods/Filament.podspec index 49be1bc40a..ad8c4c6add 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.4" + spec.version = "1.53.5" 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.4/filament-v1.53.4-ios.tgz" } + spec.source = { :http => "https://github.com/google/filament/releases/download/v1.53.5/filament-v1.53.5-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/filabridge/include/filament/MaterialChunkType.h b/libs/filabridge/include/filament/MaterialChunkType.h index 5ad99cceb6..4d9f6a7deb 100644 --- a/libs/filabridge/include/filament/MaterialChunkType.h +++ b/libs/filabridge/include/filament/MaterialChunkType.h @@ -92,6 +92,7 @@ enum UTILS_PUBLIC ChunkType : uint64_t { MaterialVertexDomain = charTo64bitNum("MAT_VEDO"), MaterialInterpolation = charTo64bitNum("MAT_INTR"), + MaterialStereoscopicType = charTo64bitNum("MAT_STER"), DictionaryText = charTo64bitNum("DIC_TEXT"), DictionarySpirv = charTo64bitNum("DIC_SPIR"), diff --git a/libs/filabridge/include/filament/MaterialEnums.h b/libs/filabridge/include/filament/MaterialEnums.h index 4f57d34fb2..7cd2843372 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 = 53; +static constexpr size_t MATERIAL_VERSION = 54; /** * Supported shading models diff --git a/libs/filagui/CMakeLists.txt b/libs/filagui/CMakeLists.txt index 55f3d867ff..dac013ce7f 100644 --- a/libs/filagui/CMakeLists.txt +++ b/libs/filagui/CMakeLists.txt @@ -40,14 +40,20 @@ endif() file(MAKE_DIRECTORY ${MATERIAL_DIR}) +set (MATC_FLAGS ${MATC_BASE_FLAGS}) +if (FILAMENT_SAMPLES_STEREO_TYPE STREQUAL "instanced") + set (MATC_FLAGS ${MATC_FLAGS} -PstereoscopicType=instanced) +elseif (FILAMENT_SAMPLES_STEREO_TYPE STREQUAL "multiview") + set (MATC_FLAGS ${MATC_FLAGS} -PstereoscopicType=multiview) +endif () + foreach (mat_src ${MATERIAL_SRCS}) get_filename_component(localname "${mat_src}" NAME_WE) get_filename_component(fullname "${mat_src}" ABSOLUTE) set(output_path "${MATERIAL_DIR}/${localname}.filamat") - add_custom_command( OUTPUT ${output_path} - COMMAND matc ${MATC_BASE_FLAGS} -o ${output_path} ${fullname} + COMMAND matc ${MATC_FLAGS} -o ${output_path} ${fullname} DEPENDS ${mat_src} matc COMMENT "Compiling material ${mat_src} to ${output_path}" ) diff --git a/libs/filamat/src/MaterialBuilder.cpp b/libs/filamat/src/MaterialBuilder.cpp index f30b2df028..dc6bf92573 100644 --- a/libs/filamat/src/MaterialBuilder.cpp +++ b/libs/filamat/src/MaterialBuilder.cpp @@ -1601,6 +1601,7 @@ void MaterialBuilder::writeCommonChunks(ChunkContainer& container, MaterialInfo& } } container.emplace(ChunkType::MaterialProperties, properties); + container.emplace(ChunkType::MaterialStereoscopicType, static_cast(mStereoscopicType)); } // create a unique material id diff --git a/web/filament-js/package.json b/web/filament-js/package.json index aef76f6820..1397ef3231 100644 --- a/web/filament-js/package.json +++ b/web/filament-js/package.json @@ -1,6 +1,6 @@ { "name": "filament", - "version": "1.53.4", + "version": "1.53.5", "description": "Real-time physically based rendering engine", "main": "filament.js", "module": "filament.js",