Skip to content

Commit 44a85a6

Browse files
committed
Merge branch 'main' into streamed_texture
2 parents ffd6e28 + 4e05cd7 commit 44a85a6

File tree

137 files changed

+3706
-1129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+3706
-1129
lines changed

BUILDING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ force a clean build by adding the `-c` flag in that case.
6262
To install the libraries and executables in `out/debug/` and `out/release/`, add the `-i` flag.
6363
The script offers more features described by executing `build.sh -h`.
6464

65+
For more specialized options, please also consider the following pages:
66+
- `-d`: [`matdbg`](https://google.github.io/filament/dup/matdbg.html)
67+
- `-t`: [`fgviewer`](https://google.github.io/filament/dup/fgviewer.html)
68+
- `-b` and `-y`: [ASAN/UBSAN builds](https://google.github.io/filament/notes/asan_ubsan.html)
69+
6570
### Filament-specific CMake Options
6671

6772
The following CMake options are boolean options specific to Filament:

CMakeLists.txt

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ if (MSVC)
398398
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE")
399399
endif()
400400

401-
# Add colors to ninja builds
402-
if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
401+
# Add colors to ninja builds (when not using gcc)
402+
if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja" AND NOT FILAMENT_USING_GCC)
403403
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
404404
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
405405
endif()
@@ -753,12 +753,61 @@ function(combine_static_libs TARGET OUTPUT DEPS)
753753
endfunction()
754754

755755
# ==================================================================================================
756-
# Configuration for CMAKE_CROSSCOMPILING.
757-
# ==================================================================================================
756+
# Configuration importing/exporting prebuilt "/tools" executables
757+
# ==================================================================================================
758+
759+
# In certain cases, we want the ability to separate the build type/flags (release, debug) of tools
760+
# (matc, resgen, etc...) from filament. Cross compilation is one such case (e.g. building material
761+
# with matc running on host while building filament for Android) [1]. Another example is when client
762+
# wants to enable ASAN for filament but not the tool [2].
763+
#
764+
# Here are the varibles that are used to determine behavior is such flows:
765+
# - CMAKE_CROSSCOMPILING : Set by cmake to indicate the build's target platform is different
766+
# from the host platform.
767+
# - IMPORT_EXECUTABLES_DIR : This is the directory containing the /ImportExecutables-type.cmake
768+
# which are then included in other CMakeLists.txt to enable finding targets that have been
769+
# prebuilt. This is set by the client in their `cmake` invocation.
770+
# - IMPORT_EXECUTABLES : Path to a file to for 1) exporting the prebuilt targets or 2)
771+
# importing a previously exported targets. (Used internally and should not be set by client).
772+
# - FILAMENT_EXPORT_PREBUILT_EXECUTABLES_DIR : A path set by the client to indicate that
773+
# they wish to export the tools as prebuilts, and the corresponding targets will be recorded
774+
# in a cmake file (i.e IMPORT_EXECUTABLES). IMPORT_EXECUTABLES will be set relative to the the
775+
# given path. This will set FILAMENT_EXPORT_PREBUILT_EXECUTABLES=ON.
776+
# - FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR : A path set by the client to indicate that they wish
777+
# to import the tools as prebuilts from a .cmake file. The location (IMPORT_EXECUTABLES) of the
778+
# file is relative to the path given. This will set FILAMENT_IMPORT_PREBUILT_EXECUTABLES=ON.
779+
# - IMPORT_PREBUILT_EXECUTABLES and EXPORT_PREBUILT_EXECUTABLES are internal booleans set to
780+
# ON based on the prescence of FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR and
781+
# FILAMENT_EXPORT_PREBUILT_EXECUTABLES_DIR.
782+
#
783+
# In conclusion, for cases
784+
# - [1] (crosscompiling), the client must set IMPORT_EXECUTABLES_DIR for both when they are building
785+
# the tools and when they are building the target-platform filament.
786+
# - [2] (all other instances), the client must set FILAMENT_EXPORT_PREBUILT_EXECUTABLES_DIR in
787+
# the prebuilt exporting step, and set FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR in the importing
788+
# step.
789+
790+
# TODO: Fold the cross compilation case into the more general FILAMENT_IMPORT/EXPORT variables.
791+
792+
if (FILAMENT_EXPORT_PREBUILT_EXECUTABLES_DIR)
793+
set(FILAMENT_EXPORT_PREBUILT_EXECUTABLES ON)
794+
set(IMPORT_EXECUTABLES_DIR ${FILAMENT_EXPORT_PREBUILT_EXECUTABLES_DIR})
795+
endif()
796+
797+
if (FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR)
798+
set(FILAMENT_IMPORT_PREBUILT_EXECUTABLES ON)
799+
set(IMPORT_EXECUTABLES_DIR ${FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR})
800+
endif()
801+
758802
if (WEBGL)
759803
set(IMPORT_EXECUTABLES ${FILAMENT}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-Release.cmake)
760804
else()
761-
set(IMPORT_EXECUTABLES ${FILAMENT}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-${CMAKE_BUILD_TYPE}.cmake)
805+
if (FILAMENT_EXPORT_PREBUILT_EXECUTABLES OR FILAMENT_IMPORT_PREBUILT_EXECUTABLES)
806+
set(IMPORT_EXECUTABLES_BUILD_TYPE Prebuilt)
807+
else()
808+
set(IMPORT_EXECUTABLES_BUILD_TYPE ${CMAKE_BUILD_TYPE})
809+
endif()
810+
set(IMPORT_EXECUTABLES ${FILAMENT}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-${IMPORT_EXECUTABLES_BUILD_TYPE}.cmake)
762811
endif()
763812

764813
# ==================================================================================================
@@ -917,6 +966,6 @@ if (IS_HOST_PLATFORM)
917966
endif()
918967

919968
# Generate exported executables for cross-compiled builds (Android, WebGL, and iOS)
920-
if (NOT CMAKE_CROSSCOMPILING)
969+
if ((NOT CMAKE_CROSSCOMPILING AND NOT FILAMENT_IMPORT_PREBUILT_EXECUTABLES) OR FILAMENT_EXPORT_PREBUILT_EXECUTABLES)
921970
export(TARGETS matc cmgen filamesh mipgen resgen uberz glslminifier FILE ${IMPORT_EXECUTABLES})
922971
endif()

NEW_RELEASE_NOTES.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
77

88
## Release notes for next branch cut
99

10-
- materials: Add a new API getParameterTransformName that will return the value of the transformName field of a sampler
11-
parameter. [⚠️ **Recompile Materials**]
10+
- Metal: Add support for the `SwapChain::CONFIG_MSAA_4_SAMPLES` flag.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repositories {
3131
}
3232
3333
dependencies {
34-
implementation 'com.google.android.filament:filament-android:1.66.1'
34+
implementation 'com.google.android.filament:filament-android:1.66.2'
3535
}
3636
```
3737

@@ -51,7 +51,7 @@ Here are all the libraries available in the group `com.google.android.filament`:
5151
iOS projects can use CocoaPods to install the latest release:
5252

5353
```shell
54-
pod 'Filament', '~> 1.66.1'
54+
pod 'Filament', '~> 1.66.2'
5555
```
5656

5757
## Documentation

RELEASE_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ A new header is inserted each time a *tag* is created.
77
Instead, if you are authoring a PR for the main branch, add your release note to
88
[NEW_RELEASE_NOTES.md](./NEW_RELEASE_NOTES.md).
99

10+
## v1.67.0
11+
12+
- materials: Add a new API getParameterTransformName that will return the value of the transformName field of a sampler
13+
parameter. [⚠️ **Recompile Materials**]
14+
1015
## v1.66.2
1116

1217

android/filament-android/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ add_library(bluevk STATIC IMPORTED)
5151
set_target_properties(bluevk PROPERTIES IMPORTED_LOCATION
5252
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libbluevk.a)
5353

54-
add_library(vkshaders STATIC IMPORTED)
55-
set_target_properties(vkshaders PROPERTIES IMPORTED_LOCATION
56-
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libvkshaders.a)
57-
5854
if (FILAMENT_SUPPORTS_WEBGPU)
5955
add_library(webgpu_dawn STATIC IMPORTED)
6056
set_target_properties(webgpu_dawn PROPERTIES IMPORTED_LOCATION
@@ -165,7 +161,6 @@ target_link_libraries(filament-jni
165161
PRIVATE $<$<STREQUAL:${FILAMENT_ENABLE_MATDBG},ON>:matdbg>
166162
PRIVATE $<$<STREQUAL:${FILAMENT_ENABLE_MATDBG},ON>:filamat>
167163
PRIVATE $<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:bluevk>
168-
PRIVATE $<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:vkshaders>
169164
PRIVATE $<$<STREQUAL:${FILAMENT_SUPPORTS_VULKAN},ON>:smol-v>
170165
PRIVATE $<$<STREQUAL:${FILAMENT_SUPPORTS_WEBGPU},ON>:webgpu_dawn>
171166
)

android/filament-android/src/main/java/com/google/android/filament/TextureSampler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ public float getAnisotropy() {
294294
/**
295295
* This controls anisotropic filtering.
296296
*
297-
* @param anisotropy Amount of anisotropy, should be a power-of-two. The default is 0.
298-
* The maximum permissible value is 7.
297+
* @param anisotropy Amount of anisotropy, should be a power-of-two. The default is 1.
298+
* The maximum permissible value is 128.
299299
*/
300300
public void setAnisotropy(float anisotropy) {
301301
mSampler = nSetAnisotropy(mSampler, anisotropy);

android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=com.google.android.filament
2-
VERSION_NAME=1.66.1
2+
VERSION_NAME=1.66.2
33

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

build.sh

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ function print_help {
7777
echo " meant for building the samples."
7878
echo " -P"
7979
echo " Enable perfetto traces on Android. Disabled by default on the Release build, enabled otherwise."
80+
echo " -y build_type"
81+
echo " Build the filament dependent tools (matc, resgen) separately from the project. This will set"
82+
echo " the tools as prebuilts that filament target will then use to build. The built_type option"
83+
echo " (debug|release) is meant to indicate the type of build of the resulting prebuilts."
8084
echo ""
8185
echo "Build types:"
8286
echo " release"
@@ -217,6 +221,11 @@ OSMESA_OPTION=""
217221
IOS_BUILD_SIMULATOR=false
218222
BUILD_UNIVERSAL_LIBRARIES=false
219223

224+
ISSUE_SPLIT_BUILD=false
225+
SPLIT_BUILD_TYPE=""
226+
PREBUILT_TOOLS_DIR=""
227+
IMPORT_EXECUTABLES_DIR_OPTION="-DIMPORT_EXECUTABLES_DIR=out"
228+
220229
BUILD_GENERATOR=Ninja
221230
BUILD_COMMAND=ninja
222231
BUILD_CUSTOM_TARGETS=
@@ -242,6 +251,37 @@ function build_clean_aggressive {
242251
git clean -qfX android
243252
}
244253

254+
function build_tools_for_split_build {
255+
local build_type_arg=$1
256+
local lc_build_type=$(echo "${build_type_arg}" | tr '[:upper:]' '[:lower:]')
257+
PREBUILT_TOOLS_DIR="out/prebuilt-tools-${lc_build_type}"
258+
259+
echo "Building tools for split build (${lc_build_type}) in ${PREBUILT_TOOLS_DIR}..."
260+
mkdir -p "${PREBUILT_TOOLS_DIR}"
261+
262+
pushd "${PREBUILT_TOOLS_DIR}" > /dev/null
263+
264+
local lc_name=$(echo "${UNAME}" | tr '[:upper:]' '[:lower:]')
265+
local architectures=""
266+
if [[ "${lc_name}" == "darwin" ]]; then
267+
if [[ "${BUILD_UNIVERSAL_LIBRARIES}" == "true" ]]; then
268+
architectures="-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"
269+
fi
270+
fi
271+
272+
cmake \
273+
-G "${BUILD_GENERATOR}" \
274+
-DFILAMENT_EXPORT_PREBUILT_EXECUTABLES_DIR=${PREBUILT_TOOLS_DIR} \
275+
-DCMAKE_BUILD_TYPE="${build_type_arg}" \
276+
${WEBGPU_OPTION} \
277+
${architectures} \
278+
../..
279+
280+
${BUILD_COMMAND} ${WEB_HOST_TOOLS}
281+
282+
popd > /dev/null
283+
}
284+
245285
function build_desktop_target {
246286
local lc_target=$(echo "$1" | tr '[:upper:]' '[:lower:]')
247287
local build_targets=$2
@@ -265,7 +305,7 @@ function build_desktop_target {
265305
if [[ ! -d "CMakeFiles" ]] || [[ "${ISSUE_CMAKE_ALWAYS}" == "true" ]]; then
266306
cmake \
267307
-G "${BUILD_GENERATOR}" \
268-
-DIMPORT_EXECUTABLES_DIR=out \
308+
${IMPORT_EXECUTABLES_DIR_OPTION} \
269309
-DCMAKE_BUILD_TYPE="$1" \
270310
-DCMAKE_INSTALL_PREFIX="../${lc_target}/filament" \
271311
${EGL_ON_LINUX_OPTION} \
@@ -331,7 +371,7 @@ function build_webgl_with_target {
331371
source "${EMSDK}/emsdk_env.sh"
332372
cmake \
333373
-G "${BUILD_GENERATOR}" \
334-
-DIMPORT_EXECUTABLES_DIR=out \
374+
${IMPORT_EXECUTABLES_DIR_OPTION} \
335375
-DCMAKE_TOOLCHAIN_FILE="${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
336376
-DCMAKE_BUILD_TYPE="$1" \
337377
-DCMAKE_INSTALL_PREFIX="../webgl-${lc_target}/filament" \
@@ -404,7 +444,7 @@ function build_android_target {
404444
if [[ ! -d "CMakeFiles" ]] || [[ "${ISSUE_CMAKE_ALWAYS}" == "true" ]]; then
405445
cmake \
406446
-G "${BUILD_GENERATOR}" \
407-
-DIMPORT_EXECUTABLES_DIR=out \
447+
${IMPORT_EXECUTABLES_DIR_OPTION} \
408448
-DCMAKE_BUILD_TYPE="$1" \
409449
-DFILAMENT_NDK_VERSION="${FILAMENT_NDK_VERSION}" \
410450
-DCMAKE_INSTALL_PREFIX="../android-${lc_target}/filament" \
@@ -638,7 +678,7 @@ function build_ios_target {
638678
if [[ ! -d "CMakeFiles" ]] || [[ "${ISSUE_CMAKE_ALWAYS}" == "true" ]]; then
639679
cmake \
640680
-G "${BUILD_GENERATOR}" \
641-
-DIMPORT_EXECUTABLES_DIR=out \
681+
${IMPORT_EXECUTABLES_DIR_OPTION} \
642682
-DCMAKE_BUILD_TYPE="$1" \
643683
-DCMAKE_INSTALL_PREFIX="../ios-${lc_target}/filament" \
644684
-DIOS_ARCH="${arch}" \
@@ -810,7 +850,7 @@ function check_debug_release_build {
810850

811851
pushd "$(dirname "$0")" > /dev/null
812852

813-
while getopts ":hacCfgimp:q:uvWslwedtk:bVx:S:X:P" opt; do
853+
while getopts ":hacCfgimp:q:uvWslwedtk:bVx:S:X:Py:" opt; do
814854
case ${opt} in
815855
h)
816856
print_help
@@ -979,6 +1019,20 @@ while getopts ":hacCfgimp:q:uvWslwedtk:bVx:S:X:P" opt; do
9791019
;;
9801020
X) OSMESA_OPTION="-DFILAMENT_OSMESA_PATH=${OPTARG}"
9811021
;;
1022+
y)
1023+
ISSUE_SPLIT_BUILD=true
1024+
SPLIT_BUILD_TYPE=${OPTARG}
1025+
case $(echo "${SPLIT_BUILD_TYPE}" | tr '[:upper:]' '[:lower:]') in
1026+
debug|release)
1027+
;;
1028+
*)
1029+
echo "Unknown build type for -y: ${SPLIT_BUILD_TYPE}"
1030+
echo "Build type must be one of [debug|release]"
1031+
echo ""
1032+
exit 1
1033+
;;
1034+
esac
1035+
;;
9821036
\?)
9831037
echo "Invalid option: -${OPTARG}" >&2
9841038
echo ""
@@ -1013,6 +1067,13 @@ done
10131067

10141068
validate_build_command
10151069

1070+
if [[ "${ISSUE_SPLIT_BUILD}" == "true" ]]; then
1071+
# Capitalize first letter of SPLIT_BUILD_TYPE
1072+
SPLIT_BUILD_TYPE_CAPITALIZED="$(echo ${SPLIT_BUILD_TYPE:0:1} | tr '[:lower:]' '[:upper:]')${SPLIT_BUILD_TYPE:1}"
1073+
build_tools_for_split_build "${SPLIT_BUILD_TYPE_CAPITALIZED}"
1074+
IMPORT_EXECUTABLES_DIR_OPTION="-DFILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR=${PREBUILT_TOOLS_DIR}"
1075+
fi
1076+
10161077
if [[ "${ISSUE_CLEAN}" == "true" ]]; then
10171078
build_clean
10181079
fi

docs/build/maven_release.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ <h2 id="register-for-a-sonatype-account"><a class="header" href="#register-for-a
165165
<p>To publish under the <code>com.google.android</code> namespace, you'll also need to email
166166
<code>central-support@sonatype.com</code> with your account information to request access.</p>
167167
<p>Then, generate a user token through the Sonatype website. Navigate to
168-
<a href="https://central.sonatype.com/account">https://central.sonatype.com/account</a> and select <strong>Generate
169-
User Token</strong>.</p>
168+
<a href="https://central.sonatype.com/usertoken">https://central.sonatype.com/usertoken</a>
169+
and select <strong>Generate User Token</strong>.</p>
170170
<p>Finally, add the generated token credentials to <code>~/.gradle/gradle.properties</code>. (Note: these are
171171
different from the credentials used to log into your Sonatype account):</p>
172172
<pre><code class="language-gradle"># Generated Sonatype token

0 commit comments

Comments
 (0)