react-native-webgpu 0.21.2 → 0.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,6 +3,7 @@ package com.webgpu;
|
|
|
3
3
|
import android.annotation.SuppressLint;
|
|
4
4
|
import android.content.Context;
|
|
5
5
|
import android.graphics.SurfaceTexture;
|
|
6
|
+
import android.os.Build;
|
|
6
7
|
import android.view.Surface;
|
|
7
8
|
import android.view.TextureView;
|
|
8
9
|
import androidx.annotation.NonNull;
|
|
@@ -20,6 +21,17 @@ public class WebGPUTextureView extends TextureView implements TextureView.Surfac
|
|
|
20
21
|
setSurfaceTextureListener(this);
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
// Android 10 draws an opaque TextureView with SkBlendMode::kSrc, and under
|
|
25
|
+
// a rotated, rounded clip its Skia (m75) can clear the stencil the clip was
|
|
26
|
+
// written in before that draw, which leaves the canvas blank (fixed in
|
|
27
|
+
// Skia m77, https://skia-review.googlesource.com/c/skia/+/223970). The
|
|
28
|
+
// view blends on that release, whatever the GL: a canvas that covers its
|
|
29
|
+
// bounds draws the same pixels.
|
|
30
|
+
@Override
|
|
31
|
+
public void setOpaque(boolean opaque) {
|
|
32
|
+
super.setOpaque(opaque && Build.VERSION.SDK_INT != Build.VERSION_CODES.Q);
|
|
33
|
+
}
|
|
34
|
+
|
|
23
35
|
@Override
|
|
24
36
|
public void onSurfaceTextureAvailable(@NonNull SurfaceTexture surfaceTexture, int width, int height) {
|
|
25
37
|
mSurface = new Surface(surfaceTexture);
|
|
@@ -217,16 +217,28 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
|
|
|
217
217
|
// (https://issues.chromium.org/issues/42241591)
|
|
218
218
|
#if defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR
|
|
219
219
|
// The iOS Simulator only advertises MTLFeatureSet_iOS_GPUFamily2, so
|
|
220
|
-
// Dawn
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
//
|
|
220
|
+
// Dawn turns on toggles that reject core WebGPU features. The
|
|
221
|
+
// simulator forwards Metal calls to the host GPU, which supports
|
|
222
|
+
// them, so force these toggles off unless the caller enables them
|
|
223
|
+
// through dawnToggles. Device builds are unaffected: WebGPU-capable
|
|
224
|
+
// iPhones and iPads are all GPUFamily3+. These are device-stage
|
|
225
|
+
// toggles, so they must be chained here rather than on the instance
|
|
226
|
+
// descriptor (instance-stage toggle parsing silently drops them).
|
|
227
|
+
//
|
|
228
|
+
// - disable_base_instance, disable_base_vertex: Dawn rejects every
|
|
229
|
+
// draw with a non-zero firstInstance or baseVertex.
|
|
230
|
+
// TODO: newer Dawn no longer needs these two
|
|
231
|
+
// (https://issues.chromium.org/issues/42241591).
|
|
232
|
+
// - metal_disable_sampler_compare: Dawn rejects any sampler with a
|
|
233
|
+
// compare function, and the error loses the device. Upstream has
|
|
234
|
+
// no fix for this one, so keep it when updating Dawn. Apple does
|
|
235
|
+
// not document compare functions on the Simulator: this relies on
|
|
236
|
+
// the host GPU and was checked on an iPhone 11 Simulator (iOS 17,
|
|
237
|
+
// Xcode 26.6). If shadows look wrong on the Simulator only, look
|
|
238
|
+
// here first.
|
|
228
239
|
static const char *const kSimulatorDisabledToggles[] = {
|
|
229
|
-
"disable_base_instance", "disable_base_vertex"
|
|
240
|
+
"disable_base_instance", "disable_base_vertex",
|
|
241
|
+
"metal_disable_sampler_compare"};
|
|
230
242
|
for (const char *name : kSimulatorDisabledToggles) {
|
|
231
243
|
const bool explicitlyEnabled = std::any_of(
|
|
232
244
|
enabledToggles.begin(), enabledToggles.end(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-webgpu",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.4",
|
|
4
4
|
"description": "React Native WebGPU",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"app.plugin.js",
|
|
25
25
|
"plugin/build/**"
|
|
26
26
|
],
|
|
27
|
-
"dawn": "chrome-
|
|
27
|
+
"dawn": "chrome-m158",
|
|
28
28
|
"androidMinSdkVersion": 26,
|
|
29
29
|
"scripts": {
|
|
30
30
|
"test": "NODE_OPTIONS='--experimental-require-module' jest -i",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"ws": "^8.18.0"
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
|
-
"react-native-webgpu-dawn": "
|
|
112
|
+
"react-native-webgpu-dawn": "158.0.0"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
115
|
"react": "*",
|