@shopify/react-native-skia 2.9.1-next.1 → 2.10.0
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.
- package/android/CMakeLists.txt +1 -5
- package/android/cpp/jni/JniWebGPUView.cpp +52 -7
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUSurfaceView.java +3 -1
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUTextureView.java +11 -5
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUView.java +10 -7
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewAPI.java +7 -2
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewManager.java +1 -1
- package/apple/WebGPUMetalView.mm +49 -6
- package/cpp/api/JsiNativeBuffer.h +15 -10
- package/cpp/api/JsiSkAnimatedImage.h +21 -19
- package/cpp/api/JsiSkAnimatedImageFactory.h +13 -14
- package/cpp/api/JsiSkApi.h +246 -92
- package/cpp/api/JsiSkCanvas.h +76 -58
- package/cpp/api/JsiSkColor.h +7 -5
- package/cpp/api/JsiSkColorFilter.h +15 -8
- package/cpp/api/JsiSkColorFilterFactory.h +45 -45
- package/cpp/api/JsiSkContourMeasure.h +24 -21
- package/cpp/api/JsiSkContourMeasureIter.h +18 -21
- package/cpp/api/JsiSkData.h +13 -7
- package/cpp/api/JsiSkDataFactory.h +22 -21
- package/cpp/api/JsiSkFont.h +56 -44
- package/cpp/api/JsiSkFontMgr.h +22 -13
- package/cpp/api/JsiSkFontMgrFactory.h +12 -10
- package/cpp/api/JsiSkFontStyle.h +14 -12
- package/cpp/api/JsiSkImage.h +45 -34
- package/cpp/api/JsiSkImageFactory.h +47 -52
- package/cpp/api/JsiSkImageFilter.h +21 -11
- package/cpp/api/JsiSkImageFilterFactory.h +96 -96
- package/cpp/api/JsiSkImageInfo.h +22 -19
- package/cpp/api/JsiSkMaskFilter.h +21 -11
- package/cpp/api/JsiSkMaskFilterFactory.h +16 -13
- package/cpp/api/JsiSkMatrix.h +31 -31
- package/cpp/api/JsiSkNativeObjects.h +419 -0
- package/cpp/api/JsiSkPaint.h +59 -39
- package/cpp/api/JsiSkParagraph.h +39 -32
- package/cpp/api/JsiSkParagraphBuilder.h +24 -21
- package/cpp/api/JsiSkParagraphBuilderFactory.h +13 -12
- package/cpp/api/JsiSkParagraphStyle.h +20 -10
- package/cpp/api/JsiSkPath.h +95 -70
- package/cpp/api/JsiSkPathBuilder.h +83 -67
- package/cpp/api/JsiSkPathBuilderFactory.h +16 -17
- package/cpp/api/JsiSkPathEffect.h +21 -11
- package/cpp/api/JsiSkPathEffectFactory.h +33 -32
- package/cpp/api/JsiSkPathFactory.h +79 -103
- package/cpp/api/JsiSkPicture.h +24 -13
- package/cpp/api/JsiSkPictureFactory.h +21 -26
- package/cpp/api/JsiSkPictureRecorder.h +21 -22
- package/cpp/api/JsiSkPoint.h +19 -22
- package/cpp/api/JsiSkRRect.h +22 -29
- package/cpp/api/JsiSkRSXform.h +26 -30
- package/cpp/api/JsiSkRect.h +28 -30
- package/cpp/api/JsiSkRuntimeEffect.h +39 -30
- package/cpp/api/JsiSkRuntimeEffectFactory.h +12 -12
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +25 -18
- package/cpp/api/JsiSkSVG.h +13 -13
- package/cpp/api/JsiSkSVGFactory.h +17 -20
- package/cpp/api/JsiSkShader.h +15 -8
- package/cpp/api/JsiSkShaderFactory.h +41 -48
- package/cpp/api/JsiSkSkottie.h +49 -39
- package/cpp/api/JsiSkStrutStyle.h +18 -8
- package/cpp/api/JsiSkSurface.h +24 -24
- package/cpp/api/JsiSkSurfaceFactory.h +15 -16
- package/cpp/api/JsiSkTextBlob.h +15 -8
- package/cpp/api/JsiSkTextBlobFactory.h +25 -28
- package/cpp/api/JsiSkTextStyle.h +34 -24
- package/cpp/api/JsiSkTypeface.h +19 -12
- package/cpp/api/JsiSkTypefaceFactory.h +12 -12
- package/cpp/api/JsiSkTypefaceFontProvider.h +30 -25
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +14 -12
- package/cpp/api/JsiSkVertices.h +21 -18
- package/cpp/api/JsiSkiaContext.h +17 -17
- package/cpp/api/JsiSkottieFactory.h +16 -17
- package/cpp/api/JsiVideo.h +27 -25
- package/cpp/api/recorder/Convertor.h +31 -61
- package/cpp/api/recorder/DataTypes.h +8 -16
- package/cpp/api/recorder/JsiRecorder.h +83 -55
- package/cpp/api/recorder/RNRecorder.h +1 -1
- package/cpp/jsi/BoxedNativeObject.h +146 -0
- package/cpp/{jsi2 → jsi}/EnumMapper.h +4 -1
- package/cpp/{jsi2 → jsi}/NativeObject.h +120 -146
- package/cpp/jsi/RuntimeAwareCache.cpp +1 -1
- package/cpp/jsi/RuntimeAwareCache.h +26 -8
- package/cpp/jsi/ViewProperty.h +5 -11
- package/cpp/rnskia/RNSkJsiViewApi.h +20 -11
- package/cpp/rnskia/RNSkManager.cpp +29 -25
- package/cpp/rnskia/RNSkPictureView.h +1 -1
- package/cpp/rnwgpu/ArrayBuffer.h +5 -6
- package/cpp/rnwgpu/Canvas.h +4 -2
- package/cpp/rnwgpu/SurfaceRegistry.h +469 -131
- package/cpp/rnwgpu/api/GPU.cpp +4 -4
- package/cpp/rnwgpu/api/GPU.h +1 -1
- package/cpp/rnwgpu/api/GPUAdapter.cpp +12 -6
- package/cpp/rnwgpu/api/GPUAdapter.h +5 -4
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUBindGroup.h +1 -1
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +1 -1
- package/cpp/rnwgpu/api/GPUBuffer.cpp +12 -2
- package/cpp/rnwgpu/api/GPUBuffer.h +4 -3
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +33 -19
- package/cpp/rnwgpu/api/GPUCanvasContext.h +4 -2
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +1 -1
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +1 -1
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPUComputePipeline.h +1 -1
- package/cpp/rnwgpu/api/GPUDevice.cpp +38 -24
- package/cpp/rnwgpu/api/GPUDevice.h +12 -10
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUError.h +1 -1
- package/cpp/rnwgpu/api/GPUExtent3D.h +1 -1
- package/cpp/rnwgpu/api/GPUExternalTexture.h +1 -1
- package/cpp/rnwgpu/api/GPUInternalError.h +1 -1
- package/cpp/rnwgpu/api/GPUOrigin2D.h +1 -1
- package/cpp/rnwgpu/api/GPUOrigin3D.h +1 -1
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +1 -1
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +1 -1
- package/cpp/rnwgpu/api/GPUQuerySet.h +1 -1
- package/cpp/rnwgpu/api/GPUQueue.cpp +6 -2
- package/cpp/rnwgpu/api/GPUQueue.h +4 -4
- package/cpp/rnwgpu/api/GPURenderBundle.h +1 -1
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPURenderPipeline.h +1 -1
- package/cpp/rnwgpu/api/GPUSampler.h +1 -1
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +8 -3
- package/cpp/rnwgpu/api/GPUShaderModule.h +4 -4
- package/cpp/rnwgpu/api/GPUSharedFence.h +1 -1
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +1 -1
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +1 -1
- package/cpp/rnwgpu/api/GPUTexture.h +1 -1
- package/cpp/rnwgpu/api/GPUTextureView.h +1 -1
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +1 -1
- package/cpp/rnwgpu/api/GPUValidationError.h +1 -1
- package/cpp/rnwgpu/api/ImageBitmap.h +1 -1
- package/cpp/rnwgpu/api/RNWebGPU.h +21 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/Unions.h +1 -1
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +20 -21
- package/cpp/rnwgpu/async/RuntimeContext.cpp +5 -0
- package/cpp/rnwgpu/async/RuntimeContext.h +15 -2
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js +30 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/skia/NativeSetup.js +4 -0
- package/lib/commonjs/skia/NativeSetup.js.map +1 -1
- package/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js +66 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/commonjs/sksg/Container.native.js +20 -1
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/views/WebGPUCanvas.d.ts +1 -0
- package/lib/commonjs/views/WebGPUCanvas.js +13 -0
- package/lib/commonjs/views/WebGPUCanvas.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/module/external/reanimated/renderHelpers.js +29 -0
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/skia/NativeSetup.js +4 -0
- package/lib/module/skia/NativeSetup.js.map +1 -1
- package/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/module/skia/SkiaWorkletSerialization.js +59 -0
- package/lib/module/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/module/sksg/Container.native.js +21 -2
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/views/WebGPUCanvas.d.ts +1 -0
- package/lib/module/views/WebGPUCanvas.js +14 -1
- package/lib/module/views/WebGPUCanvas.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +2 -0
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/src/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/src/views/WebGPUCanvas.d.ts +1 -0
- package/package.json +12 -8
- package/react-native-skia.podspec +1 -2
- package/src/external/reanimated/renderHelpers.ts +30 -0
- package/src/skia/NativeSetup.ts +5 -0
- package/src/skia/SkiaWorkletSerialization.ts +67 -0
- package/src/sksg/Container.native.ts +40 -2
- package/src/views/WebGPUCanvas.tsx +17 -1
- package/cpp/api/JsiSkHostObjects.h +0 -257
- package/cpp/dawn/include/dawn/dawn_proc.h +0 -53
- package/cpp/dawn/include/dawn/dawn_proc_table.h +0 -330
- package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +0 -47
- package/cpp/dawn/include/dawn/dawn_version.h +0 -41
- package/cpp/dawn/include/dawn/native/D3D11Backend.h +0 -65
- package/cpp/dawn/include/dawn/native/D3D12Backend.h +0 -86
- package/cpp/dawn/include/dawn/native/D3DBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/DawnNative.h +0 -369
- package/cpp/dawn/include/dawn/native/MetalBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/NullBackend.h +0 -39
- package/cpp/dawn/include/dawn/native/OpenGLBackend.h +0 -89
- package/cpp/dawn/include/dawn/native/VulkanBackend.h +0 -183
- package/cpp/dawn/include/dawn/native/WebGPUBackend.h +0 -49
- package/cpp/dawn/include/dawn/native/dawn_native_export.h +0 -49
- package/cpp/dawn/include/dawn/platform/DawnPlatform.h +0 -210
- package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +0 -49
- package/cpp/dawn/include/dawn/replay/Replay.h +0 -99
- package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +0 -49
- package/cpp/dawn/include/dawn/webgpu_cpp_print.h +0 -2844
- package/cpp/dawn/include/tint/tint.h +0 -90
- package/cpp/dawn/include/webgpu/webgpu.h +0 -4987
- package/cpp/dawn/include/webgpu/webgpu_cpp.h +0 -10080
- package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +0 -57
- package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +0 -161
- package/cpp/dawn/include/webgpu/webgpu_glfw.h +0 -88
- package/cpp/jsi/JsiHostObject.cpp +0 -137
- package/cpp/jsi/JsiHostObject.h +0 -385
- package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +0 -45
- package/cpp/skia/src/gpu/graphite/ResourceTypes.h +0 -360
- package/cpp/skia/src/gpu/graphite/TextureProxyView.h +0 -105
- package/libs/.graphite +0 -1
- /package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
package/cpp/rnwgpu/api/GPU.cpp
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#include <vector>
|
|
9
9
|
|
|
10
10
|
#include "Convertors.h"
|
|
11
|
-
#include "
|
|
11
|
+
#include "jsi/JSIConverter.h"
|
|
12
12
|
#include "rnwgpu/async/RuntimeContext.h"
|
|
13
13
|
|
|
14
14
|
namespace rnwgpu {
|
|
@@ -40,9 +40,9 @@ async::AsyncTaskHandle GPU::requestAdapter(
|
|
|
40
40
|
const async::AsyncTaskHandle::RejectFunction &reject) {
|
|
41
41
|
_instance.RequestAdapter(
|
|
42
42
|
&aOptions, wgpu::CallbackMode::AllowProcessEvents,
|
|
43
|
-
[context, resolve,
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
[context, resolve, reject](wgpu::RequestAdapterStatus status,
|
|
44
|
+
wgpu::Adapter adapter,
|
|
45
|
+
wgpu::StringView message) {
|
|
46
46
|
if (message.length) {
|
|
47
47
|
fprintf(stderr, "%s", message.data);
|
|
48
48
|
}
|
package/cpp/rnwgpu/api/GPU.h
CHANGED
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
#include "GPUInternalError.h"
|
|
14
14
|
#include "GPUOutOfMemoryError.h"
|
|
15
15
|
#include "GPUValidationError.h"
|
|
16
|
-
#include "
|
|
16
|
+
#include "jsi/JSIConverter.h"
|
|
17
17
|
|
|
18
18
|
namespace rnwgpu {
|
|
19
19
|
|
|
20
20
|
async::AsyncTaskHandle GPUAdapter::requestDevice(
|
|
21
|
+
jsi::Runtime &runtime,
|
|
21
22
|
std::optional<std::shared_ptr<GPUDeviceDescriptor>> descriptor) {
|
|
22
23
|
wgpu::DeviceDescriptor aDescriptor;
|
|
23
24
|
Convertor conv;
|
|
@@ -104,9 +105,15 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
|
|
|
104
105
|
descriptor.has_value() ? descriptor.value()->label.value_or("") : "";
|
|
105
106
|
|
|
106
107
|
auto creationRuntime = getCreationRuntime();
|
|
107
|
-
|
|
108
|
+
// Post to the CALLING runtime's context so the promise settles on the
|
|
109
|
+
// thread that requested it (see GPUBuffer::mapAsync). The GPUDevice is also
|
|
110
|
+
// bound to this context, honoring the contract that a device belongs to the
|
|
111
|
+
// runtime that requested it.
|
|
112
|
+
auto context =
|
|
113
|
+
async::RuntimeContext::getOrCreate(runtime, _async->instance());
|
|
114
|
+
return context->postTask(
|
|
108
115
|
[this, aDescriptor, descriptor, label = std::move(label),
|
|
109
|
-
deviceLostBinding,
|
|
116
|
+
deviceLostBinding, context,
|
|
110
117
|
creationRuntime](const async::AsyncTaskHandle::ResolveFunction &resolve,
|
|
111
118
|
const async::AsyncTaskHandle::RejectFunction &reject) {
|
|
112
119
|
// Build a local mutable copy so we can chain Dawn's device toggles.
|
|
@@ -138,10 +145,9 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
|
|
|
138
145
|
}
|
|
139
146
|
_instance.RequestDevice(
|
|
140
147
|
&deviceDesc, wgpu::CallbackMode::AllowProcessEvents,
|
|
141
|
-
[context
|
|
148
|
+
[context, resolve, reject, label, creationRuntime,
|
|
142
149
|
deviceLostBinding](wgpu::RequestDeviceStatus status,
|
|
143
|
-
wgpu::Device device,
|
|
144
|
-
wgpu::StringView message) {
|
|
150
|
+
wgpu::Device device, wgpu::StringView message) {
|
|
145
151
|
if (message.length) {
|
|
146
152
|
fprintf(stderr, "%s", message.data);
|
|
147
153
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
#include "descriptors/Unions.h"
|
|
8
8
|
|
|
9
|
-
#include "
|
|
9
|
+
#include "jsi/NativeObject.h"
|
|
10
10
|
|
|
11
11
|
#include "rnwgpu/async/AsyncTaskHandle.h"
|
|
12
12
|
#include "rnwgpu/async/RuntimeContext.h"
|
|
@@ -34,7 +34,8 @@ public:
|
|
|
34
34
|
std::string getBrand() { return CLASS_NAME; }
|
|
35
35
|
|
|
36
36
|
async::AsyncTaskHandle
|
|
37
|
-
requestDevice(
|
|
37
|
+
requestDevice(jsi::Runtime &runtime,
|
|
38
|
+
std::optional<std::shared_ptr<GPUDeviceDescriptor>> descriptor);
|
|
38
39
|
|
|
39
40
|
std::unordered_set<std::string> getFeatures();
|
|
40
41
|
std::shared_ptr<GPUSupportedLimits> getLimits();
|
|
@@ -42,8 +43,8 @@ public:
|
|
|
42
43
|
|
|
43
44
|
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
44
45
|
installGetter(runtime, prototype, "__brand", &GPUAdapter::getBrand);
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
installMethodWithRuntime(runtime, prototype, "requestDevice",
|
|
47
|
+
&GPUAdapter::requestDevice);
|
|
47
48
|
installGetter(runtime, prototype, "features", &GPUAdapter::getFeatures);
|
|
48
49
|
installGetter(runtime, prototype, "limits", &GPUAdapter::getLimits);
|
|
49
50
|
installGetter(runtime, prototype, "info", &GPUAdapter::getInfo);
|
|
@@ -37,7 +37,8 @@ GPUBuffer::getMappedRange(std::optional<size_t> o, std::optional<size_t> size) {
|
|
|
37
37
|
|
|
38
38
|
void GPUBuffer::destroy() { _instance.Destroy(); }
|
|
39
39
|
|
|
40
|
-
async::AsyncTaskHandle GPUBuffer::mapAsync(
|
|
40
|
+
async::AsyncTaskHandle GPUBuffer::mapAsync(jsi::Runtime &runtime,
|
|
41
|
+
uint64_t modeIn,
|
|
41
42
|
std::optional<uint64_t> offset,
|
|
42
43
|
std::optional<uint64_t> size) {
|
|
43
44
|
Convertor conv;
|
|
@@ -51,7 +52,16 @@ async::AsyncTaskHandle GPUBuffer::mapAsync(uint64_t modeIn,
|
|
|
51
52
|
auto bufferHandle = _instance;
|
|
52
53
|
uint64_t resolvedOffset = offset.value_or(0);
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
// Post to the CALLING runtime's context, not the one captured at buffer
|
|
56
|
+
// creation (_async): the buffer may have been created on another runtime and
|
|
57
|
+
// boxed across (e.g. device created on the main JS runtime, mapAsync called
|
|
58
|
+
// from a worklet). The returned Promise lives on the calling runtime, so it
|
|
59
|
+
// must be settled from that runtime's own thread — and postTask itself
|
|
60
|
+
// schedules the pump through its context's runtime (setTimeout), which is
|
|
61
|
+
// only safe for the runtime we are currently executing on.
|
|
62
|
+
auto context =
|
|
63
|
+
async::RuntimeContext::getOrCreate(runtime, _async->instance());
|
|
64
|
+
return context->postTask(
|
|
55
65
|
[bufferHandle, mode, resolvedOffset,
|
|
56
66
|
rangeSize](const async::AsyncTaskHandle::ResolveFunction &resolve,
|
|
57
67
|
const async::AsyncTaskHandle::RejectFunction &reject) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#include "descriptors/Unions.h"
|
|
9
9
|
|
|
10
|
-
#include "
|
|
10
|
+
#include "jsi/NativeObject.h"
|
|
11
11
|
|
|
12
12
|
#include "rnwgpu/async/AsyncTaskHandle.h"
|
|
13
13
|
#include "rnwgpu/async/RuntimeContext.h"
|
|
@@ -33,7 +33,7 @@ public:
|
|
|
33
33
|
public:
|
|
34
34
|
std::string getBrand() { return CLASS_NAME; }
|
|
35
35
|
|
|
36
|
-
async::AsyncTaskHandle mapAsync(uint64_t modeIn,
|
|
36
|
+
async::AsyncTaskHandle mapAsync(jsi::Runtime &runtime, uint64_t modeIn,
|
|
37
37
|
std::optional<uint64_t> offset,
|
|
38
38
|
std::optional<uint64_t> size);
|
|
39
39
|
std::shared_ptr<ArrayBuffer> getMappedRange(std::optional<size_t> offset,
|
|
@@ -53,7 +53,8 @@ public:
|
|
|
53
53
|
|
|
54
54
|
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
55
55
|
installGetter(runtime, prototype, "__brand", &GPUBuffer::getBrand);
|
|
56
|
-
|
|
56
|
+
installMethodWithRuntime(runtime, prototype, "mapAsync",
|
|
57
|
+
&GPUBuffer::mapAsync);
|
|
57
58
|
installMethod(runtime, prototype, "getMappedRange",
|
|
58
59
|
&GPUBuffer::getMappedRange);
|
|
59
60
|
installMethod(runtime, prototype, "unmap", &GPUBuffer::unmap);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#include "GPUCanvasContext.h"
|
|
2
2
|
#include "Convertors.h"
|
|
3
|
+
#include <algorithm>
|
|
3
4
|
#include <memory>
|
|
5
|
+
#include <utility>
|
|
6
|
+
#include <vector>
|
|
4
7
|
|
|
5
8
|
namespace rnwgpu {
|
|
6
9
|
|
|
@@ -9,37 +12,50 @@ void GPUCanvasContext::configure(
|
|
|
9
12
|
Convertor conv;
|
|
10
13
|
wgpu::SurfaceConfiguration surfaceConfiguration;
|
|
11
14
|
surfaceConfiguration.device = configuration->device->get();
|
|
12
|
-
if (configuration->viewFormats.has_value()) {
|
|
13
|
-
if (!conv(surfaceConfiguration.viewFormats,
|
|
14
|
-
surfaceConfiguration.viewFormatCount,
|
|
15
|
-
configuration->viewFormats.value())) {
|
|
16
|
-
throw std::runtime_error("Error with SurfaceConfiguration");
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
15
|
if (!conv(surfaceConfiguration.usage, configuration->usage) ||
|
|
20
16
|
!conv(surfaceConfiguration.format, configuration->format)) {
|
|
21
17
|
throw std::runtime_error("Error with SurfaceConfiguration");
|
|
22
18
|
}
|
|
19
|
+
// viewFormats are deep-copied into SurfaceInfo (which outlives this call);
|
|
20
|
+
// Convertor-allocated arrays would dangle.
|
|
21
|
+
std::vector<wgpu::TextureFormat> viewFormats;
|
|
22
|
+
if (configuration->viewFormats.has_value()) {
|
|
23
|
+
viewFormats = configuration->viewFormats.value();
|
|
24
|
+
}
|
|
23
25
|
|
|
24
26
|
#ifdef __APPLE__
|
|
25
27
|
surfaceConfiguration.alphaMode = configuration->alphaMode;
|
|
26
28
|
#endif
|
|
27
29
|
surfaceConfiguration.presentMode = wgpu::PresentMode::Fifo;
|
|
28
|
-
_surfaceInfo->configure(surfaceConfiguration);
|
|
30
|
+
_surfaceInfo->configure(surfaceConfiguration, std::move(viewFormats));
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
void GPUCanvasContext::unconfigure() {}
|
|
33
|
+
void GPUCanvasContext::unconfigure() { _surfaceInfo->unconfigure(); }
|
|
32
34
|
|
|
33
35
|
std::shared_ptr<GPUTexture> GPUCanvasContext::getCurrentTexture() {
|
|
36
|
+
if (!_surfaceInfo->isConfigured()) {
|
|
37
|
+
// Web parity: on the web this is an InvalidStateError, not a crash.
|
|
38
|
+
throw std::runtime_error(
|
|
39
|
+
"[WebGPU] getCurrentTexture() called on a canvas context that is not "
|
|
40
|
+
"configured; call context.configure() first");
|
|
41
|
+
}
|
|
42
|
+
// The drawing buffer tracks canvas.width/height (like on the web); resize it
|
|
43
|
+
// lazily when they changed. Sizes are clamped to 1 so a canvas that has not
|
|
44
|
+
// been laid out yet (0x0) keeps working.
|
|
34
45
|
auto prevSize = _surfaceInfo->getConfig();
|
|
35
|
-
auto width = _canvas->getWidth();
|
|
36
|
-
auto height = _canvas->getHeight();
|
|
37
|
-
auto sizeHasChanged = prevSize.width != width ||
|
|
46
|
+
auto width = std::max(1, _canvas->getWidth());
|
|
47
|
+
auto height = std::max(1, _canvas->getHeight());
|
|
48
|
+
auto sizeHasChanged = prevSize.width != static_cast<uint32_t>(width) ||
|
|
49
|
+
prevSize.height != static_cast<uint32_t>(height);
|
|
38
50
|
if (sizeHasChanged) {
|
|
39
51
|
_surfaceInfo->reconfigure(width, height);
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
auto texture = _surfaceInfo->getCurrentTexture();
|
|
55
|
+
if (texture == nullptr) {
|
|
56
|
+
throw std::runtime_error(
|
|
57
|
+
"[WebGPU] getCurrentTexture() failed to acquire a texture");
|
|
58
|
+
}
|
|
43
59
|
|
|
44
60
|
auto size = _surfaceInfo->getSize();
|
|
45
61
|
_canvas->setClientWidth(size.width);
|
|
@@ -49,13 +65,11 @@ std::shared_ptr<GPUTexture> GPUCanvasContext::getCurrentTexture() {
|
|
|
49
65
|
}
|
|
50
66
|
|
|
51
67
|
void GPUCanvasContext::present() {
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
_surfaceInfo->presentFrame();
|
|
58
|
-
}
|
|
68
|
+
// presentFrame() is the end-of-frame boundary: it presents when this frame's
|
|
69
|
+
// texture was acquired from the on-screen surface (offscreen and dropped
|
|
70
|
+
// frames are skipped), clears the frame state, and adopts any surface that
|
|
71
|
+
// attached while the frame was in flight.
|
|
72
|
+
_surfaceInfo->presentFrame();
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
} // namespace rnwgpu
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
#include "webgpu/webgpu_cpp.h"
|
|
10
10
|
|
|
11
|
-
#include "
|
|
11
|
+
#include "jsi/NativeObject.h"
|
|
12
12
|
|
|
13
13
|
#include "GPU.h"
|
|
14
14
|
#include "GPUTexture.h"
|
|
@@ -56,7 +56,9 @@ public:
|
|
|
56
56
|
std::shared_ptr<GPUTexture> getCurrentTexture();
|
|
57
57
|
// Present is explicit on every runtime (main JS, Reanimated UI, and dedicated
|
|
58
58
|
// worklet runtimes). It runs synchronously on the calling thread, preserving
|
|
59
|
-
// Dawn surface thread-affinity; offscreen
|
|
59
|
+
// Dawn surface thread-affinity; frames rendered offscreen (no surface
|
|
60
|
+
// attached) are skipped. It is also the end-of-frame boundary at which a
|
|
61
|
+
// newly attached native surface is adopted (see SurfaceInfo).
|
|
60
62
|
void present();
|
|
61
63
|
|
|
62
64
|
private:
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
#include "Convertors.h"
|
|
12
12
|
#include "NativeBufferUtils.h"
|
|
13
|
-
#include "
|
|
13
|
+
#include "jsi/JSIConverter.h"
|
|
14
14
|
|
|
15
15
|
#include "GPUFeatures.h"
|
|
16
16
|
#include "GPUInternalError.h"
|
|
@@ -327,6 +327,7 @@ std::shared_ptr<GPUSharedFence> GPUDevice::importSharedFence(
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
async::AsyncTaskHandle GPUDevice::createComputePipelineAsync(
|
|
330
|
+
jsi::Runtime &runtime,
|
|
330
331
|
std::shared_ptr<GPUComputePipelineDescriptor> descriptor) {
|
|
331
332
|
wgpu::ComputePipelineDescriptor desc{};
|
|
332
333
|
Convertor conv;
|
|
@@ -339,12 +340,16 @@ async::AsyncTaskHandle GPUDevice::createComputePipelineAsync(
|
|
|
339
340
|
descriptor->label.has_value() ? descriptor->label.value() : "");
|
|
340
341
|
auto pipelineHolder = std::make_shared<GPUComputePipeline>(nullptr, label);
|
|
341
342
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
343
|
+
// Post to the CALLING runtime's context so the promise settles on the
|
|
344
|
+
// thread that requested it (see GPUBuffer::mapAsync).
|
|
345
|
+
auto context =
|
|
346
|
+
async::RuntimeContext::getOrCreate(runtime, _async->instance());
|
|
347
|
+
return context->postTask([device = _instance, desc, descriptor,
|
|
348
|
+
pipelineHolder](
|
|
349
|
+
const async::AsyncTaskHandle::ResolveFunction
|
|
350
|
+
&resolve,
|
|
351
|
+
const async::AsyncTaskHandle::RejectFunction
|
|
352
|
+
&reject) {
|
|
348
353
|
(void)descriptor;
|
|
349
354
|
device.CreateComputePipelineAsync(
|
|
350
355
|
&desc, wgpu::CallbackMode::AllowProcessEvents,
|
|
@@ -358,9 +363,9 @@ async::AsyncTaskHandle GPUDevice::createComputePipelineAsync(
|
|
|
358
363
|
runtime, pipelineHolder);
|
|
359
364
|
});
|
|
360
365
|
} else {
|
|
361
|
-
std::string error =
|
|
362
|
-
|
|
363
|
-
|
|
366
|
+
std::string error = msg.length
|
|
367
|
+
? std::string(msg.data, msg.length)
|
|
368
|
+
: "Failed to create compute pipeline";
|
|
364
369
|
reject(std::move(error));
|
|
365
370
|
}
|
|
366
371
|
});
|
|
@@ -368,6 +373,7 @@ async::AsyncTaskHandle GPUDevice::createComputePipelineAsync(
|
|
|
368
373
|
}
|
|
369
374
|
|
|
370
375
|
async::AsyncTaskHandle GPUDevice::createRenderPipelineAsync(
|
|
376
|
+
jsi::Runtime &runtime,
|
|
371
377
|
std::shared_ptr<GPURenderPipelineDescriptor> descriptor) {
|
|
372
378
|
wgpu::RenderPipelineDescriptor desc{};
|
|
373
379
|
Convertor conv;
|
|
@@ -381,12 +387,16 @@ async::AsyncTaskHandle GPUDevice::createRenderPipelineAsync(
|
|
|
381
387
|
descriptor->label.has_value() ? descriptor->label.value() : "");
|
|
382
388
|
auto pipelineHolder = std::make_shared<GPURenderPipeline>(nullptr, label);
|
|
383
389
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
+
// Post to the CALLING runtime's context so the promise settles on the
|
|
391
|
+
// thread that requested it (see GPUBuffer::mapAsync).
|
|
392
|
+
auto context =
|
|
393
|
+
async::RuntimeContext::getOrCreate(runtime, _async->instance());
|
|
394
|
+
return context->postTask([device = _instance, desc, descriptor,
|
|
395
|
+
pipelineHolder](
|
|
396
|
+
const async::AsyncTaskHandle::ResolveFunction
|
|
397
|
+
&resolve,
|
|
398
|
+
const async::AsyncTaskHandle::RejectFunction
|
|
399
|
+
&reject) {
|
|
390
400
|
(void)descriptor;
|
|
391
401
|
device.CreateRenderPipelineAsync(
|
|
392
402
|
&desc, wgpu::CallbackMode::AllowProcessEvents,
|
|
@@ -400,9 +410,8 @@ async::AsyncTaskHandle GPUDevice::createRenderPipelineAsync(
|
|
|
400
410
|
runtime, pipelineHolder);
|
|
401
411
|
});
|
|
402
412
|
} else {
|
|
403
|
-
std::string error =
|
|
404
|
-
|
|
405
|
-
: "Failed to create render pipeline";
|
|
413
|
+
std::string error = msg.length ? std::string(msg.data, msg.length)
|
|
414
|
+
: "Failed to create render pipeline";
|
|
406
415
|
reject(std::move(error));
|
|
407
416
|
}
|
|
408
417
|
});
|
|
@@ -413,13 +422,18 @@ void GPUDevice::pushErrorScope(wgpu::ErrorFilter filter) {
|
|
|
413
422
|
_instance.PushErrorScope(filter);
|
|
414
423
|
}
|
|
415
424
|
|
|
416
|
-
async::AsyncTaskHandle GPUDevice::popErrorScope() {
|
|
425
|
+
async::AsyncTaskHandle GPUDevice::popErrorScope(jsi::Runtime &runtime) {
|
|
417
426
|
auto device = _instance;
|
|
418
427
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
428
|
+
// Post to the CALLING runtime's context so the promise settles on the
|
|
429
|
+
// thread that requested it (see GPUBuffer::mapAsync).
|
|
430
|
+
auto context =
|
|
431
|
+
async::RuntimeContext::getOrCreate(runtime, _async->instance());
|
|
432
|
+
return context->postTask([device](
|
|
433
|
+
const async::AsyncTaskHandle::ResolveFunction
|
|
434
|
+
&resolve,
|
|
435
|
+
const async::AsyncTaskHandle::RejectFunction
|
|
436
|
+
&reject) {
|
|
423
437
|
device.PopErrorScope(
|
|
424
438
|
wgpu::CallbackMode::AllowProcessEvents,
|
|
425
439
|
[resolve, reject](wgpu::PopErrorScopeStatus status,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
#include "descriptors/Unions.h"
|
|
15
15
|
|
|
16
|
-
#include "
|
|
16
|
+
#include "jsi/NativeObject.h"
|
|
17
17
|
|
|
18
18
|
#include "rnwgpu/async/AsyncTaskHandle.h"
|
|
19
19
|
#include "rnwgpu/async/RuntimeContext.h"
|
|
@@ -141,8 +141,10 @@ public:
|
|
|
141
141
|
std::shared_ptr<GPURenderPipeline>
|
|
142
142
|
createRenderPipeline(std::shared_ptr<GPURenderPipelineDescriptor> descriptor);
|
|
143
143
|
async::AsyncTaskHandle createComputePipelineAsync(
|
|
144
|
+
jsi::Runtime &runtime,
|
|
144
145
|
std::shared_ptr<GPUComputePipelineDescriptor> descriptor);
|
|
145
146
|
async::AsyncTaskHandle createRenderPipelineAsync(
|
|
147
|
+
jsi::Runtime &runtime,
|
|
146
148
|
std::shared_ptr<GPURenderPipelineDescriptor> descriptor);
|
|
147
149
|
std::shared_ptr<GPUCommandEncoder> createCommandEncoder(
|
|
148
150
|
std::optional<std::shared_ptr<GPUCommandEncoderDescriptor>> descriptor);
|
|
@@ -151,7 +153,7 @@ public:
|
|
|
151
153
|
std::shared_ptr<GPUQuerySet>
|
|
152
154
|
createQuerySet(std::shared_ptr<GPUQuerySetDescriptor> descriptor);
|
|
153
155
|
void pushErrorScope(wgpu::ErrorFilter filter);
|
|
154
|
-
async::AsyncTaskHandle popErrorScope();
|
|
156
|
+
async::AsyncTaskHandle popErrorScope(jsi::Runtime &runtime);
|
|
155
157
|
|
|
156
158
|
std::unordered_set<std::string> getFeatures();
|
|
157
159
|
std::shared_ptr<GPUSupportedLimits> getLimits();
|
|
@@ -197,10 +199,10 @@ public:
|
|
|
197
199
|
&GPUDevice::createComputePipeline);
|
|
198
200
|
installMethod(runtime, prototype, "createRenderPipeline",
|
|
199
201
|
&GPUDevice::createRenderPipeline);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
installMethodWithRuntime(runtime, prototype, "createComputePipelineAsync",
|
|
203
|
+
&GPUDevice::createComputePipelineAsync);
|
|
204
|
+
installMethodWithRuntime(runtime, prototype, "createRenderPipelineAsync",
|
|
205
|
+
&GPUDevice::createRenderPipelineAsync);
|
|
204
206
|
installMethod(runtime, prototype, "createCommandEncoder",
|
|
205
207
|
&GPUDevice::createCommandEncoder);
|
|
206
208
|
installMethod(runtime, prototype, "createRenderBundleEncoder",
|
|
@@ -209,8 +211,8 @@ public:
|
|
|
209
211
|
&GPUDevice::createQuerySet);
|
|
210
212
|
installMethod(runtime, prototype, "pushErrorScope",
|
|
211
213
|
&GPUDevice::pushErrorScope);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
+
installMethodWithRuntime(runtime, prototype, "popErrorScope",
|
|
215
|
+
&GPUDevice::popErrorScope);
|
|
214
216
|
installGetter(runtime, prototype, "features", &GPUDevice::getFeatures);
|
|
215
217
|
installGetter(runtime, prototype, "limits", &GPUDevice::getLimits);
|
|
216
218
|
installGetter(runtime, prototype, "queue", &GPUDevice::getQueue);
|
|
@@ -238,8 +240,8 @@ private:
|
|
|
238
240
|
std::shared_ptr<async::RuntimeContext> _async;
|
|
239
241
|
std::string _label;
|
|
240
242
|
// Guards the device-lost state below. In the ProcessEvents model both
|
|
241
|
-
// notifyDeviceLost() (fired by Dawn during ProcessEvents) and getLost() run
|
|
242
|
-
// the owning runtime's own thread, but device destruction can also trigger
|
|
243
|
+
// notifyDeviceLost() (fired by Dawn during ProcessEvents) and getLost() run
|
|
244
|
+
// on the owning runtime's own thread, but device destruction can also trigger
|
|
243
245
|
// notifyDeviceLost() synchronously, so the mutex keeps these fields safe.
|
|
244
246
|
std::mutex _lostMutex;
|
|
245
247
|
std::optional<async::AsyncTaskHandle> _lostHandle;
|