diff --git a/packages/canvas/WebGPU/GPUDevice.ts b/packages/canvas/WebGPU/GPUDevice.ts index 061bcb3d..027c578f 100644 --- a/packages/canvas/WebGPU/GPUDevice.ts +++ b/packages/canvas/WebGPU/GPUDevice.ts @@ -277,6 +277,11 @@ export class GPUDevice extends EventTarget { } createRenderBundleEncoder(descriptor: { colorFormats: (null | GPUTextureFormat)[]; depthReadOnly?: boolean; depthStencilFormat?: GPUTextureFormat; label?: string; sampleCount?: number; stencilReadOnly?: boolean }) { + if (__ANDROID__ && Array.isArray(descriptor?.colorFormats)) { + // Same bgra -> rgba fallback as createTexture and the pipelines, or a bundle can't match the pass it runs in. + const colorFormats = descriptor.colorFormats.map((format) => (format === 'bgra8unorm' ? 'rgba8unorm' : format === 'bgra8unorm-srgb' ? 'rgba8unorm-srgb' : format)); + descriptor = { ...descriptor, colorFormats }; + } return GPURenderBundleEncoder.fromNative(this.native.createRenderBundleEncoder(descriptor)); } diff --git a/packages/canvas/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp b/packages/canvas/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp index 87878b32..d1b80e54 100644 --- a/packages/canvas/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +++ b/packages/canvas/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp @@ -1194,10 +1194,23 @@ void GPUDeviceImpl::CreateRenderBundleEncoder(const v8::FunctionCallbackInfo sampleCountVal; + if (options->Get(context, ConvertToV8String(isolate, "sampleCount")).ToLocal(&sampleCountVal) && + sampleCountVal->IsUint32()) { + sampleCount = sampleCountVal->Uint32Value(context).FromJust(); + } bool depthReadOnly = false; + v8::Local depthReadOnlyVal; + if (options->Get(context, ConvertToV8String(isolate, "depthReadOnly")).ToLocal(&depthReadOnlyVal)) { + depthReadOnly = depthReadOnlyVal->BooleanValue(isolate); + } bool stencilReadOnly = false; + v8::Local stencilReadOnlyVal; + if (options->Get(context, ConvertToV8String(isolate, "stencilReadOnly")).ToLocal(&stencilReadOnlyVal)) { + stencilReadOnly = stencilReadOnlyVal->BooleanValue(isolate); + } CanvasCreateRenderBundleEncoderDescriptor descriptor{ *label, diff --git a/packages/canvas/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp b/packages/canvas/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp index 8904ca08..d6b87366 100644 --- a/packages/canvas/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +++ b/packages/canvas/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp @@ -305,6 +305,7 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo &args) } else if (aspectStr == "depth-only") { aspect = CanvasTextureAspectDepthOnly; } + range.aspect = aspect; }