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 deno_webgpu/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ impl GPUBuffer {
*self.map_state.borrow()
}

// In the successful case, the promise should resolve to undefined, but
// `#[undefined]` does not seem to work here.
// https://github.com/denoland/deno/issues/29603
#[async_method]
async fn map_async(
&self,
Expand Down Expand Up @@ -250,6 +253,7 @@ impl GPUBuffer {
}

#[nofast]
#[undefined]
fn unmap(&self, scope: &mut v8::HandleScope) -> Result<(), BufferError> {
for ab in self.mapped_js_buffers.replace(vec![]) {
let ab = ab.open(scope);
Expand All @@ -267,6 +271,7 @@ impl GPUBuffer {
}

#[fast]
#[undefined]
fn destroy(&self) {
self.instance.buffer_destroy(self.id);
}
Expand Down
6 changes: 6 additions & 0 deletions deno_webgpu/command_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ impl GPUCommandEncoder {
}

#[required(2)]
#[undefined]
fn copy_buffer_to_buffer<'a>(
&self,
scope: &mut v8::HandleScope<'a>,
Expand Down Expand Up @@ -280,6 +281,7 @@ impl GPUCommandEncoder {
}

#[required(3)]
#[undefined]
fn copy_buffer_to_texture(
&self,
#[webidl] source: GPUTexelCopyBufferInfo,
Expand Down Expand Up @@ -315,6 +317,7 @@ impl GPUCommandEncoder {
}

#[required(3)]
#[undefined]
fn copy_texture_to_buffer(
&self,
#[webidl] source: GPUTexelCopyTextureInfo,
Expand Down Expand Up @@ -350,6 +353,7 @@ impl GPUCommandEncoder {
}

#[required(3)]
#[undefined]
fn copy_texture_to_texture(
&self,
#[webidl] source: GPUTexelCopyTextureInfo,
Expand Down Expand Up @@ -383,6 +387,7 @@ impl GPUCommandEncoder {
}

#[required(1)]
#[undefined]
fn clear_buffer(
&self,
#[webidl] buffer: Ptr<GPUBuffer>,
Expand All @@ -397,6 +402,7 @@ impl GPUCommandEncoder {
}

#[required(5)]
#[undefined]
fn resolve_query_set(
&self,
#[webidl] query_set: Ptr<super::query_set::GPUQuerySet>,
Expand Down
8 changes: 8 additions & 0 deletions deno_webgpu/compute_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl GPUComputePassEncoder {
// TODO(@crowlKats): no-op, needs wpgu to implement changing the label
}

#[undefined]
fn set_pipeline(
&self,
#[webidl] pipeline: Ptr<crate::compute_pipeline::GPUComputePipeline>,
Expand All @@ -63,6 +64,7 @@ impl GPUComputePassEncoder {
self.error_handler.push_error(err);
}

#[undefined]
fn dispatch_workgroups(
&self,
#[webidl(options(enforce_range = true))] work_group_count_x: u32,
Expand All @@ -83,6 +85,7 @@ impl GPUComputePassEncoder {
self.error_handler.push_error(err);
}

#[undefined]
fn dispatch_workgroups_indirect(
&self,
#[webidl] indirect_buffer: Ptr<crate::buffer::GPUBuffer>,
Expand All @@ -100,6 +103,7 @@ impl GPUComputePassEncoder {
}

#[fast]
#[undefined]
fn end(&self) {
let err = self
.instance
Expand All @@ -108,6 +112,7 @@ impl GPUComputePassEncoder {
self.error_handler.push_error(err);
}

#[undefined]
fn push_debug_group(&self, #[webidl] group_label: String) {
let err = self
.instance
Expand All @@ -121,6 +126,7 @@ impl GPUComputePassEncoder {
}

#[fast]
#[undefined]
fn pop_debug_group(&self) {
let err = self
.instance
Expand All @@ -129,6 +135,7 @@ impl GPUComputePassEncoder {
self.error_handler.push_error(err);
}

#[undefined]
fn insert_debug_marker(&self, #[webidl] marker_label: String) {
let err = self
.instance
Expand All @@ -141,6 +148,7 @@ impl GPUComputePassEncoder {
self.error_handler.push_error(err);
}

#[undefined]
fn set_bind_group<'a>(
&self,
scope: &mut v8::HandleScope<'a>,
Expand Down
2 changes: 2 additions & 0 deletions deno_webgpu/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ impl GPUDevice {
}

#[fast]
#[undefined]
fn destroy(&self) {
self.instance.device_destroy(self.id);
self
Expand Down Expand Up @@ -623,6 +624,7 @@ impl GPUDevice {
}

#[required(1)]
#[undefined]
fn push_error_scope(&self, #[webidl] filter: super::error::GPUErrorFilter) {
self
.error_handler
Expand Down
1 change: 1 addition & 0 deletions deno_webgpu/query_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl GPUQuerySet {
}

#[fast]
#[undefined]
fn destroy(&self) -> Result<(), JsErrorBox> {
// TODO(https://github.com/gfx-rs/wgpu/issues/6495): Destroy the query
// set. Until that is supported, it is okay to do nothing here, the
Expand Down
12 changes: 8 additions & 4 deletions deno_webgpu/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::time::Duration;
use deno_core::cppgc::Ptr;
use deno_core::futures::channel::oneshot;
use deno_core::op2;
use deno_core::v8;
use deno_core::GarbageCollected;
use deno_core::WebIDL;
use deno_error::JsErrorBox;
Expand Down Expand Up @@ -63,11 +62,11 @@ impl GPUQueue {
}

#[required(1)]
#[undefined]
fn submit(
&self,
scope: &mut v8::HandleScope,
#[webidl] command_buffers: Vec<Ptr<GPUCommandBuffer>>,
) -> Result<v8::Local<v8::Value>, JsErrorBox> {
) -> Result<(), JsErrorBox> {
let ids = command_buffers
.into_iter()
.map(|cb| cb.id)
Expand All @@ -79,9 +78,12 @@ impl GPUQueue {
self.error_handler.push_error(Some(err));
}

Ok(v8::undefined(scope).into())
Ok(())
}

// In the successful case, the promise should resolve to undefined, but
// `#[undefined]` does not seem to work here.
// https://github.com/denoland/deno/issues/29603
#[async_method]
async fn on_submitted_work_done(&self) -> Result<(), JsErrorBox> {
let (sender, receiver) = oneshot::channel::<()>();
Expand Down Expand Up @@ -124,6 +126,7 @@ impl GPUQueue {
}

#[required(3)]
#[undefined]
fn write_buffer(
&self,
#[webidl] buffer: Ptr<GPUBuffer>,
Expand All @@ -148,6 +151,7 @@ impl GPUQueue {
}

#[required(4)]
#[undefined]
fn write_texture(
&self,
#[webidl] destination: GPUTexelCopyTextureInfo,
Expand Down
11 changes: 11 additions & 0 deletions deno_webgpu/render_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ impl GPURenderBundleEncoder {
}
}

#[undefined]
fn push_debug_group(
&self,
#[webidl] group_label: String,
Expand All @@ -110,6 +111,7 @@ impl GPURenderBundleEncoder {
}

#[fast]
#[undefined]
fn pop_debug_group(&self) -> Result<(), JsErrorBox> {
let mut encoder = self.encoder.borrow_mut();
let encoder = encoder.as_mut().ok_or_else(|| {
Expand All @@ -119,6 +121,7 @@ impl GPURenderBundleEncoder {
Ok(())
}

#[undefined]
fn insert_debug_marker(
&self,
#[webidl] marker_label: String,
Expand All @@ -140,6 +143,7 @@ impl GPURenderBundleEncoder {
Ok(())
}

#[undefined]
fn set_bind_group<'a>(
&self,
scope: &mut v8::HandleScope<'a>,
Expand Down Expand Up @@ -226,6 +230,7 @@ impl GPURenderBundleEncoder {
Ok(())
}

#[undefined]
fn set_pipeline(
&self,
#[webidl] pipeline: Ptr<crate::render_pipeline::GPURenderPipeline>,
Expand All @@ -243,6 +248,7 @@ impl GPURenderBundleEncoder {
}

#[required(2)]
#[undefined]
fn set_index_buffer(
&self,
#[webidl] buffer: Ptr<GPUBuffer>,
Expand All @@ -265,6 +271,7 @@ impl GPURenderBundleEncoder {
}

#[required(2)]
#[undefined]
fn set_vertex_buffer(
&self,
#[webidl(options(enforce_range = true))] slot: u32,
Expand All @@ -288,6 +295,7 @@ impl GPURenderBundleEncoder {
}

#[required(1)]
#[undefined]
fn draw(
&self,
#[webidl(options(enforce_range = true))] vertex_count: u32,
Expand All @@ -311,6 +319,7 @@ impl GPURenderBundleEncoder {
}

#[required(1)]
#[undefined]
fn draw_indexed(
&self,
#[webidl(options(enforce_range = true))] index_count: u32,
Expand All @@ -336,6 +345,7 @@ impl GPURenderBundleEncoder {
}

#[required(2)]
#[undefined]
fn draw_indirect(
&self,
#[webidl] indirect_buffer: Ptr<GPUBuffer>,
Expand All @@ -355,6 +365,7 @@ impl GPURenderBundleEncoder {
}

#[required(2)]
#[undefined]
fn draw_indexed_indirect(
&self,
#[webidl] indirect_buffer: Ptr<GPUBuffer>,
Expand Down
Loading
Loading