Skip to content

Commit 1a9fb54

Browse files
committed
Merge branch 'rc/1.68.0' into release
2 parents b89a05a + 3e0bb70 commit 1a9fb54

File tree

292 files changed

+35955
-12256
lines changed

Some content is hidden

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

292 files changed

+35955
-12256
lines changed

.github/workflows/presubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ jobs:
179179
fetch-depth: 0
180180
- uses: ./.github/actions/linux-prereq
181181
- name: Run build script
182-
run: ./build.sh -W debug test_filamat filament
182+
run: ./build.sh -W debug test_filamat filament gltf_viewer
183183
- name: Run test
184184
run: ./out/cmake-debug/libs/filamat/test_filamat --gtest_filter=MaterialCompiler.Wgsl*
185185

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.67.1'
34+
implementation 'com.google.android.filament:filament-android:1.68.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.67.1'
54+
pod 'Filament', '~> 1.68.0'
5555
```
5656

5757
## Documentation

RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ 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.68.0
11+
12+
- engine: add `View::getLastDynamicResolutionScale()` (b/457753622)
13+
- Metal: report GPU errors to the platform via `debugUpdateStat` (b/431665753).
14+
- materials: Make Material Instances' UBO descriptor use dynamic offsets. [⚠️ **Recompile Materials**]
15+
1016
## v1.67.1
1117

1218
- Metal: Add support for the `SwapChain::CONFIG_MSAA_4_SAMPLES` flag.

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ Java_com_google_android_filament_View_nSetDynamicResolutionOptions(JNIEnv*, jcla
147147
view->setDynamicResolutionOptions(options);
148148
}
149149

150+
extern "C" JNIEXPORT void JNICALL
151+
Java_com_google_android_filament_View_nGetLastDynamicResolutionScale(JNIEnv *env, jclass, jlong nativeView, jfloatArray out_) {
152+
jfloat* out = env->GetFloatArrayElements(out_, nullptr);
153+
View *view = (View *) nativeView;
154+
math::float2 result = view->getLastDynamicResolutionScale();
155+
std::copy_n(result.v, 2, out);
156+
env->ReleaseFloatArrayElements(out_, out, 0);
157+
}
158+
150159
extern "C" JNIEXPORT void JNICALL
151160
Java_com_google_android_filament_View_nSetShadowType(JNIEnv*, jclass, jlong nativeView, jint type) {
152161
View* view = (View*) nativeView;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ static void assertFloat3In(@NonNull float[] out) {
9999
}
100100
}
101101

102+
@NonNull @Size(min = 2)
103+
static float[] assertFloat2(@Nullable float[] out) {
104+
if (out == null) out = new float[2];
105+
else if (out.length < 2) {
106+
throw new ArrayIndexOutOfBoundsException("Array length must be at least 2");
107+
}
108+
return out;
109+
}
110+
102111
@NonNull @Size(min = 4)
103112
static float[] assertFloat4(@Nullable float[] out) {
104113
if (out == null) out = new float[4];

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import static com.google.android.filament.Asserts.assertFloat3In;
2727
import static com.google.android.filament.Asserts.assertFloat4In;
28-
import static com.google.android.filament.Colors.LinearColor;
2928

3029
import com.google.android.filament.proguard.UsedByNative;
3130

@@ -674,6 +673,21 @@ public DynamicResolutionOptions getDynamicResolutionOptions() {
674673
return mDynamicResolution;
675674
}
676675

676+
/**
677+
* Returns the last dynamic resolution scale factor used by this view. This value is updated
678+
* when Renderer::render(View*) is called
679+
* @param out A 2-float array where the value will be stored, or null in which case the array is
680+
* allocated.
681+
* @return A 2-float array containing the horizontal and the vertical scale factors
682+
* @see Renderer#render(View)
683+
*/
684+
@NonNull @Size(min = 2)
685+
public float[] getLastDynamicResolutionScale(@Nullable @Size(min = 2) float[] out) {
686+
out = Asserts.assertFloat2(out);
687+
nGetLastDynamicResolutionScale(getNativeObject(), out);
688+
return out;
689+
}
690+
677691
/**
678692
* Sets the rendering quality for this view (e.g. color precision).
679693
*
@@ -1317,6 +1331,7 @@ void clearNativeObject() {
13171331
private static native void nSetDithering(long nativeView, int dithering);
13181332
private static native int nGetDithering(long nativeView);
13191333
private static native void nSetDynamicResolutionOptions(long nativeView, boolean enabled, boolean homogeneousScaling, float minScale, float maxScale, float sharpness, int quality);
1334+
private static native void nGetLastDynamicResolutionScale(long nativeView, float[] out);
13201335
private static native void nSetRenderQuality(long nativeView, int hdrColorBufferQuality);
13211336
private static native void nSetDynamicLightingOptions(long nativeView, float zLightNear, float zLightFar);
13221337
private static native void nSetShadowType(long nativeView, int type);

android/filament-utils-android/src/main/java/com/google/android/filament/utils/TextureLoader.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,21 @@ fun loadTexture(engine: Engine, resources: Resources, resourceId: Int, type: Tex
4040
options.inPremultiplied = type == TextureType.COLOR
4141

4242
val bitmap = BitmapFactory.decodeResource(resources, resourceId, options)
43+
return buildTexture(engine, bitmap, type)
44+
}
45+
46+
fun loadTexture(engine: Engine, bytes: ByteArray, type: TextureType, offset: Int = 0, length: Int = bytes.size): Texture {
47+
val options = BitmapFactory.Options()
48+
// Color is the only type of texture we want to pre-multiply with the alpha channel
49+
// Pre-multiplication is the default behavior, so we need to turn it off here
50+
options.inPremultiplied = type == TextureType.COLOR
51+
52+
val bitmap = BitmapFactory.decodeByteArray(bytes, offset, length, options)
53+
return buildTexture(engine, bitmap, type)
54+
}
55+
4356

57+
private fun buildTexture(engine: Engine, bitmap: Bitmap, type: TextureType): Texture {
4458
val texture = Texture.Builder()
4559
.width(bitmap.width)
4660
.height(bitmap.height)

android/filament-utils-android/src/main/java/com/google/android/filament/utils/Utils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ object Utils {
2222
/**
2323
* Initializes the utils JNI layer. Must be called before using any utils functionality.
2424
*/
25+
@JvmStatic
2526
fun init() {
2627
// Load Filament first to ensure that the NioUtils Java class is available in the JNIEnv.
2728
Filament.init()

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.67.1
2+
VERSION_NAME=1.68.0
33

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

android/samples/sample-gltf-viewer/build.gradle

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,20 @@ filamentTools {
1717
}
1818

1919
// don't forget to update MainACtivity.kt when/if changing this.
20-
tasks.register('copyMesh', Copy) {
20+
tasks.register('copyDamagedHelmetGltf', Copy) {
21+
from file("../../../third_party/models/DamagedHelmet/DamagedHelmet.glb")
22+
into file("src/main/assets/models")
23+
rename {String fileName -> "helmet.glb"}
24+
}
25+
26+
// don't forget to update MainACtivity.kt when/if changing this.
27+
tasks.register('copyBusterGltf', Copy) {
2128
from "../../../third_party/models/BusterDrone"
2229
into "src/main/assets/models"
2330
}
2431

25-
preBuild.dependsOn copyMesh
32+
preBuild.dependsOn copyDamagedHelmetGltf
33+
preBuild.dependsOn copyBusterGltf
2634

2735
clean.doFirst {
2836
delete "src/main/assets"

0 commit comments

Comments
 (0)