Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/canvas/WebGPU/GPUDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
13 changes: 13 additions & 0 deletions packages/canvas/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,10 +1194,23 @@ void GPUDeviceImpl::CreateRenderBundleEncoder(const v8::FunctionCallbackInfo<v8:
}

uint32_t sampleCount = 1;
v8::Local<v8::Value> sampleCountVal;
if (options->Get(context, ConvertToV8String(isolate, "sampleCount")).ToLocal(&sampleCountVal) &&
sampleCountVal->IsUint32()) {
sampleCount = sampleCountVal->Uint32Value(context).FromJust();
}

bool depthReadOnly = false;
v8::Local<v8::Value> depthReadOnlyVal;
if (options->Get(context, ConvertToV8String(isolate, "depthReadOnly")).ToLocal(&depthReadOnlyVal)) {
depthReadOnly = depthReadOnlyVal->BooleanValue(isolate);
}

bool stencilReadOnly = false;
v8::Local<v8::Value> stencilReadOnlyVal;
if (options->Get(context, ConvertToV8String(isolate, "stencilReadOnly")).ToLocal(&stencilReadOnlyVal)) {
stencilReadOnly = stencilReadOnlyVal->BooleanValue(isolate);
}

CanvasCreateRenderBundleEncoderDescriptor descriptor{
*label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
} else if (aspectStr == "depth-only") {
aspect = CanvasTextureAspectDepthOnly;
}
range.aspect = aspect;
}


Expand Down
Loading