Skip to content

Commit 7f717f8

Browse files
committed
Merge branch 'rc/1.67.0' into release
2 parents 56c8d3e + 85d0543 commit 7f717f8

File tree

125 files changed

+3009
-1242
lines changed

Some content is hidden

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

125 files changed

+3009
-1242
lines changed

.github/workflows/presubmit.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,23 @@ jobs:
203203
./build.sh -p desktop debug gltf_viewer
204204
- name: Run test
205205
run: bash test/code-correctness/test.sh
206+
207+
test-backend:
208+
name: test-backend
209+
runs-on: macos-14-xlarge
210+
steps:
211+
- uses: actions/[email protected]
212+
with:
213+
fetch-depth: 0
214+
- uses: ./.github/actions/mac-prereq
215+
- uses: ./.github/actions/get-mesa
216+
- uses: ./.github/actions/get-vulkan-sdk
217+
- name: Prerequisites
218+
run: |
219+
# Must have at least clang-16 for a webgpu/dawn build.
220+
sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
221+
shell: bash
222+
- name: Run backend tests
223+
shell: bash
224+
run: |
225+
bash test/backend/test.sh

CMakeLists.txt

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ option(FILAMENT_ENABLE_FGVIEWER "Enable the frame graph viewer" OFF)
5656

5757
option(FILAMENT_USE_ABSEIL_LOGGING "Use Abseil to log, may increase binary size" OFF)
5858

59+
option(FILAMENT_ENABLE_EXPERIMENTAL_GCC_SUPPORT "Enable GCC support (unsupported)" OFF)
60+
5961
# This is to disable GTAO for the short-term while we investigate a way to better manage size increases.
6062
# On the regular filament build (where size is of less concern), we enable GTAO by default.
6163
option(FILAMENT_DISABLE_GTAO "Disable GTAO" OFF)
@@ -295,15 +297,10 @@ set(TOOLS ${CMAKE_CURRENT_SOURCE_DIR}/tools)
295297
# ==================================================================================================
296298
set(MIN_CLANG_VERSION "6.0")
297299

298-
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
299-
if (CMAKE_C_COMPILER_VERSION VERSION_LESS MIN_CLANG_VERSION)
300-
message(FATAL_ERROR "Detected C compiler Clang ${CMAKE_C_COMPILER_VERSION} < ${MIN_CLANG_VERSION}")
301-
endif()
302-
elseif (NOT MSVC)
303-
message(FATAL_ERROR "Detected C compiler ${CMAKE_C_COMPILER_ID} is unsupported")
304-
endif()
305-
306-
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
300+
set(FILAMENT_USING_GCC OFF)
301+
if (CMAKE_C_COMPILER_ID MATCHES "GNU" AND FILAMENT_ENABLE_EXPERIMENTAL_GCC_SUPPORT)
302+
set(FILAMENT_USING_GCC ON)
303+
elseif (CMAKE_C_COMPILER_ID MATCHES "Clang")
307304
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MIN_CLANG_VERSION)
308305
message(FATAL_ERROR "Detected CXX compiler Clang ${CMAKE_CXX_COMPILER_VERSION} < ${MIN_CLANG_VERSION}")
309306
endif()
@@ -344,7 +341,11 @@ if (MSVC)
344341
set(CXX_STANDARD "/std:c++latest")
345342
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} /W0 /Zc:__cplusplus")
346343
else()
347-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations")
344+
if(FILAMENT_USING_GCC)
345+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -Wno-changes-meaning -Wno-return-type -Wno-attributes -Wno-unknown-pragmas -Wno-class-memaccess -Wno-multichar -Wno-deprecated-declarations -Wno-subobject-linkage -Wno-invalid-constexpr")
346+
else()
347+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations")
348+
endif()
348349
if (APPLE)
349350
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nullability-extension")
350351
endif()
@@ -365,10 +366,14 @@ endif()
365366
if (LINUX)
366367
option(USE_STATIC_LIBCXX "Link against the static runtime libraries." ON)
367368
if (${USE_STATIC_LIBCXX})
368-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
369-
link_libraries("-static-libgcc -static-libstdc++")
370-
link_libraries(libc++.a)
371-
link_libraries(libc++abi.a)
369+
if (FILAMENT_USING_GCC)
370+
link_libraries("-static-libgcc -static-libstdc++")
371+
else ()
372+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
373+
link_libraries("-static-libgcc -static-libstdc++")
374+
link_libraries(libc++.a)
375+
link_libraries(libc++abi.a)
376+
endif()
372377
endif()
373378

374379
# Only linux, clang doesn't want to use a shared library that is not PIC.
@@ -393,8 +398,8 @@ if (MSVC)
393398
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE")
394399
endif()
395400

396-
# Add colors to ninja builds
397-
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)
398403
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
399404
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
400405
endif()

NEW_RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
77

88
## Release notes for next branch cut
9+
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.2'
34+
implementation 'com.google.android.filament:filament-android:1.67.0'
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.2'
54+
pod 'Filament', '~> 1.67.0'
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/src/main/cpp/Engine.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ extern "C" JNIEXPORT void JNICALL Java_com_google_android_filament_Engine_nSetBu
557557
jboolean disableHandleUseAfterFreeCheck,
558558
jint preferredShaderLanguage,
559559
jboolean forceGLES2Context, jboolean assertNativeWindowIsValid,
560-
jint gpuContextPriority) {
560+
jint gpuContextPriority,
561+
jlong sharedUboInitialSizeInBytes) {
561562
Engine::Builder* builder = (Engine::Builder*) nativeBuilder;
562563
Engine::Config config = {
563564
.commandBufferSizeMB = (uint32_t) commandBufferSizeMB,
@@ -576,6 +577,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_google_android_filament_Engine_nSetBu
576577
.forceGLES2Context = (bool) forceGLES2Context,
577578
.assertNativeWindowIsValid = (bool) assertNativeWindowIsValid,
578579
.gpuContextPriority = (Engine::GpuContextPriority) gpuContextPriority,
580+
.sharedUboInitialSizeInBytes = (uint32_t) sharedUboInitialSizeInBytes,
579581
};
580582
builder->config(&config);
581583
}

android/filament-android/src/main/cpp/Material.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,17 @@ Java_com_google_android_filament_Material_nHasParameter(JNIEnv* env, jclass,
279279
return (jboolean) hasParameter;
280280
}
281281

282+
extern "C" JNIEXPORT jstring JNICALL
283+
Java_com_google_android_filament_Material_nGetParameterTransformName(JNIEnv* env, jclass,
284+
jlong nativeMaterial, jstring samplerName_) {
285+
Material* material = (Material*) nativeMaterial;
286+
const char* samplerName = env->GetStringUTFChars(samplerName_, 0);
287+
const char* transformName = material->getParameterTransformName(samplerName);
288+
jstring transformName_ = env->NewStringUTF(transformName ? transformName : "");
289+
env->ReleaseStringUTFChars(samplerName_, samplerName);
290+
return transformName_;
291+
}
292+
282293
extern "C"
283294
JNIEXPORT void JNICALL
284295
Java_com_google_android_filament_Material_nCompile(JNIEnv *env, jclass clazz,

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ public Builder config(Config config) {
264264
config.disableHandleUseAfterFreeCheck,
265265
config.preferredShaderLanguage.ordinal(),
266266
config.forceGLES2Context, config.assertNativeWindowIsValid,
267-
config.gpuContextPriority.ordinal());
267+
config.gpuContextPriority.ordinal(),
268+
config.sharedUboInitialSizeInBytes);
268269
return this;
269270
}
270271

@@ -525,6 +526,16 @@ public enum ShaderLanguage {
525526
* GPU context priority level. Controls GPU work scheduling and preemption.
526527
*/
527528
public GpuContextPriority gpuContextPriority = GpuContextPriority.DEFAULT;
529+
530+
/**
531+
* The initial size in bytes of the shared uniform buffer used for material instance batching.
532+
*
533+
* If the buffer runs out of space during a frame, it will be automatically reallocated
534+
* with a larger capacity. Setting an appropriate initial size can help avoid runtime
535+
* reallocations, which can cause a minor performance stutter, at the cost of higher
536+
* initial memory usage.
537+
*/
538+
public long sharedUboInitialSizeInBytes = 256 * 64;
528539
}
529540

530541
private Engine(long nativeEngine, Config config) {
@@ -1529,7 +1540,8 @@ private static native void nSetBuilderConfig(long nativeBuilder, long commandBuf
15291540
boolean disableHandleUseAfterFreeCheck,
15301541
int preferredShaderLanguage,
15311542
boolean forceGLES2Context, boolean assertNativeWindowIsValid,
1532-
int gpuContextPriority);
1543+
int gpuContextPriority,
1544+
long sharedUboInitialSizeInBytes);
15331545
private static native void nSetBuilderFeatureLevel(long nativeBuilder, int ordinal);
15341546
private static native void nSetBuilderSharedContext(long nativeBuilder, long sharedContext);
15351547
private static native void nSetBuilderPaused(long nativeBuilder, boolean paused);

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,21 @@ public boolean hasParameter(@NonNull String name) {
787787
return nHasParameter(getNativeObject(), name);
788788
}
789789

790+
/**
791+
*
792+
* Returns the name of the transform parameter associated with the given sampler parameter.
793+
* In the case the parameter doesn't have a transform name field, it will return an empty string.
794+
*
795+
* @param samplerName the name of the sampler parameter to query.
796+
*
797+
* @see
798+
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/general:parameters">
799+
* General: parameters</a>
800+
*/
801+
public String getParameterTransformName(@NonNull String samplerName) {
802+
return nGetParameterTransformName(getNativeObject(), samplerName);
803+
}
804+
790805
/**
791806
* Sets the value of a bool parameter on this material's default instance.
792807
*
@@ -1111,4 +1126,5 @@ private static native void nGetParameters(long nativeMaterial,
11111126
private static native int nGetRequiredAttributes(long nativeMaterial);
11121127

11131128
private static native boolean nHasParameter(long nativeMaterial, @NonNull String name);
1129+
private static native String nGetParameterTransformName(long nativeMaterial, @NonNull String samplerName);
11141130
}

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);

0 commit comments

Comments
 (0)