mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Change ErrorScopeId type to NonZeroU64
And extract it from WebGPURequest
This commit is contained in:
parent
8eff1d74de
commit
ce6e09a3aa
17 changed files with 277 additions and 250 deletions
|
@ -2169,7 +2169,7 @@ where
|
|||
options,
|
||||
ids,
|
||||
};
|
||||
if webgpu_chan.0.send(adapter_request).is_err() {
|
||||
if webgpu_chan.0.send((None, adapter_request)).is_err() {
|
||||
return warn!("Failed to send request adapter message on WebGPU channel");
|
||||
}
|
||||
},
|
||||
|
|
|
@ -831,6 +831,7 @@ malloc_size_of_is_0!(bool, char, str);
|
|||
malloc_size_of_is_0!(u8, u16, u32, u64, u128, usize);
|
||||
malloc_size_of_is_0!(i8, i16, i32, i64, i128, isize);
|
||||
malloc_size_of_is_0!(f32, f64);
|
||||
malloc_size_of_is_0!(std::num::NonZeroU64);
|
||||
|
||||
malloc_size_of_is_0!(std::sync::atomic::AtomicBool);
|
||||
malloc_size_of_is_0!(std::sync::atomic::AtomicIsize);
|
||||
|
|
|
@ -138,6 +138,7 @@ use std::cell::{Cell, RefCell, UnsafeCell};
|
|||
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::mem;
|
||||
use std::num::NonZeroU64;
|
||||
use std::ops::{Deref, DerefMut, Range};
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
@ -524,6 +525,7 @@ unsafe_no_jsmanaged_fields!(ActiveUniformBlockInfo);
|
|||
unsafe_no_jsmanaged_fields!(bool, f32, f64, String, AtomicBool, AtomicUsize, Uuid, char);
|
||||
unsafe_no_jsmanaged_fields!(usize, u8, u16, u32, u64);
|
||||
unsafe_no_jsmanaged_fields!(isize, i8, i16, i32, i64);
|
||||
unsafe_no_jsmanaged_fields!(NonZeroU64);
|
||||
unsafe_no_jsmanaged_fields!(Error);
|
||||
unsafe_no_jsmanaged_fields!(ServoUrl, ImmutableOrigin, MutableOrigin);
|
||||
unsafe_no_jsmanaged_fields!(Image, ImageMetadata, dyn ImageCache, PendingImageId);
|
||||
|
|
|
@ -127,7 +127,7 @@ use std::sync::Arc;
|
|||
use std::thread::JoinHandle;
|
||||
use time::{get_time, Timespec};
|
||||
use uuid::Uuid;
|
||||
use webgpu::{identity::WebGPUOpResult, WebGPUDevice};
|
||||
use webgpu::{identity::WebGPUOpResult, ErrorScopeId, WebGPUDevice};
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
pub struct AutoCloseWorker {
|
||||
|
@ -3023,7 +3023,7 @@ impl GlobalScope {
|
|||
pub fn handle_wgpu_msg(
|
||||
&self,
|
||||
device: WebGPUDevice,
|
||||
scope: Option<u64>,
|
||||
scope: Option<ErrorScopeId>,
|
||||
result: WebGPUOpResult,
|
||||
) {
|
||||
self.gpu_devices
|
||||
|
|
|
@ -97,14 +97,17 @@ impl GPUAdapterMethods for GPUAdapter {
|
|||
if self
|
||||
.channel
|
||||
.0
|
||||
.send(WebGPURequest::RequestDevice {
|
||||
sender,
|
||||
adapter_id: self.adapter,
|
||||
descriptor: desc,
|
||||
device_id: id,
|
||||
pipeline_id,
|
||||
label: descriptor.parent.label.as_ref().map(|s| s.to_string()),
|
||||
})
|
||||
.send((
|
||||
None,
|
||||
WebGPURequest::RequestDevice {
|
||||
sender,
|
||||
adapter_id: self.adapter,
|
||||
descriptor: desc,
|
||||
device_id: id,
|
||||
pipeline_id,
|
||||
label: descriptor.parent.label.as_ref().map(|s| s.to_string()),
|
||||
},
|
||||
))
|
||||
.is_err()
|
||||
{
|
||||
promise.reject_error(Error::Operation);
|
||||
|
|
|
@ -146,15 +146,19 @@ impl GPUBufferMethods for GPUBuffer {
|
|||
let mut info = self.map_info.borrow_mut();
|
||||
let m_info = info.as_mut().unwrap();
|
||||
let m_range = m_info.mapping_range.clone();
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::UnmapBuffer {
|
||||
buffer_id: self.id().0,
|
||||
device_id: self.device.id().0,
|
||||
scope_id: self.device.use_current_scope(),
|
||||
array_buffer: IpcSharedMemory::from_bytes(m_info.mapping.borrow().as_slice()),
|
||||
is_map_read: m_info.map_mode == Some(GPUMapModeConstants::READ),
|
||||
offset: m_range.start,
|
||||
size: m_range.end - m_range.start,
|
||||
}) {
|
||||
if let Err(e) = self.channel.0.send((
|
||||
self.device.use_current_scope(),
|
||||
WebGPURequest::UnmapBuffer {
|
||||
buffer_id: self.id().0,
|
||||
device_id: self.device.id().0,
|
||||
array_buffer: IpcSharedMemory::from_bytes(
|
||||
m_info.mapping.borrow().as_slice(),
|
||||
),
|
||||
is_map_read: m_info.map_mode == Some(GPUMapModeConstants::READ),
|
||||
offset: m_range.start,
|
||||
size: m_range.end - m_range.start,
|
||||
},
|
||||
)) {
|
||||
warn!("Failed to send Buffer unmap ({:?}) ({})", self.buffer.0, e);
|
||||
}
|
||||
// Step 3.3
|
||||
|
@ -185,7 +189,7 @@ impl GPUBufferMethods for GPUBuffer {
|
|||
if let Err(e) = self
|
||||
.channel
|
||||
.0
|
||||
.send(WebGPURequest::DestroyBuffer(self.buffer.0))
|
||||
.send((None, WebGPURequest::DestroyBuffer(self.buffer.0)))
|
||||
{
|
||||
warn!(
|
||||
"Failed to send WebGPURequest::DestroyBuffer({:?}) ({})",
|
||||
|
@ -238,14 +242,16 @@ impl GPUBufferMethods for GPUBuffer {
|
|||
let map_range = offset..offset + range_size;
|
||||
|
||||
let sender = response_async(&promise, self);
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::BufferMapAsync {
|
||||
sender,
|
||||
buffer_id: self.buffer.0,
|
||||
device_id: self.device.id().0,
|
||||
if let Err(e) = self.channel.0.send((
|
||||
scope_id,
|
||||
host_map,
|
||||
map_range: map_range.clone(),
|
||||
}) {
|
||||
WebGPURequest::BufferMapAsync {
|
||||
sender,
|
||||
buffer_id: self.buffer.0,
|
||||
device_id: self.device.id().0,
|
||||
host_map,
|
||||
map_range: map_range.clone(),
|
||||
},
|
||||
)) {
|
||||
warn!(
|
||||
"Failed to send BufferMapAsync ({:?}) ({})",
|
||||
self.buffer.0, e
|
||||
|
@ -360,7 +366,7 @@ impl AsyncWGPUListener for GPUBuffer {
|
|||
if let Err(e) = self
|
||||
.channel
|
||||
.0
|
||||
.send(WebGPURequest::BufferMapComplete(self.buffer.0))
|
||||
.send((None, WebGPURequest::BufferMapComplete(self.buffer.0)))
|
||||
{
|
||||
warn!(
|
||||
"Failed to send BufferMapComplete({:?}) ({})",
|
||||
|
|
|
@ -45,7 +45,9 @@ pub struct GPUCanvasContext {
|
|||
impl GPUCanvasContext {
|
||||
fn new_inherited(canvas: &HTMLCanvasElement, size: Size2D<u32>, channel: WebGPU) -> Self {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let _ = channel.0.send(WebGPURequest::CreateContext(sender));
|
||||
if let Err(e) = channel.0.send((None, WebGPURequest::CreateContext(sender))) {
|
||||
warn!("Failed to send CreateContext ({:?})", e);
|
||||
}
|
||||
let external_id = receiver.recv().unwrap();
|
||||
Self {
|
||||
reflector_: Reflector::new(),
|
||||
|
@ -88,11 +90,14 @@ impl GPUCanvasContext {
|
|||
.wgpu_id_hub()
|
||||
.lock()
|
||||
.create_command_encoder_id(texture_id.backend());
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::SwapChainPresent {
|
||||
external_id: self.context_id.0,
|
||||
texture_id,
|
||||
encoder_id,
|
||||
}) {
|
||||
if let Err(e) = self.channel.0.send((
|
||||
None,
|
||||
WebGPURequest::SwapChainPresent {
|
||||
external_id: self.context_id.0,
|
||||
texture_id,
|
||||
encoder_id,
|
||||
},
|
||||
)) {
|
||||
warn!(
|
||||
"Failed to send UpdateWebrenderData({:?}) ({})",
|
||||
self.context_id, e
|
||||
|
@ -168,14 +173,17 @@ impl GPUCanvasContextMethods for GPUCanvasContext {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateSwapChain {
|
||||
device_id: descriptor.device.id().0,
|
||||
buffer_ids,
|
||||
external_id: self.context_id.0,
|
||||
sender,
|
||||
image_desc,
|
||||
image_data,
|
||||
})
|
||||
.send((
|
||||
None,
|
||||
WebGPURequest::CreateSwapChain {
|
||||
device_id: descriptor.device.id().0,
|
||||
buffer_ids,
|
||||
external_id: self.context_id.0,
|
||||
sender,
|
||||
image_desc,
|
||||
image_data,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU SwapChain");
|
||||
|
||||
let usage = if descriptor.usage % 2 == 0 {
|
||||
|
|
|
@ -277,16 +277,18 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
.insert(DomRoot::from_ref(destination));
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CopyBufferToBuffer {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
.send((
|
||||
scope_id,
|
||||
source_id: source.id().0,
|
||||
source_offset,
|
||||
destination_id: destination.id().0,
|
||||
destination_offset,
|
||||
size,
|
||||
})
|
||||
WebGPURequest::CopyBufferToBuffer {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
source_id: source.id().0,
|
||||
source_offset,
|
||||
destination_id: destination.id().0,
|
||||
destination_offset,
|
||||
size,
|
||||
},
|
||||
))
|
||||
.expect("Failed to send CopyBufferToBuffer");
|
||||
}
|
||||
|
||||
|
@ -317,14 +319,18 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CopyBufferToTexture {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
.send((
|
||||
scope_id,
|
||||
source: convert_buffer_cv(source),
|
||||
destination: convert_texture_cv(destination),
|
||||
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(©_size)),
|
||||
})
|
||||
WebGPURequest::CopyBufferToTexture {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
source: convert_buffer_cv(source),
|
||||
destination: convert_texture_cv(destination),
|
||||
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
|
||||
©_size,
|
||||
)),
|
||||
},
|
||||
))
|
||||
.expect("Failed to send CopyBufferToTexture");
|
||||
}
|
||||
|
||||
|
@ -355,14 +361,18 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CopyTextureToBuffer {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
.send((
|
||||
scope_id,
|
||||
source: convert_texture_cv(source),
|
||||
destination: convert_buffer_cv(destination),
|
||||
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(©_size)),
|
||||
})
|
||||
WebGPURequest::CopyTextureToBuffer {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
source: convert_texture_cv(source),
|
||||
destination: convert_buffer_cv(destination),
|
||||
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
|
||||
©_size,
|
||||
)),
|
||||
},
|
||||
))
|
||||
.expect("Failed to send CopyTextureToBuffer");
|
||||
}
|
||||
|
||||
|
@ -389,14 +399,18 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CopyTextureToTexture {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
.send((
|
||||
scope_id,
|
||||
source: convert_texture_cv(source),
|
||||
destination: convert_texture_cv(destination),
|
||||
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(©_size)),
|
||||
})
|
||||
WebGPURequest::CopyTextureToTexture {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
source: convert_texture_cv(source),
|
||||
destination: convert_texture_cv(destination),
|
||||
copy_size: convert_texture_size_to_wgt(&convert_texture_size_to_dict(
|
||||
©_size,
|
||||
)),
|
||||
},
|
||||
))
|
||||
.expect("Failed to send CopyTextureToTexture");
|
||||
}
|
||||
|
||||
|
@ -404,13 +418,15 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder {
|
|||
fn Finish(&self, descriptor: &GPUCommandBufferDescriptor) -> DomRoot<GPUCommandBuffer> {
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CommandEncoderFinish {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
scope_id: self.device.use_current_scope(),
|
||||
// TODO(zakorgy): We should use `_descriptor` here after it's not empty
|
||||
// and the underlying wgpu-core struct is serializable
|
||||
})
|
||||
.send((
|
||||
self.device.use_current_scope(),
|
||||
WebGPURequest::CommandEncoderFinish {
|
||||
command_encoder_id: self.encoder.0,
|
||||
device_id: self.device.id().0,
|
||||
// TODO(zakorgy): We should use `_descriptor` here after it's not empty
|
||||
// and the underlying wgpu-core struct is serializable
|
||||
},
|
||||
))
|
||||
.expect("Failed to send Finish");
|
||||
|
||||
*self.state.borrow_mut() = GPUCommandEncoderState::Closed;
|
||||
|
|
|
@ -91,12 +91,14 @@ impl GPUComputePassEncoderMethods for GPUComputePassEncoder {
|
|||
if let Some(compute_pass) = self.compute_pass.borrow_mut().take() {
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::RunComputePass {
|
||||
command_encoder_id: self.command_encoder.id().0,
|
||||
device_id: self.command_encoder.device().id().0,
|
||||
scope_id: self.command_encoder.device().use_current_scope(),
|
||||
compute_pass,
|
||||
})
|
||||
.send((
|
||||
self.command_encoder.device().use_current_scope(),
|
||||
WebGPURequest::RunComputePass {
|
||||
command_encoder_id: self.command_encoder.id().0,
|
||||
device_id: self.command_encoder.device().id().0,
|
||||
compute_pass,
|
||||
},
|
||||
))
|
||||
.expect("Failed to send RunComputePass");
|
||||
|
||||
self.command_encoder.set_state(
|
||||
|
|
|
@ -71,9 +71,7 @@ use std::rc::Rc;
|
|||
use webgpu::wgpu::{
|
||||
binding_model as wgpu_bind, command::RenderBundleEncoder, pipeline as wgpu_pipe,
|
||||
};
|
||||
use webgpu::{self, identity::WebGPUOpResult, wgt, WebGPU, WebGPURequest};
|
||||
|
||||
type ErrorScopeId = u64;
|
||||
use webgpu::{self, identity::WebGPUOpResult, wgt, ErrorScopeId, WebGPU, WebGPURequest};
|
||||
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct ErrorScopeInfo {
|
||||
|
@ -131,7 +129,7 @@ impl GPUDevice {
|
|||
scope_context: DomRefCell::new(ScopeContext {
|
||||
error_scopes: HashMap::new(),
|
||||
scope_stack: Vec::new(),
|
||||
next_scope_id: 0,
|
||||
next_scope_id: ErrorScopeId::new(1).unwrap(),
|
||||
}),
|
||||
lost_promise: DomRefCell::new(None),
|
||||
}
|
||||
|
@ -313,12 +311,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
let scope_id = self.use_current_scope();
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateBuffer {
|
||||
device_id: self.device.0,
|
||||
.send((
|
||||
scope_id,
|
||||
buffer_id: id,
|
||||
descriptor: wgpu_descriptor,
|
||||
})
|
||||
WebGPURequest::CreateBuffer {
|
||||
device_id: self.device.0,
|
||||
buffer_id: id,
|
||||
descriptor: wgpu_descriptor,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU buffer");
|
||||
|
||||
let buffer = webgpu::WebGPUBuffer(id);
|
||||
|
@ -451,12 +451,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
.create_bind_group_layout_id(self.device.0.backend());
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateBindGroupLayout {
|
||||
device_id: self.device.0,
|
||||
bind_group_layout_id,
|
||||
.send((
|
||||
scope_id,
|
||||
descriptor: desc,
|
||||
})
|
||||
WebGPURequest::CreateBindGroupLayout {
|
||||
device_id: self.device.0,
|
||||
bind_group_layout_id,
|
||||
descriptor: desc,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU BindGroupLayout");
|
||||
|
||||
let bgl = webgpu::WebGPUBindGroupLayout(bind_group_layout_id);
|
||||
|
@ -493,12 +495,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
.create_pipeline_layout_id(self.device.0.backend());
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreatePipelineLayout {
|
||||
device_id: self.device.0,
|
||||
pipeline_layout_id,
|
||||
descriptor: desc,
|
||||
.send((
|
||||
scope_id,
|
||||
})
|
||||
WebGPURequest::CreatePipelineLayout {
|
||||
device_id: self.device.0,
|
||||
pipeline_layout_id,
|
||||
descriptor: desc,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU PipelineLayout");
|
||||
|
||||
let pipeline_layout = webgpu::WebGPUPipelineLayout(pipeline_layout_id);
|
||||
|
@ -553,12 +557,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
.create_bind_group_id(self.device.0.backend());
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateBindGroup {
|
||||
device_id: self.device.0,
|
||||
bind_group_id,
|
||||
descriptor: desc,
|
||||
.send((
|
||||
scope_id,
|
||||
})
|
||||
WebGPURequest::CreateBindGroup {
|
||||
device_id: self.device.0,
|
||||
bind_group_id,
|
||||
descriptor: desc,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU BindGroup");
|
||||
|
||||
let bind_group = webgpu::WebGPUBindGroup(bind_group_id);
|
||||
|
@ -592,12 +598,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
let scope_id = self.use_current_scope();
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateShaderModule {
|
||||
device_id: self.device.0,
|
||||
.send((
|
||||
scope_id,
|
||||
program_id,
|
||||
program,
|
||||
})
|
||||
WebGPURequest::CreateShaderModule {
|
||||
device_id: self.device.0,
|
||||
program_id,
|
||||
program,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU ShaderModule");
|
||||
|
||||
let shader_module = webgpu::WebGPUShaderModule(program_id);
|
||||
|
@ -631,12 +639,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateComputePipeline {
|
||||
device_id: self.device.0,
|
||||
.send((
|
||||
scope_id,
|
||||
compute_pipeline_id,
|
||||
descriptor: desc,
|
||||
})
|
||||
WebGPURequest::CreateComputePipeline {
|
||||
device_id: self.device.0,
|
||||
compute_pipeline_id,
|
||||
descriptor: desc,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU ComputePipeline");
|
||||
|
||||
let compute_pipeline = webgpu::WebGPUComputePipeline(compute_pipeline_id);
|
||||
|
@ -660,12 +670,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
let scope_id = self.use_current_scope();
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateCommandEncoder {
|
||||
device_id: self.device.0,
|
||||
.send((
|
||||
scope_id,
|
||||
command_encoder_id,
|
||||
label: descriptor.parent.label.as_ref().map(|s| s.to_string()),
|
||||
})
|
||||
WebGPURequest::CreateCommandEncoder {
|
||||
device_id: self.device.0,
|
||||
command_encoder_id,
|
||||
label: descriptor.parent.label.as_ref().map(|s| s.to_string()),
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU command encoder");
|
||||
|
||||
let encoder = webgpu::WebGPUCommandEncoder(command_encoder_id);
|
||||
|
@ -710,12 +722,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateTexture {
|
||||
device_id: self.device.0,
|
||||
texture_id,
|
||||
descriptor: desc,
|
||||
.send((
|
||||
scope_id,
|
||||
})
|
||||
WebGPURequest::CreateTexture {
|
||||
device_id: self.device.0,
|
||||
texture_id,
|
||||
descriptor: desc,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU Texture");
|
||||
|
||||
let texture = webgpu::WebGPUTexture(texture_id);
|
||||
|
@ -761,12 +775,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
let scope_id = self.use_current_scope();
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateSampler {
|
||||
device_id: self.device.0,
|
||||
.send((
|
||||
scope_id,
|
||||
sampler_id,
|
||||
descriptor: desc,
|
||||
})
|
||||
WebGPURequest::CreateSampler {
|
||||
device_id: self.device.0,
|
||||
sampler_id,
|
||||
descriptor: desc,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU sampler");
|
||||
|
||||
let sampler = webgpu::WebGPUSampler(sampler_id);
|
||||
|
@ -903,12 +919,14 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateRenderPipeline {
|
||||
device_id: self.device.0,
|
||||
render_pipeline_id,
|
||||
.send((
|
||||
scope_id,
|
||||
descriptor: desc,
|
||||
})
|
||||
WebGPURequest::CreateRenderPipeline {
|
||||
device_id: self.device.0,
|
||||
render_pipeline_id,
|
||||
descriptor: desc,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU render pipeline");
|
||||
|
||||
let render_pipeline = webgpu::WebGPURenderPipeline(render_pipeline_id);
|
||||
|
@ -961,7 +979,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
fn PushErrorScope(&self, filter: GPUErrorFilter) {
|
||||
let mut context = self.scope_context.borrow_mut();
|
||||
let scope_id = context.next_scope_id;
|
||||
context.next_scope_id += 1;
|
||||
context.next_scope_id = ErrorScopeId::new(scope_id.get() + 1).unwrap();
|
||||
let err_scope = ErrorScopeInfo {
|
||||
op_count: 0,
|
||||
error: None,
|
||||
|
|
|
@ -88,11 +88,13 @@ impl GPUQueueMethods for GPUQueue {
|
|||
let command_buffers = command_buffers.iter().map(|cb| cb.id().0).collect();
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::Submit {
|
||||
queue_id: self.queue.0,
|
||||
.send((
|
||||
scope_id,
|
||||
command_buffers,
|
||||
})
|
||||
WebGPURequest::Submit {
|
||||
queue_id: self.queue.0,
|
||||
command_buffers,
|
||||
},
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
|
@ -124,13 +126,15 @@ impl GPUQueueMethods for GPUQueue {
|
|||
let final_data = IpcSharedMemory::from_bytes(
|
||||
&bytes[data_offset as usize..(data_offset + content_size) as usize],
|
||||
);
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::WriteBuffer {
|
||||
queue_id: self.queue.0,
|
||||
scope_id: self.device.borrow().as_ref().unwrap().use_current_scope(),
|
||||
buffer_id: buffer.id().0,
|
||||
buffer_offset,
|
||||
data: final_data,
|
||||
}) {
|
||||
if let Err(e) = self.channel.0.send((
|
||||
self.device.borrow().as_ref().unwrap().use_current_scope(),
|
||||
WebGPURequest::WriteBuffer {
|
||||
queue_id: self.queue.0,
|
||||
buffer_id: buffer.id().0,
|
||||
buffer_offset,
|
||||
data: final_data,
|
||||
},
|
||||
)) {
|
||||
warn!("Failed to send WriteBuffer({:?}) ({})", buffer.id(), e);
|
||||
return Err(Error::Operation);
|
||||
}
|
||||
|
@ -158,14 +162,16 @@ impl GPUQueueMethods for GPUQueue {
|
|||
let write_size = convert_texture_size_to_wgt(&convert_texture_size_to_dict(&size));
|
||||
let final_data = IpcSharedMemory::from_bytes(&bytes);
|
||||
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::WriteTexture {
|
||||
queue_id: self.queue.0,
|
||||
scope_id: self.device.borrow().as_ref().unwrap().use_current_scope(),
|
||||
texture_cv,
|
||||
data_layout: texture_layout,
|
||||
size: write_size,
|
||||
data: final_data,
|
||||
}) {
|
||||
if let Err(e) = self.channel.0.send((
|
||||
self.device.borrow().as_ref().unwrap().use_current_scope(),
|
||||
WebGPURequest::WriteTexture {
|
||||
queue_id: self.queue.0,
|
||||
texture_cv,
|
||||
data_layout: texture_layout,
|
||||
size: write_size,
|
||||
data: final_data,
|
||||
},
|
||||
)) {
|
||||
warn!(
|
||||
"Failed to send WriteTexture({:?}) ({})",
|
||||
destination.texture.id().0,
|
||||
|
|
|
@ -195,13 +195,15 @@ impl GPURenderBundleEncoderMethods for GPURenderBundleEncoder {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::RenderBundleEncoderFinish {
|
||||
render_bundle_encoder: encoder,
|
||||
descriptor: desc,
|
||||
render_bundle_id,
|
||||
device_id: self.device.id().0,
|
||||
scope_id: self.device.use_current_scope(),
|
||||
})
|
||||
.send((
|
||||
self.device.use_current_scope(),
|
||||
WebGPURequest::RenderBundleEncoderFinish {
|
||||
render_bundle_encoder: encoder,
|
||||
descriptor: desc,
|
||||
render_bundle_id,
|
||||
device_id: self.device.id().0,
|
||||
},
|
||||
))
|
||||
.expect("Failed to send RenderBundleEncoderFinish");
|
||||
|
||||
let render_bundle = WebGPURenderBundle(render_bundle_id);
|
||||
|
|
|
@ -163,12 +163,14 @@ impl GPURenderPassEncoderMethods for GPURenderPassEncoder {
|
|||
if let Some(render_pass) = self.render_pass.borrow_mut().take() {
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::RunRenderPass {
|
||||
command_encoder_id: self.command_encoder.id().0,
|
||||
device_id: self.command_encoder.device().id().0,
|
||||
scope_id: self.command_encoder.device().use_current_scope(),
|
||||
render_pass,
|
||||
})
|
||||
.send((
|
||||
self.command_encoder.device().use_current_scope(),
|
||||
WebGPURequest::RunRenderPass {
|
||||
command_encoder_id: self.command_encoder.id().0,
|
||||
device_id: self.command_encoder.device().id().0,
|
||||
render_pass,
|
||||
},
|
||||
))
|
||||
.expect("Failed to send RunRenderPass");
|
||||
|
||||
self.command_encoder.set_state(
|
||||
|
|
|
@ -57,10 +57,13 @@ impl GPUSwapChain {
|
|||
|
||||
impl GPUSwapChain {
|
||||
pub fn destroy(&self, external_id: u64, image_key: webrender_api::ImageKey) {
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::DestroySwapChain {
|
||||
external_id,
|
||||
image_key,
|
||||
}) {
|
||||
if let Err(e) = self.channel.0.send((
|
||||
None,
|
||||
WebGPURequest::DestroySwapChain {
|
||||
external_id,
|
||||
image_key,
|
||||
},
|
||||
)) {
|
||||
warn!(
|
||||
"Failed to send DestroySwapChain-ImageKey({:?}) ({})",
|
||||
image_key, e
|
||||
|
|
|
@ -167,13 +167,15 @@ impl GPUTextureMethods for GPUTexture {
|
|||
|
||||
self.channel
|
||||
.0
|
||||
.send(WebGPURequest::CreateTextureView {
|
||||
texture_id: self.texture.0,
|
||||
texture_view_id,
|
||||
device_id: self.device.id().0,
|
||||
descriptor: desc,
|
||||
.send((
|
||||
scope_id,
|
||||
})
|
||||
WebGPURequest::CreateTextureView {
|
||||
texture_id: self.texture.0,
|
||||
texture_view_id,
|
||||
device_id: self.device.id().0,
|
||||
descriptor: desc,
|
||||
},
|
||||
))
|
||||
.expect("Failed to create WebGPU texture view");
|
||||
|
||||
let texture_view = WebGPUTextureView(texture_view_id);
|
||||
|
@ -191,7 +193,7 @@ impl GPUTextureMethods for GPUTexture {
|
|||
if let Err(e) = self
|
||||
.channel
|
||||
.0
|
||||
.send(WebGPURequest::DestroyTexture(self.texture.0))
|
||||
.send((None, WebGPURequest::DestroyTexture(self.texture.0)))
|
||||
{
|
||||
warn!(
|
||||
"Failed to send WebGPURequest::DestroyTexture({:?}) ({})",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::{WebGPUDevice, WebGPURequest};
|
||||
use crate::{ErrorScopeId, WebGPUDevice, WebGPURequest};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -43,7 +43,7 @@ pub enum WebGPUMsg {
|
|||
FreeRenderBundle(RenderBundleId),
|
||||
WebGPUOpResult {
|
||||
device: WebGPUDevice,
|
||||
scope_id: Option<u64>,
|
||||
scope_id: Option<ErrorScopeId>,
|
||||
pipeline_id: PipelineId,
|
||||
result: WebGPUOpResult,
|
||||
},
|
||||
|
@ -57,12 +57,12 @@ pub enum WebGPUMsg {
|
|||
#[derive(Debug)]
|
||||
pub struct IdentityRecycler {
|
||||
sender: IpcSender<WebGPUMsg>,
|
||||
self_sender: IpcSender<WebGPURequest>,
|
||||
self_sender: IpcSender<(Option<ErrorScopeId>, WebGPURequest)>,
|
||||
}
|
||||
|
||||
pub struct IdentityRecyclerFactory {
|
||||
pub sender: IpcSender<WebGPUMsg>,
|
||||
pub self_sender: IpcSender<WebGPURequest>,
|
||||
pub self_sender: IpcSender<(Option<ErrorScopeId>, WebGPURequest)>,
|
||||
}
|
||||
|
||||
macro_rules! impl_identity_handler {
|
||||
|
@ -130,12 +130,14 @@ impl IdentityHandler<DeviceId> for IdentityRecycler {
|
|||
}
|
||||
fn free(&self, id: DeviceId) {
|
||||
log::debug!("free device {:?}", id);
|
||||
let msg = WebGPUMsg::FreeDevice(id);
|
||||
if self.sender.send(msg).is_err() {
|
||||
if self.sender.send(WebGPUMsg::FreeDevice(id)).is_err() {
|
||||
log::error!("Failed to send FreeDevice({:?}) to script", id);
|
||||
}
|
||||
let msg_to_self = WebGPURequest::FreeDevice(id);
|
||||
if self.self_sender.send(msg_to_self).is_err() {
|
||||
if self
|
||||
.self_sender
|
||||
.send((None, WebGPURequest::FreeDevice(id)))
|
||||
.is_err()
|
||||
{
|
||||
log::error!("Failed to send FreeDevice({:?}) to server", id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ use smallvec::SmallVec;
|
|||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::CString;
|
||||
use std::num::NonZeroU64;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
use std::slice;
|
||||
|
@ -41,6 +42,7 @@ use wgpu::{
|
|||
resource::{BufferMapAsyncStatus, BufferMapOperation},
|
||||
};
|
||||
|
||||
pub type ErrorScopeId = NonZeroU64;
|
||||
const DEVICE_POLL_INTERVAL: u64 = 100;
|
||||
pub const PRESENTATION_BUFFER_COUNT: usize = 10;
|
||||
|
||||
|
@ -68,7 +70,6 @@ pub enum WebGPURequest {
|
|||
sender: IpcSender<WebGPUResponseResult>,
|
||||
buffer_id: id::BufferId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
host_map: HostMap,
|
||||
map_range: std::ops::Range<u64>,
|
||||
},
|
||||
|
@ -76,14 +77,12 @@ pub enum WebGPURequest {
|
|||
CommandEncoderFinish {
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
// TODO(zakorgy): Serialize CommandBufferDescriptor in wgpu-core
|
||||
// wgpu::command::CommandBufferDescriptor,
|
||||
},
|
||||
CopyBufferToBuffer {
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
source_id: id::BufferId,
|
||||
source_offset: wgt::BufferAddress,
|
||||
destination_id: id::BufferId,
|
||||
|
@ -93,7 +92,6 @@ pub enum WebGPURequest {
|
|||
CopyBufferToTexture {
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
source: BufferCopyView,
|
||||
destination: TextureCopyView,
|
||||
copy_size: wgt::Extent3d,
|
||||
|
@ -101,7 +99,6 @@ pub enum WebGPURequest {
|
|||
CopyTextureToBuffer {
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
source: TextureCopyView,
|
||||
destination: BufferCopyView,
|
||||
copy_size: wgt::Extent3d,
|
||||
|
@ -109,33 +106,27 @@ pub enum WebGPURequest {
|
|||
CopyTextureToTexture {
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
source: TextureCopyView,
|
||||
destination: TextureCopyView,
|
||||
copy_size: wgt::Extent3d,
|
||||
},
|
||||
CreateBindGroup {
|
||||
device_id: id::DeviceId,
|
||||
// TODO: Consider using NonZeroU64 to reduce enum size
|
||||
scope_id: Option<u64>,
|
||||
bind_group_id: id::BindGroupId,
|
||||
descriptor: BindGroupDescriptor<'static>,
|
||||
},
|
||||
CreateBindGroupLayout {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
bind_group_layout_id: id::BindGroupLayoutId,
|
||||
descriptor: wgt::BindGroupLayoutDescriptor<'static>,
|
||||
},
|
||||
CreateBuffer {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
buffer_id: id::BufferId,
|
||||
descriptor: wgt::BufferDescriptor<Option<String>>,
|
||||
},
|
||||
CreateCommandEncoder {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
// TODO(zakorgy): Serialize CommandEncoderDescriptor in wgpu-core
|
||||
// wgpu::command::CommandEncoderDescriptor,
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
|
@ -143,32 +134,27 @@ pub enum WebGPURequest {
|
|||
},
|
||||
CreateComputePipeline {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
compute_pipeline_id: id::ComputePipelineId,
|
||||
descriptor: ComputePipelineDescriptor<'static>,
|
||||
},
|
||||
CreateContext(IpcSender<webrender_api::ExternalImageId>),
|
||||
CreatePipelineLayout {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
pipeline_layout_id: id::PipelineLayoutId,
|
||||
descriptor: wgt::PipelineLayoutDescriptor<'static, id::BindGroupLayoutId>,
|
||||
},
|
||||
CreateRenderPipeline {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
render_pipeline_id: id::RenderPipelineId,
|
||||
descriptor: RenderPipelineDescriptor<'static>,
|
||||
},
|
||||
CreateSampler {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
sampler_id: id::SamplerId,
|
||||
descriptor: wgt::SamplerDescriptor<Option<String>>,
|
||||
},
|
||||
CreateShaderModule {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
program_id: id::ShaderModuleId,
|
||||
program: Vec<u32>,
|
||||
},
|
||||
|
@ -182,7 +168,6 @@ pub enum WebGPURequest {
|
|||
},
|
||||
CreateTexture {
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
texture_id: id::TextureId,
|
||||
descriptor: wgt::TextureDescriptor<Option<String>>,
|
||||
},
|
||||
|
@ -190,7 +175,6 @@ pub enum WebGPURequest {
|
|||
texture_id: id::TextureId,
|
||||
texture_view_id: id::TextureViewId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
descriptor: wgt::TextureViewDescriptor<Option<String>>,
|
||||
},
|
||||
DestroyBuffer(id::BufferId),
|
||||
|
@ -206,7 +190,6 @@ pub enum WebGPURequest {
|
|||
descriptor: wgt::RenderBundleDescriptor<Option<String>>,
|
||||
render_bundle_id: id::RenderBundleId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
},
|
||||
RequestAdapter {
|
||||
sender: IpcSender<WebGPUResponseResult>,
|
||||
|
@ -224,18 +207,15 @@ pub enum WebGPURequest {
|
|||
RunComputePass {
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
compute_pass: ComputePass,
|
||||
},
|
||||
RunRenderPass {
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
render_pass: RenderPass,
|
||||
},
|
||||
Submit {
|
||||
queue_id: id::QueueId,
|
||||
scope_id: Option<u64>,
|
||||
command_buffers: Vec<id::CommandBufferId>,
|
||||
},
|
||||
SwapChainPresent {
|
||||
|
@ -246,7 +226,6 @@ pub enum WebGPURequest {
|
|||
UnmapBuffer {
|
||||
buffer_id: id::BufferId,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
array_buffer: IpcSharedMemory,
|
||||
is_map_read: bool,
|
||||
offset: u64,
|
||||
|
@ -259,14 +238,12 @@ pub enum WebGPURequest {
|
|||
},
|
||||
WriteBuffer {
|
||||
queue_id: id::QueueId,
|
||||
scope_id: Option<u64>,
|
||||
buffer_id: id::BufferId,
|
||||
buffer_offset: u64,
|
||||
data: IpcSharedMemory,
|
||||
},
|
||||
WriteTexture {
|
||||
queue_id: id::QueueId,
|
||||
scope_id: Option<u64>,
|
||||
texture_cv: TextureCopyView,
|
||||
data_layout: wgt::TextureDataLayout,
|
||||
size: wgt::Extent3d,
|
||||
|
@ -283,7 +260,7 @@ struct BufferMapInfo<'a, T> {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct WebGPU(pub IpcSender<WebGPURequest>);
|
||||
pub struct WebGPU(pub IpcSender<(Option<ErrorScopeId>, WebGPURequest)>);
|
||||
|
||||
impl WebGPU {
|
||||
pub fn new(
|
||||
|
@ -341,14 +318,14 @@ impl WebGPU {
|
|||
|
||||
pub fn exit(&self, sender: IpcSender<()>) -> Result<(), &'static str> {
|
||||
self.0
|
||||
.send(WebGPURequest::Exit(sender))
|
||||
.send((None, WebGPURequest::Exit(sender)))
|
||||
.map_err(|_| "Failed to send Exit message")
|
||||
}
|
||||
}
|
||||
|
||||
struct WGPU<'a> {
|
||||
receiver: IpcReceiver<WebGPURequest>,
|
||||
sender: IpcSender<WebGPURequest>,
|
||||
receiver: IpcReceiver<(Option<ErrorScopeId>, WebGPURequest)>,
|
||||
sender: IpcSender<(Option<ErrorScopeId>, WebGPURequest)>,
|
||||
script_sender: IpcSender<WebGPUMsg>,
|
||||
global: wgpu::hub::Global<IdentityRecyclerFactory>,
|
||||
adapters: Vec<WebGPUAdapter>,
|
||||
|
@ -358,7 +335,8 @@ struct WGPU<'a> {
|
|||
// Buffers with pending mapping
|
||||
buffer_maps: HashMap<id::BufferId, Rc<BufferMapInfo<'a, WebGPUResponseResult>>>,
|
||||
// Presentation Buffers with pending mapping
|
||||
present_buffer_maps: HashMap<id::BufferId, Rc<BufferMapInfo<'a, WebGPURequest>>>,
|
||||
present_buffer_maps:
|
||||
HashMap<id::BufferId, Rc<BufferMapInfo<'a, (Option<ErrorScopeId>, WebGPURequest)>>>,
|
||||
webrender_api: webrender_api::RenderApi,
|
||||
webrender_document: webrender_api::DocumentId,
|
||||
external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
|
||||
|
@ -368,8 +346,8 @@ struct WGPU<'a> {
|
|||
|
||||
impl<'a> WGPU<'a> {
|
||||
fn new(
|
||||
receiver: IpcReceiver<WebGPURequest>,
|
||||
sender: IpcSender<WebGPURequest>,
|
||||
receiver: IpcReceiver<(Option<ErrorScopeId>, WebGPURequest)>,
|
||||
sender: IpcSender<(Option<ErrorScopeId>, WebGPURequest)>,
|
||||
script_sender: IpcSender<WebGPUMsg>,
|
||||
webrender_api_sender: webrender_api::RenderApiSender,
|
||||
webrender_document: webrender_api::DocumentId,
|
||||
|
@ -404,13 +382,12 @@ impl<'a> WGPU<'a> {
|
|||
let _ = self.global.poll_all_devices(false);
|
||||
self.last_poll = Instant::now();
|
||||
}
|
||||
if let Ok(msg) = self.receiver.try_recv() {
|
||||
if let Ok((scope_id, msg)) = self.receiver.try_recv() {
|
||||
match msg {
|
||||
WebGPURequest::BufferMapAsync {
|
||||
sender,
|
||||
buffer_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
host_map,
|
||||
map_range,
|
||||
} => {
|
||||
|
@ -473,7 +450,6 @@ impl<'a> WGPU<'a> {
|
|||
WebGPURequest::CommandEncoderFinish {
|
||||
command_encoder_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
let result = gfx_select!(command_encoder_id => global.command_encoder_finish(
|
||||
|
@ -485,7 +461,6 @@ impl<'a> WGPU<'a> {
|
|||
WebGPURequest::CopyBufferToBuffer {
|
||||
command_encoder_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
source_id,
|
||||
source_offset,
|
||||
destination_id,
|
||||
|
@ -506,7 +481,6 @@ impl<'a> WGPU<'a> {
|
|||
WebGPURequest::CopyBufferToTexture {
|
||||
command_encoder_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
source,
|
||||
destination,
|
||||
copy_size,
|
||||
|
@ -523,7 +497,6 @@ impl<'a> WGPU<'a> {
|
|||
WebGPURequest::CopyTextureToBuffer {
|
||||
command_encoder_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
source,
|
||||
destination,
|
||||
copy_size,
|
||||
|
@ -540,7 +513,6 @@ impl<'a> WGPU<'a> {
|
|||
WebGPURequest::CopyTextureToTexture {
|
||||
command_encoder_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
source,
|
||||
destination,
|
||||
copy_size,
|
||||
|
@ -556,7 +528,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreateBindGroup {
|
||||
device_id,
|
||||
scope_id,
|
||||
bind_group_id,
|
||||
descriptor,
|
||||
} => {
|
||||
|
@ -567,7 +538,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreateBindGroupLayout {
|
||||
device_id,
|
||||
scope_id,
|
||||
bind_group_layout_id,
|
||||
descriptor,
|
||||
} => {
|
||||
|
@ -578,7 +548,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreateBuffer {
|
||||
device_id,
|
||||
scope_id,
|
||||
buffer_id,
|
||||
descriptor,
|
||||
} => {
|
||||
|
@ -597,7 +566,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreateCommandEncoder {
|
||||
device_id,
|
||||
scope_id,
|
||||
command_encoder_id,
|
||||
label,
|
||||
} => {
|
||||
|
@ -617,7 +585,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreateComputePipeline {
|
||||
device_id,
|
||||
scope_id,
|
||||
compute_pipeline_id,
|
||||
descriptor,
|
||||
} => {
|
||||
|
@ -638,7 +605,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreatePipelineLayout {
|
||||
device_id,
|
||||
scope_id,
|
||||
pipeline_layout_id,
|
||||
descriptor,
|
||||
} => {
|
||||
|
@ -650,7 +616,6 @@ impl<'a> WGPU<'a> {
|
|||
//TODO: consider https://github.com/gfx-rs/wgpu/issues/684
|
||||
WebGPURequest::CreateRenderPipeline {
|
||||
device_id,
|
||||
scope_id,
|
||||
render_pipeline_id,
|
||||
descriptor,
|
||||
} => {
|
||||
|
@ -661,7 +626,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreateSampler {
|
||||
device_id,
|
||||
scope_id,
|
||||
sampler_id,
|
||||
descriptor,
|
||||
} => {
|
||||
|
@ -683,7 +647,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreateShaderModule {
|
||||
device_id,
|
||||
scope_id,
|
||||
program_id,
|
||||
program,
|
||||
} => {
|
||||
|
@ -738,7 +701,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::CreateTexture {
|
||||
device_id,
|
||||
scope_id,
|
||||
texture_id,
|
||||
descriptor,
|
||||
} => {
|
||||
|
@ -762,7 +724,6 @@ impl<'a> WGPU<'a> {
|
|||
texture_id,
|
||||
texture_view_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
descriptor,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
|
@ -840,7 +801,6 @@ impl<'a> WGPU<'a> {
|
|||
descriptor,
|
||||
render_bundle_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
let st;
|
||||
|
@ -941,7 +901,6 @@ impl<'a> WGPU<'a> {
|
|||
WebGPURequest::RunComputePass {
|
||||
command_encoder_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
compute_pass,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
|
@ -954,7 +913,6 @@ impl<'a> WGPU<'a> {
|
|||
WebGPURequest::RunRenderPass {
|
||||
command_encoder_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
render_pass,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
|
@ -966,7 +924,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::Submit {
|
||||
queue_id,
|
||||
scope_id,
|
||||
command_buffers,
|
||||
} => {
|
||||
let global = &self.global;
|
||||
|
@ -1111,7 +1068,6 @@ impl<'a> WGPU<'a> {
|
|||
WebGPURequest::UnmapBuffer {
|
||||
buffer_id,
|
||||
device_id,
|
||||
scope_id,
|
||||
array_buffer,
|
||||
is_map_read,
|
||||
offset,
|
||||
|
@ -1166,7 +1122,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::WriteBuffer {
|
||||
queue_id,
|
||||
scope_id,
|
||||
buffer_id,
|
||||
buffer_offset,
|
||||
data,
|
||||
|
@ -1183,7 +1138,6 @@ impl<'a> WGPU<'a> {
|
|||
},
|
||||
WebGPURequest::WriteTexture {
|
||||
queue_id,
|
||||
scope_id,
|
||||
texture_cv,
|
||||
data_layout,
|
||||
size,
|
||||
|
@ -1208,7 +1162,7 @@ impl<'a> WGPU<'a> {
|
|||
fn send_result<U, T: std::fmt::Debug>(
|
||||
&self,
|
||||
device_id: id::DeviceId,
|
||||
scope_id: Option<u64>,
|
||||
scope_id: Option<ErrorScopeId>,
|
||||
result: Result<U, T>,
|
||||
) {
|
||||
let &pipeline_id = self.devices.get(&WebGPUDevice(device_id)).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue