Skip to content

Commit f210dd4

Browse files
committed
Bug 1829305: fix(webgpu): trade incorrect ImageCopyBuffer usage for exploded ID and FFI-friendly ImageDataLayout in wgpu_server_encoder_copy_texture_to_buffer r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D176207 UltraBlame original commit: 40f7492787a9f27938eeffda38d9d77a81164f3b
1 parent 00a8f44 commit f210dd4

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

dom/webgpu/ipc/WebGPUParent.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -938,17 +938,14 @@ ipc::IPCResult WebGPUParent::RecvSwapChainPresent(
938938
&data->mSourcePitch,
939939
nullptr,
940940
};
941-
const ffi::WGPUImageCopyBuffer bufView = {
942-
bufferId,
943-
bufLayout,
944-
};
945941
const ffi::WGPUExtent3d extent = {
946942
static_cast<uint32_t>(size.width),
947943
static_cast<uint32_t>(size.height),
948944
1,
949945
};
950946
ffi::wgpu_server_encoder_copy_texture_to_buffer(
951-
mContext.get(), aCommandEncoderId, &texView, &bufView, &extent);
947+
mContext.get(), aCommandEncoderId, &texView, bufferId, &bufLayout,
948+
&extent);
952949
ffi::WGPUCommandBufferDescriptor commandDesc = {};
953950
{
954951
ErrorBuffer error;

gfx/wgpu_bindings/src/server.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,15 @@ pub unsafe extern "C" fn wgpu_server_encoder_copy_texture_to_buffer(
758758
global: &Global,
759759
self_id: id::CommandEncoderId,
760760
source: &wgc::command::ImageCopyTexture,
761-
destination: &wgc::command::ImageCopyBuffer,
761+
dst_buffer: wgc::id::BufferId,
762+
dst_layout: &crate::ImageDataLayout,
762763
size: &wgt::Extent3d,
763764
) {
764-
gfx_select!(self_id => global.command_encoder_copy_texture_to_buffer(self_id, source, destination, size)).unwrap();
765+
let destination = wgc::command::ImageCopyBuffer {
766+
buffer: dst_buffer,
767+
layout: dst_layout.into_wgt(),
768+
};
769+
gfx_select!(self_id => global.command_encoder_copy_texture_to_buffer(self_id, source, &destination, size)).unwrap();
765770
}
766771

767772

0 commit comments

Comments
 (0)