1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-20 20:42:19 -05:00
This commit is contained in:
crowlkats 2025-01-13 14:17:44 +01:00
parent a8f02b8bb6
commit d4c6bf56c3
No known key found for this signature in database
GPG key ID: A82C9D461FC483E8
15 changed files with 346 additions and 279 deletions

View file

@ -12,4 +12,3 @@
deno_core = { path = "../deno_core/core" }
deno_ops = { path = "../deno_core/ops" }
serde_v8 = { path = "../deno_core/serde_v8" }
v8 = { path = "../rusty_v8" }

View file

@ -2,6 +2,7 @@
#![cfg(not(target_arch = "wasm32"))]
#![warn(unsafe_op_in_unsafe_fn)]
use deno_core::GarbageCollected;
pub use wgpu_core;
pub use wgpu_types;
@ -16,14 +17,41 @@ pub type Instance = std::sync::Arc<wgpu_core::global::Global>;
deno_core::extension!(
deno_webgpu,
deps = [deno_webidl, deno_web],
/*ops = [
// surface
surface::op_webgpu_surface_configure,
surface::op_webgpu_surface_get_current_texture,
surface::op_webgpu_surface_present,
// byow
byow::op_webgpu_surface_create,
],*/
esm = ["00_init.js" /* "02_surface.js"*/,],
ops = [wrap::create_gpu],
objects = [
wrap::GPU,
wrap::adapter::GPUAdapter,
wrap::adapter::GPUAdapterInfo,
wrap::bind_group::GPUBindGroup,
wrap::bind_group_layout::GPUBindGroupLayout,
wrap::buffer::GPUBuffer,
wrap::command_buffer::GPUCommandBuffer,
wrap::command_encoder::GPUCommandEncoder,
wrap::compute_pass::GPUComputePassEncoder,
wrap::compute_pipeline::GPUComputePipeline,
wrap::device::GPUDevice,
wrap::device::GPUDeviceLostInfo,
wrap::pipeline_layout::GPUPipelineLayout,
wrap::query_set::GPUQuerySet,
wrap::queue::GPUQueue,
wrap::render_bundle::GPURenderBundle,
wrap::render_bundle::GPURenderBundleEncoder,
wrap::render_pass::GPURenderPassEncoder,
wrap::render_pipeline::GPURenderPipeline,
wrap::sampler::GPUSampler,
wrap::shader::GPUShaderModule,
GPUSupportedFeatures,
wrap::adapter::GPUSupportedLimits,
wrap::texture::GPUTexture,
wrap::texture::GPUTextureView,
],
esm = ["00_init.js"],
lazy_loaded_esm = ["01_webgpu.js"],
);
struct GPUSupportedFeatures {}
impl GarbageCollected for GPUSupportedFeatures {}
#[deno_core::op2]
impl GPUSupportedFeatures {}

View file

@ -1,6 +1,7 @@
// Copyright 2018-2025 the Deno authors. MIT license.
use std::collections::HashSet;
use std::rc::Rc;
use std::sync::Arc;
use deno_core::cppgc::SameObject;
@ -47,7 +48,7 @@ pub struct GPUAdapter {
pub features: SameObject<GPUAdapter>,
pub limits: SameObject<GPUSupportedLimits>,
pub info: Arc<SameObject<GPUAdapterInfo>>,
pub info: Rc<SameObject<GPUAdapterInfo>>,
}
impl GarbageCollected for GPUAdapter {}
@ -71,18 +72,19 @@ impl GPUAdapter {
let features = features_to_feature_names(features);
/*
function createGPUSupportedFeatures(features) {
/** @type {GPUSupportedFeatures} */
const supportedFeatures = webidl.createBranded(GPUSupportedFeatures);
supportedFeatures[webidl.setlikeInner] = new SafeSet(features);
webidl.setlike(
supportedFeatures,
GPUSupportedFeaturesPrototype,
true,
);
return supportedFeatures;
}
*/
#[symbol("[[set]]")]
function createGPUSupportedFeatures(features) {
/** @type {GPUSupportedFeatures} */
const supportedFeatures = webidl.createBranded(GPUSupportedFeatures);
supportedFeatures[webidl.setlikeInner] = new SafeSet(features);
webidl.setlike(
supportedFeatures,
GPUSupportedFeaturesPrototype,
true,
);
return supportedFeatures;
}
*/
todo!()
})
@ -156,6 +158,7 @@ impl GPUAdapter {
adapter: self.id,
lost_receiver: receiver,
limits: SameObject::new(),
features: SameObject::new(),
})
}
}

View file

@ -1,7 +1,6 @@
// Copyright 2018-2025 the Deno authors. MIT license.
use std::cell::RefCell;
use std::ptr::NonNull;
use std::rc::Rc;
use std::time::Duration;
@ -12,6 +11,7 @@ use deno_core::webidl::WebIdlInterfaceConverter;
use deno_core::GarbageCollected;
use deno_core::WebIDL;
use deno_error::JsErrorBox;
use wgpu_core::device::HostMap as MapMode;
use wgpu_core::resource::BufferMapCallback;
use crate::Instance;
@ -55,9 +55,9 @@ pub struct GPUBuffer {
pub usage: u32,
pub map_state: RefCell<&'static str>,
pub map_mode: RefCell<Option<MapMode>>,
pub mapped_js_buffers:
RefCell<Vec<(NonNull<u8>, usize, Option<v8::Global<v8::Uint8Array>>)>>,
pub mapped_js_buffers: RefCell<Vec<v8::Global<v8::ArrayBuffer>>>,
}
impl WebIdlInterfaceConverter for GPUBuffer {
@ -152,6 +152,13 @@ impl GPUBuffer {
*self.map_state.borrow_mut() = "pending";
}
let mode = if read_mode {
MapMode::Read
} else {
assert!(write_mode);
MapMode::Write
};
let (sender, receiver) =
oneshot::channel::<wgpu_core::resource::BufferAccessResult>();
@ -168,12 +175,7 @@ impl GPUBuffer {
offset,
Some(range_size),
wgpu_core::resource::BufferMapOperation {
host: if read_mode {
wgpu_core::device::HostMap::Read
} else {
assert!(write_mode);
wgpu_core::device::HostMap::Write
},
host: mode,
callback: Some(BufferMapCallback::from_rust(callback)),
},
)
@ -216,17 +218,17 @@ impl GPUBuffer {
tokio::try_join!(device_poll_fut, receiver_fut)?;
*self.map_state.borrow_mut() = "mapped";
*self.map_mode.borrow_mut() = Some(mode);
Ok(())
}
#[buffer]
fn get_mapped_range(
fn get_mapped_range<'s>(
&self,
scope: &mut v8::HandleScope,
scope: &mut v8::HandleScope<'s>,
#[webidl/*(default = 0)*/] offset: u64,
#[webidl] size: Option<u64>,
) -> Result<Vec<u8>, BufferError> {
) -> Result<v8::Local<'s, v8::Uint8Array>, BufferError> {
let size = size.unwrap_or_else(|| self.size.saturating_sub(offset));
let (slice_pointer, range_size) = self
@ -234,34 +236,50 @@ impl GPUBuffer {
.buffer_get_mapped_range(self.id, offset, Some(size))
.map_err(BufferError::Access)?;
let slice = unsafe {
std::slice::from_raw_parts(slice_pointer.as_ptr(), range_size as usize)
let mode = self.map_mode.borrow();
let mode = mode.as_ref().unwrap();
let bs = if mode == &MapMode::Write {
unsafe extern "C" fn noop_deleter_callback(
_data: *mut std::ffi::c_void,
_byte_length: usize,
_deleter_data: *mut std::ffi::c_void,
) {
}
unsafe {
v8::ArrayBuffer::new_backing_store_from_ptr(
slice_pointer.as_ptr() as _,
range_size as usize,
noop_deleter_callback,
std::ptr::null_mut(),
)
}
} else {
let slice = unsafe {
std::slice::from_raw_parts(slice_pointer.as_ptr(), range_size as usize)
};
v8::ArrayBuffer::new_backing_store_from_vec(slice.to_vec())
};
let ab = v8::ArrayBuffer::new(scope, slice.len());
v8::Uint8Array::new(scope, ab, 0, slice.len());
// TODO: store buf
self
.mapped_js_buffers
.borrow_mut()
.push((slice_pointer, range_size as usize));
let shared_bs = bs.make_shared();
let ab = v8::ArrayBuffer::with_backing_store(scope, &shared_bs);
Ok(slice.to_vec())
if mode == &MapMode::Write {
self
.mapped_js_buffers
.borrow_mut()
.push(v8::Global::new(scope, ab));
}
Ok(v8::Uint8Array::new(scope, ab, 0, range_size as usize).unwrap())
}
#[nofast]
fn unmap(&self, scope: &mut v8::HandleScope) -> Result<(), BufferError> {
for (slice_pointer, range_size, buf) in
self.mapped_js_buffers.replace(vec![])
{
if let Some(buf) = buf {
let buf = buf.open(scope);
let slice = unsafe {
std::slice::from_raw_parts_mut(slice_pointer.as_ptr(), range_size)
};
buf.copy_contents(slice);
}
for ab in self.mapped_js_buffers.replace(vec![]) {
let ab = ab.open(scope);
ab.detach(None);
}
self

View file

@ -132,55 +132,70 @@ impl GPUComputePassEncoder {
) -> Result<(), WebIdlError> {
const PREFIX: &str =
"Failed to execute 'setBindGroup' on 'GPUComputePassEncoder'";
let offsets =
if let Ok(uint_32) = dynamic_offsets.try_cast::<v8::Uint32Array>() {
let start = u64::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 4")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?;
let len = u32::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 5")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?;
let err = if let Ok(uint_32) = dynamic_offsets.try_cast::<v8::Uint32Array>()
{
let start = u64::convert(
scope,
dynamic_offsets_data_start,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 4")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)? as usize;
let len = u32::convert(
scope,
dynamic_offsets_data_length,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 5")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)? as usize;
// TODO
let ab = uint_32.buffer(scope).unwrap();
let ptr = ab.data().unwrap();
let ab_len = ab.byte_length() / 4;
vec![]
} else {
<Option<Vec<u32>>>::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 3")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?
.unwrap_or_default()
};
let data =
unsafe { std::slice::from_raw_parts(ptr.as_ptr() as _, ab_len) };
let err = self
.instance
.compute_pass_set_bind_group(
&mut self.compute_pass.borrow_mut(),
index,
bind_group.into_option().map(|bind_group| bind_group.id),
&offsets,
)
.err();
let offsets = &data[start..(start + len)];
self
.instance
.compute_pass_set_bind_group(
&mut self.compute_pass.borrow_mut(),
index,
bind_group.into_option().map(|bind_group| bind_group.id),
offsets,
)
.err()
} else {
let offsets = <Option<Vec<u32>>>::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 3")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?
.unwrap_or_default();
self
.instance
.compute_pass_set_bind_group(
&mut self.compute_pass.borrow_mut(),
index,
bind_group.into_option().map(|bind_group| bind_group.id),
&offsets,
)
.err()
};
self.error_handler.push_error(err);

View file

@ -1,7 +1,7 @@
use std::borrow::Cow;
use std::cell::RefCell;
use std::num::NonZeroU64;
use std::sync::Arc;
use std::rc::Rc;
use deno_core::cppgc::SameObject;
use deno_core::op2;
@ -40,7 +40,7 @@ pub struct GPUDevice {
pub features: SameObject<GPUDevice>,
pub limits: SameObject<GPUSupportedLimits>,
pub adapter_info: Arc<SameObject<GPUAdapterInfo>>,
pub adapter_info: Rc<SameObject<GPUAdapterInfo>>,
pub queue_obj: SameObject<GPUQueue>,
@ -132,6 +132,7 @@ impl GPUDevice {
} else {
"unmapped"
}),
map_mode: RefCell::new(None),
mapped_js_buffers: RefCell::new(vec![]),
})
}
@ -517,7 +518,7 @@ impl GPUDevice {
GPURenderBundleEncoder {
instance: self.instance.clone(),
error_handler: self.error_handler.clone(),
encoder: RefCell::new(encoder),
encoder: RefCell::new(Some(encoder)),
label: descriptor.label,
}
}
@ -549,13 +550,14 @@ impl GPUDevice {
}
}
// TODO: return same promise
#[async_method]
#[getter]
#[cppgc]
async fn lost(&self) -> GPUDeviceLostInfo {
self.lost_receiver.await.unwrap();
// TODO: self.lost_receiver.await.unwrap();
GPUDeviceLostInfo {}
GPUDeviceLostInfo
}
#[required(1)]
@ -570,9 +572,9 @@ impl GPUDevice {
#[async_method]
async fn pop_error_scope<'a>(
&self,
scope: &mut v8::HandleScope<'a>,
//scope: &mut v8::HandleScope<'a>,
) -> Result<v8::Local<'a, v8::Value>, JsErrorBox> {
if self.error_handler.is_lost.get().is_some() {
/* if self.error_handler.is_lost.get().is_some() {
return Ok(v8::null(scope).into());
}
@ -587,7 +589,12 @@ impl GPUDevice {
Ok(deno_core::error::to_v8_error(scope, &err))
} else {
Ok(v8::null(scope).into())
}
}*/
Err(JsErrorBox::new(
"DOMExceptionOperationError",
"There are no error scopes on the error scope stack",
))
}
}
@ -808,7 +815,7 @@ impl GPUDevice {
}
}
pub struct GPUDeviceLostInfo {}
pub struct GPUDeviceLostInfo;
impl GarbageCollected for GPUDeviceLostInfo {}

View file

@ -105,7 +105,7 @@ pub enum GPUErrorFilter {
}
#[derive(Debug, deno_error::JsError)]
enum GPUError {
pub enum GPUError {
#[class("UNREACHABLE")] // TODO
Lost,
#[class("GPUValidationError")]

View file

@ -12,69 +12,34 @@ use wgpu_types::PowerPreference;
use crate::Instance;
mod adapter;
mod bind_group;
mod bind_group_layout;
mod buffer;
mod command_buffer;
mod command_encoder;
mod compute_pass;
mod compute_pipeline;
mod device;
mod error;
mod pipeline_layout;
mod query_set;
mod queue;
mod render_bundle;
mod render_pass;
mod render_pipeline;
mod sampler;
mod shader;
mod texture;
mod webidl;
deno_core::extension!(
deno_webgpu,
deps = [deno_webidl, deno_web],
ops = [create_gpu],
objects = [
GPU,
adapter::GPUAdapter,
adapter::GPUAdapterInfo,
bind_group::GPUBindGroup,
bind_group_layout::GPUBindGroupLayout,
buffer::GPUBuffer,
command_buffer::GPUCommandBuffer,
command_encoder::GPUCommandEncoder,
compute_pass::GPUComputePassEncoder,
compute_pipeline::GPUComputePipeline,
device::GPUDevice,
device::GPUDeviceLostInfo,
pipeline_layout::GPUPipelineLayout,
query_set::GPUQuerySet,
queue::GPUQueue,
render_bundle::GPURenderBundle,
render_bundle::GPURenderBundleEncoder,
render_pass::GPURenderPassEncoder,
render_pipeline::GPURenderPipeline,
sampler::GPUSampler,
shader::GPUShaderModule,
//adapter::GPUSupportedFeatures,
adapter::GPUSupportedLimits,
texture::GPUTexture,
texture::GPUTextureView,
],
esm = ["00_init.js", "02_surface.js"],
lazy_loaded_esm = ["01_webgpu.js"],
);
pub mod adapter;
pub mod bind_group;
pub mod bind_group_layout;
pub mod buffer;
pub mod command_buffer;
pub mod command_encoder;
pub mod compute_pass;
pub mod compute_pipeline;
pub mod device;
pub mod error;
pub mod pipeline_layout;
pub mod query_set;
pub mod queue;
pub mod render_bundle;
pub mod render_pass;
pub mod render_pipeline;
pub mod sampler;
pub mod shader;
pub mod texture;
pub mod webidl;
#[op2]
#[cppgc]
fn create_gpu() -> GPU {
pub fn create_gpu() -> GPU {
GPU
}
struct GPU;
pub struct GPU;
impl GarbageCollected for GPU {}
@ -127,7 +92,7 @@ impl GPU {
instance: instance.clone(),
features: SameObject::new(),
limits: SameObject::new(),
info: Arc::new(SameObject::new()),
info: Rc::new(SameObject::new()),
id,
})
}
@ -158,5 +123,3 @@ macro_rules! with_label {
}
};
}
pub use with_label;

View file

@ -54,13 +54,15 @@ impl GPUQueue {
&self,
#[webidl] buffer: Ptr<GPUBuffer>,
#[webidl/*(options(enforce_range = true))*/] buffer_offset: u64,
#[serde] data: (), // TODO: AllowSharedBufferSource
#[anybuffer] buf: &[u8], // TODO: AllowSharedBufferSource
#[webidl/*(default = 0, options(enforce_range = true))*/] data_offset: u64,
#[webidl/*(options(enforce_range = true))*/] size: Option<u64>,
) {
let data = match size {
Some(size) => &buf[data_offset..(data_offset + size)],
None => &buf[data_offset..],
Some(size) => {
&buf[(data_offset as usize)..((data_offset + size) as usize)]
}
None => &buf[(data_offset as usize)..],
};
let err = self
@ -75,7 +77,7 @@ impl GPUQueue {
fn write_texture(
&self,
#[webidl] destination: GPUTexelCopyTextureInfo,
#[serde] data: (), // TODO: AllowSharedBufferSource
#[anybuffer] buf: &[u8], // TODO: AllowSharedBufferSource
#[webidl] data_layout: GPUTexelCopyBufferLayout,
#[webidl] size: GPUExtent3D,
) {

View file

@ -116,62 +116,77 @@ impl GPURenderBundleEncoder {
dynamic_offsets_data_start: v8::Local<'a, v8::Value>,
dynamic_offsets_data_length: v8::Local<'a, v8::Value>,
) -> Result<(), SetBindGroupError> {
const PREFIX: &str =
"Failed to execute 'setBindGroup' on 'GPUComputePassEncoder'";
let offsets =
if let Ok(uint_32) = dynamic_offsets.try_cast::<v8::Uint32Array>() {
let start = u64::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 4")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?;
let len = u32::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 5")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?;
// TODO
vec![]
} else {
<Option<Vec<u32>>>::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 3")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?
.unwrap_or_default()
};
let mut encoder = self.encoder.borrow_mut();
let encoder = encoder.as_mut().ok_or_else(|| {
JsErrorBox::generic("Encoder has already been finished")
})?;
unsafe {
wgpu_core::command::bundle_ffi::wgpu_render_bundle_set_bind_group(
encoder,
index,
bind_group.into_option().map(|bind_group| bind_group.id),
offsets.as_ptr(),
offsets.len(),
);
const PREFIX: &str =
"Failed to execute 'setBindGroup' on 'GPUComputePassEncoder'";
if let Ok(uint_32) = dynamic_offsets.try_cast::<v8::Uint32Array>() {
let start = u64::convert(
scope,
dynamic_offsets_data_start,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 4")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)? as usize;
let len = u32::convert(
scope,
dynamic_offsets_data_length,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 5")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)? as usize;
let ab = uint_32.buffer(scope).unwrap();
let ptr = ab.data().unwrap();
let ab_len = ab.byte_length() / 4;
let data =
unsafe { std::slice::from_raw_parts(ptr.as_ptr() as _, ab_len) };
let offsets = &data[start..(start + len)];
unsafe {
wgpu_core::command::bundle_ffi::wgpu_render_bundle_set_bind_group(
encoder,
index,
bind_group.into_option().map(|bind_group| bind_group.id),
offsets.as_ptr(),
offsets.len(),
);
}
} else {
let offsets = <Option<Vec<u32>>>::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 3")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?
.unwrap_or_default();
unsafe {
wgpu_core::command::bundle_ffi::wgpu_render_bundle_set_bind_group(
encoder,
index,
bind_group.into_option().map(|bind_group| bind_group.id),
offsets.as_ptr(),
offsets.len(),
);
}
}
Ok(())
}

View file

@ -199,55 +199,72 @@ impl GPURenderPassEncoder {
) -> Result<(), WebIdlError> {
const PREFIX: &str =
"Failed to execute 'setBindGroup' on 'GPUComputePassEncoder'";
let offsets =
if let Ok(uint_32) = dynamic_offsets.try_cast::<v8::Uint32Array>() {
let start = u64::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 4")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?;
let len = u32::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 5")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?;
// TODO
let err = if let Ok(uint_32) = dynamic_offsets.try_cast::<v8::Uint32Array>()
{
let start = u64::convert(
scope,
dynamic_offsets_data_start,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 4")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)? as usize;
let len = u32::convert(
scope,
dynamic_offsets_data_length,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 5")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)? as usize;
vec![]
} else {
<Option<Vec<u32>>>::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 3")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?
.unwrap_or_default()
};
let ab = uint_32.buffer(scope).unwrap();
let ptr = ab.data().unwrap();
let ab_len = ab.byte_length() / 4;
let data =
unsafe { std::slice::from_raw_parts(ptr.as_ptr() as _, ab_len) };
let offsets = &data[start..(start + len)];
self
.instance
.render_pass_set_bind_group(
&mut self.render_pass.borrow_mut(),
index,
bind_group.into_option().map(|bind_group| bind_group.id),
offsets,
)
.err()
} else {
let offsets = <Option<Vec<u32>>>::convert(
scope,
dynamic_offsets,
Cow::Borrowed(PREFIX),
(|| Cow::Borrowed("Argument 3")).into(),
&IntOptions {
clamp: false,
enforce_range: true,
},
)?
.unwrap_or_default();
self
.instance
.render_pass_set_bind_group(
&mut self.render_pass.borrow_mut(),
index,
bind_group.into_option().map(|bind_group| bind_group.id),
&offsets,
)
.err()
};
let err = self
.instance
.render_pass_set_bind_group(
&mut self.render_pass.borrow_mut(),
index,
bind_group.into_option().map(|bind_group| bind_group.id),
&offsets,
)
.err();
self.error_handler.push_error(err);
Ok(())

View file

@ -38,6 +38,7 @@ const {
MathRound,
MathTrunc,
Number,
SymbolFor,
NumberIsFinite,
NumberIsNaN,
NumberMAX_SAFE_INTEGER,
@ -1311,7 +1312,7 @@ function configureProperties(obj) {
}
}
const setlikeInner = Symbol("[[set]]");
const setlikeInner = SymbolFor("[[set]]");
// Ref: https://webidl.spec.whatwg.org/#es-setlike
function setlike(obj, objPrototype, readonly) {

View file

@ -28,7 +28,7 @@ import * as signals from "ext:runtime/40_signals.js";
import * as tty from "ext:runtime/40_tty.js";
import * as kv from "ext:deno_kv/01_db.ts";
import * as cron from "ext:deno_cron/01_cron.ts";
import * as webgpuSurface from "ext:deno_webgpu/02_surface.js";
//import * as webgpuSurface from "ext:deno_webgpu/02_surface.js";
import * as telemetry from "ext:deno_telemetry/telemetry.ts";
const { ObjectDefineProperties } = primordials;
@ -203,7 +203,7 @@ ObjectDefineProperties(denoNsUnstableById[unstableIds.net], {
// denoNsUnstableById[unstableIds.unsafeProto] = { __proto__: null }
denoNsUnstableById[unstableIds.webgpu] = {
UnsafeWindowSurface: webgpuSurface.UnsafeWindowSurface,
//UnsafeWindowSurface: webgpuSurface.UnsafeWindowSurface,
};
// denoNsUnstableById[unstableIds.workerOptions] = { __proto__: null }

View file

@ -35,7 +35,7 @@ import process from "node:process";
import { Buffer } from "node:buffer";
import { clearImmediate, setImmediate } from "node:timers";
import { loadWebGPU } from "ext:deno_webgpu/00_init.js";
import * as webgpuSurface from "ext:deno_webgpu/02_surface.js";
//import * as webgpuSurface from "ext:deno_webgpu/02_surface.js";
import { unstableIds } from "ext:runtime/90_deno_ns.js";
const loadImage = core.createLazyLoader("ext:deno_canvas/01_image.js");
@ -164,7 +164,7 @@ const windowOrWorkerGlobalScope = {
(webgpu) => webgpu.GPUBufferUsage,
loadWebGPU,
),
GPUCanvasContext: core.propNonEnumerable(webgpuSurface.GPUCanvasContext),
//GPUCanvasContext: core.propNonEnumerable(webgpuSurface.GPUCanvasContext),
GPUColorWrite: core.propNonEnumerableLazyLoaded(
(webgpu) => webgpu.GPUColorWrite,
loadWebGPU,

View file

@ -17,7 +17,6 @@ import * as console from "ext:deno_console/01_console.js";
import * as webidl from "ext:deno_webidl/00_webidl.js";
import * as globalInterfaces from "ext:deno_web/04_global_interfaces.js";
import { loadWebGPU } from "ext:deno_webgpu/00_init.js";
import { initGPU } from "../../ext/webgpu/01_webgpu";
function memoizeLazy(f) {
let v_ = null;