mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #27661 - kunalmohan:update-webgpu, r=kvark
WebGPU: Use GPULimits and extensions provided by user <!-- Please describe your changes on the following line: --> - update wgpu - spec update r?@kvark --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
3c34da1c91
19 changed files with 9938 additions and 80 deletions
29
Cargo.lock
generated
29
Cargo.lock
generated
|
@ -1570,6 +1570,12 @@ version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
|
checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fixedbitset"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.0.17"
|
version = "1.0.17"
|
||||||
|
@ -3760,13 +3766,13 @@ checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/gfx-rs/naga?rev=b278e10ea7c144b2387585c4e81c1d86db8e2def#b278e10ea7c144b2387585c4e81c1d86db8e2def"
|
||||||
checksum = "0873deb76cf44b7454fba7b2ba6a89d3de70c08aceffd2c489379b3d9d08e661"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"log",
|
"log",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"petgraph 0.5.1",
|
||||||
"spirv_headers",
|
"spirv_headers",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
@ -4303,10 +4309,20 @@ version = "0.4.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
|
checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fixedbitset",
|
"fixedbitset 0.1.9",
|
||||||
"ordermap",
|
"ordermap",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "petgraph"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
|
||||||
|
dependencies = [
|
||||||
|
"fixedbitset 0.2.0",
|
||||||
|
"indexmap",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf"
|
name = "phf"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
|
@ -5280,7 +5296,7 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"num-complex",
|
"num-complex",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"petgraph",
|
"petgraph 0.4.13",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"servo-media-player",
|
"servo-media-player",
|
||||||
|
@ -7028,10 +7044,11 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-core"
|
name = "wgpu-core"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
source = "git+https://github.com/gfx-rs/wgpu#59f0996eabd43e882d4bfc73ee5b4ed912617abf"
|
source = "git+https://github.com/gfx-rs/wgpu#e72724a6e393503c73f37e86aa9317a5c62e32b8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec 0.5.1",
|
"arrayvec 0.5.1",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"cfg_aliases",
|
||||||
"copyless",
|
"copyless",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"gfx-backend-dx11",
|
"gfx-backend-dx11",
|
||||||
|
@ -7055,7 +7072,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-types"
|
name = "wgpu-types"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
source = "git+https://github.com/gfx-rs/wgpu#59f0996eabd43e882d4bfc73ee5b4ed912617abf"
|
source = "git+https://github.com/gfx-rs/wgpu#e72724a6e393503c73f37e86aa9317a5c62e32b8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::GPUAdapterBinding::{
|
use crate::dom::bindings::codegen::Bindings::GPUAdapterBinding::{
|
||||||
GPUAdapterMethods, GPUDeviceDescriptor,
|
GPUAdapterMethods, GPUDeviceDescriptor, GPUExtensionName, GPULimits,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::Error;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||||
|
@ -80,10 +80,39 @@ impl GPUAdapterMethods for GPUAdapter {
|
||||||
fn RequestDevice(&self, descriptor: &GPUDeviceDescriptor, comp: InRealm) -> Rc<Promise> {
|
fn RequestDevice(&self, descriptor: &GPUDeviceDescriptor, comp: InRealm) -> Rc<Promise> {
|
||||||
let promise = Promise::new_in_current_realm(&self.global(), comp);
|
let promise = Promise::new_in_current_realm(&self.global(), comp);
|
||||||
let sender = response_async(&promise, self);
|
let sender = response_async(&promise, self);
|
||||||
|
let mut features = wgt::Features::empty();
|
||||||
|
for &ext in descriptor.extensions.iter() {
|
||||||
|
if ext == GPUExtensionName::Depth_clamping {
|
||||||
|
features.insert(wgt::Features::DEPTH_CLAMPING);
|
||||||
|
} else if ext == GPUExtensionName::Texture_compression_bc {
|
||||||
|
features.insert(wgt::Features::TEXTURE_COMPRESSION_BC)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let desc = wgt::DeviceDescriptor {
|
let desc = wgt::DeviceDescriptor {
|
||||||
features: wgt::Features::empty(),
|
features,
|
||||||
limits: wgt::Limits {
|
limits: wgt::Limits {
|
||||||
max_bind_groups: descriptor.limits.maxBindGroups,
|
max_bind_groups: descriptor.limits.maxBindGroups,
|
||||||
|
max_dynamic_uniform_buffers_per_pipeline_layout: descriptor
|
||||||
|
.limits
|
||||||
|
.maxDynamicUniformBuffersPerPipelineLayout,
|
||||||
|
max_dynamic_storage_buffers_per_pipeline_layout: descriptor
|
||||||
|
.limits
|
||||||
|
.maxDynamicStorageBuffersPerPipelineLayout,
|
||||||
|
max_sampled_textures_per_shader_stage: descriptor
|
||||||
|
.limits
|
||||||
|
.maxSampledTexturesPerShaderStage,
|
||||||
|
max_samplers_per_shader_stage: descriptor.limits.maxSamplersPerShaderStage,
|
||||||
|
max_storage_buffers_per_shader_stage: descriptor
|
||||||
|
.limits
|
||||||
|
.maxStorageBuffersPerShaderStage,
|
||||||
|
max_storage_textures_per_shader_stage: descriptor
|
||||||
|
.limits
|
||||||
|
.maxStorageTexturesPerShaderStage,
|
||||||
|
max_uniform_buffers_per_shader_stage: descriptor
|
||||||
|
.limits
|
||||||
|
.maxUniformBuffersPerShaderStage,
|
||||||
|
max_uniform_buffer_binding_size: descriptor.limits.maxUniformBufferBindingSize,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
shader_validation: true,
|
shader_validation: true,
|
||||||
|
@ -122,15 +151,38 @@ impl AsyncWGPUListener for GPUAdapter {
|
||||||
Ok(WebGPUResponse::RequestDevice {
|
Ok(WebGPUResponse::RequestDevice {
|
||||||
device_id,
|
device_id,
|
||||||
queue_id,
|
queue_id,
|
||||||
_descriptor,
|
descriptor,
|
||||||
label,
|
label,
|
||||||
}) => {
|
}) => {
|
||||||
|
let limits = GPULimits {
|
||||||
|
maxBindGroups: descriptor.limits.max_bind_groups,
|
||||||
|
maxDynamicStorageBuffersPerPipelineLayout: descriptor
|
||||||
|
.limits
|
||||||
|
.max_dynamic_storage_buffers_per_pipeline_layout,
|
||||||
|
maxDynamicUniformBuffersPerPipelineLayout: descriptor
|
||||||
|
.limits
|
||||||
|
.max_dynamic_uniform_buffers_per_pipeline_layout,
|
||||||
|
maxSampledTexturesPerShaderStage: descriptor
|
||||||
|
.limits
|
||||||
|
.max_sampled_textures_per_shader_stage,
|
||||||
|
maxSamplersPerShaderStage: descriptor.limits.max_samplers_per_shader_stage,
|
||||||
|
maxStorageBuffersPerShaderStage: descriptor
|
||||||
|
.limits
|
||||||
|
.max_storage_buffers_per_shader_stage,
|
||||||
|
maxStorageTexturesPerShaderStage: descriptor
|
||||||
|
.limits
|
||||||
|
.max_storage_textures_per_shader_stage,
|
||||||
|
maxUniformBufferBindingSize: descriptor.limits.max_uniform_buffer_binding_size,
|
||||||
|
maxUniformBuffersPerShaderStage: descriptor
|
||||||
|
.limits
|
||||||
|
.max_uniform_buffers_per_shader_stage,
|
||||||
|
};
|
||||||
let device = GPUDevice::new(
|
let device = GPUDevice::new(
|
||||||
&self.global(),
|
&self.global(),
|
||||||
self.channel.clone(),
|
self.channel.clone(),
|
||||||
&self,
|
&self,
|
||||||
Heap::default(),
|
Heap::default(),
|
||||||
Heap::default(),
|
limits,
|
||||||
device_id,
|
device_id,
|
||||||
queue_id,
|
queue_id,
|
||||||
label,
|
label,
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::GPUAdapterBinding::GPULimits;
|
|
||||||
use crate::dom::bindings::codegen::Bindings::GPUComputePipelineBinding::GPUComputePipelineMethods;
|
use crate::dom::bindings::codegen::Bindings::GPUComputePipelineBinding::GPUComputePipelineMethods;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::USVString;
|
use crate::dom::bindings::str::USVString;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
|
use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
|
||||||
|
use crate::dom::gpudevice::GPUDevice;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use webgpu::{WebGPUBindGroupLayout, WebGPUComputePipeline};
|
use webgpu::{WebGPUBindGroupLayout, WebGPUComputePipeline};
|
||||||
|
@ -21,6 +21,7 @@ pub struct GPUComputePipeline {
|
||||||
label: DomRefCell<Option<USVString>>,
|
label: DomRefCell<Option<USVString>>,
|
||||||
compute_pipeline: WebGPUComputePipeline,
|
compute_pipeline: WebGPUComputePipeline,
|
||||||
bind_group_layouts: Vec<WebGPUBindGroupLayout>,
|
bind_group_layouts: Vec<WebGPUBindGroupLayout>,
|
||||||
|
device: Dom<GPUDevice>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GPUComputePipeline {
|
impl GPUComputePipeline {
|
||||||
|
@ -28,12 +29,14 @@ impl GPUComputePipeline {
|
||||||
compute_pipeline: WebGPUComputePipeline,
|
compute_pipeline: WebGPUComputePipeline,
|
||||||
label: Option<USVString>,
|
label: Option<USVString>,
|
||||||
bgls: Vec<WebGPUBindGroupLayout>,
|
bgls: Vec<WebGPUBindGroupLayout>,
|
||||||
|
device: &GPUDevice,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
label: DomRefCell::new(label),
|
label: DomRefCell::new(label),
|
||||||
compute_pipeline,
|
compute_pipeline,
|
||||||
bind_group_layouts: bgls,
|
bind_group_layouts: bgls,
|
||||||
|
device: Dom::from_ref(device),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +45,14 @@ impl GPUComputePipeline {
|
||||||
compute_pipeline: WebGPUComputePipeline,
|
compute_pipeline: WebGPUComputePipeline,
|
||||||
label: Option<USVString>,
|
label: Option<USVString>,
|
||||||
bgls: Vec<WebGPUBindGroupLayout>,
|
bgls: Vec<WebGPUBindGroupLayout>,
|
||||||
|
device: &GPUDevice,
|
||||||
) -> DomRoot<Self> {
|
) -> DomRoot<Self> {
|
||||||
reflect_dom_object(
|
reflect_dom_object(
|
||||||
Box::new(GPUComputePipeline::new_inherited(
|
Box::new(GPUComputePipeline::new_inherited(
|
||||||
compute_pipeline,
|
compute_pipeline,
|
||||||
label,
|
label,
|
||||||
bgls,
|
bgls,
|
||||||
|
device,
|
||||||
)),
|
)),
|
||||||
global,
|
global,
|
||||||
)
|
)
|
||||||
|
@ -73,14 +78,13 @@ impl GPUComputePipelineMethods for GPUComputePipeline {
|
||||||
|
|
||||||
/// https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout
|
/// https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout
|
||||||
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>> {
|
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>> {
|
||||||
if index > self.bind_group_layouts.len() as u32 || index > GPULimits::empty().maxBindGroups
|
if index > self.bind_group_layouts.len() as u32 {
|
||||||
{
|
|
||||||
return Err(Error::Range(String::from("Index out of bounds")));
|
return Err(Error::Range(String::from("Index out of bounds")));
|
||||||
}
|
}
|
||||||
return Ok(GPUBindGroupLayout::new(
|
Ok(GPUBindGroupLayout::new(
|
||||||
&self.global(),
|
&self.global(),
|
||||||
self.bind_group_layouts[index as usize],
|
self.bind_group_layouts[index as usize],
|
||||||
None,
|
None,
|
||||||
));
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ use js::jsapi::{Heap, JSObject};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::{self, NonNull};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use webgpu::wgpu::{
|
use webgpu::wgpu::{
|
||||||
binding_model as wgpu_bind, command as wgpu_com,
|
binding_model as wgpu_bind, command as wgpu_com,
|
||||||
|
@ -112,8 +112,8 @@ pub struct GPUDevice {
|
||||||
adapter: Dom<GPUAdapter>,
|
adapter: Dom<GPUAdapter>,
|
||||||
#[ignore_malloc_size_of = "mozjs"]
|
#[ignore_malloc_size_of = "mozjs"]
|
||||||
extensions: Heap<*mut JSObject>,
|
extensions: Heap<*mut JSObject>,
|
||||||
#[ignore_malloc_size_of = "mozjs"]
|
#[ignore_malloc_size_of = "Because it is non-owning"]
|
||||||
limits: Heap<*mut JSObject>,
|
limits: GPULimits,
|
||||||
label: DomRefCell<Option<USVString>>,
|
label: DomRefCell<Option<USVString>>,
|
||||||
device: webgpu::WebGPUDevice,
|
device: webgpu::WebGPUDevice,
|
||||||
default_queue: Dom<GPUQueue>,
|
default_queue: Dom<GPUQueue>,
|
||||||
|
@ -127,7 +127,7 @@ impl GPUDevice {
|
||||||
channel: WebGPU,
|
channel: WebGPU,
|
||||||
adapter: &GPUAdapter,
|
adapter: &GPUAdapter,
|
||||||
extensions: Heap<*mut JSObject>,
|
extensions: Heap<*mut JSObject>,
|
||||||
limits: Heap<*mut JSObject>,
|
limits: GPULimits,
|
||||||
device: webgpu::WebGPUDevice,
|
device: webgpu::WebGPUDevice,
|
||||||
queue: &GPUQueue,
|
queue: &GPUQueue,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
|
@ -155,7 +155,7 @@ impl GPUDevice {
|
||||||
channel: WebGPU,
|
channel: WebGPU,
|
||||||
adapter: &GPUAdapter,
|
adapter: &GPUAdapter,
|
||||||
extensions: Heap<*mut JSObject>,
|
extensions: Heap<*mut JSObject>,
|
||||||
limits: Heap<*mut JSObject>,
|
limits: GPULimits,
|
||||||
device: webgpu::WebGPUDevice,
|
device: webgpu::WebGPUDevice,
|
||||||
queue: webgpu::WebGPUQueue,
|
queue: webgpu::WebGPUQueue,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
|
@ -177,6 +177,10 @@ impl GPUDevice {
|
||||||
self.device
|
self.device
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn limits(&self) -> &GPULimits {
|
||||||
|
&self.limits
|
||||||
|
}
|
||||||
|
|
||||||
pub fn handle_server_msg(&self, scope: Option<ErrorScopeId>, result: WebGPUOpResult) {
|
pub fn handle_server_msg(&self, scope: Option<ErrorScopeId>, result: WebGPUOpResult) {
|
||||||
let result = match result {
|
let result = match result {
|
||||||
WebGPUOpResult::Success => Ok(()),
|
WebGPUOpResult::Success => Ok(()),
|
||||||
|
@ -299,7 +303,7 @@ impl GPUDevice {
|
||||||
.wgpu_id_hub()
|
.wgpu_id_hub()
|
||||||
.lock()
|
.lock()
|
||||||
.create_pipeline_layout_id(self.device.0.backend());
|
.create_pipeline_layout_id(self.device.0.backend());
|
||||||
let max_bind_grps = GPULimits::empty().maxBindGroups;
|
let max_bind_grps = self.limits.maxBindGroups;
|
||||||
let mut bgls = Vec::with_capacity(max_bind_grps as usize);
|
let mut bgls = Vec::with_capacity(max_bind_grps as usize);
|
||||||
let mut bgl_ids = Vec::with_capacity(max_bind_grps as usize);
|
let mut bgl_ids = Vec::with_capacity(max_bind_grps as usize);
|
||||||
for _ in 0..max_bind_grps {
|
for _ in 0..max_bind_grps {
|
||||||
|
@ -328,8 +332,12 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-limits
|
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-limits
|
||||||
fn Limits(&self, _cx: SafeJSContext) -> NonNull<JSObject> {
|
fn Limits(&self, cx: SafeJSContext) -> NonNull<JSObject> {
|
||||||
NonNull::new(self.extensions.get()).unwrap()
|
rooted!(in (*cx) let mut limits = ptr::null_mut::<JSObject>());
|
||||||
|
unsafe {
|
||||||
|
self.limits.to_jsobject(*cx, limits.handle_mut());
|
||||||
|
}
|
||||||
|
NonNull::new(limits.get()).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-defaultqueue
|
/// https://gpuweb.github.io/gpuweb/#dom-gpudevice-defaultqueue
|
||||||
|
@ -439,17 +447,17 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
};
|
};
|
||||||
let ty = match bind.type_ {
|
let ty = match bind.type_ {
|
||||||
GPUBindingType::Uniform_buffer => wgt::BindingType::UniformBuffer {
|
GPUBindingType::Uniform_buffer => wgt::BindingType::UniformBuffer {
|
||||||
dynamic: bind.hasDynamicOffset,
|
dynamic: bind.hasDynamicOffset.unwrap_or(false),
|
||||||
min_binding_size: wgt::BufferSize::new(bind.minBufferBindingSize),
|
min_binding_size: bind.minBufferBindingSize.and_then(wgt::BufferSize::new),
|
||||||
},
|
},
|
||||||
GPUBindingType::Storage_buffer => wgt::BindingType::StorageBuffer {
|
GPUBindingType::Storage_buffer => wgt::BindingType::StorageBuffer {
|
||||||
dynamic: bind.hasDynamicOffset,
|
dynamic: bind.hasDynamicOffset.unwrap_or(false),
|
||||||
min_binding_size: wgt::BufferSize::new(bind.minBufferBindingSize),
|
min_binding_size: bind.minBufferBindingSize.and_then(wgt::BufferSize::new),
|
||||||
readonly: false,
|
readonly: false,
|
||||||
},
|
},
|
||||||
GPUBindingType::Readonly_storage_buffer => wgt::BindingType::StorageBuffer {
|
GPUBindingType::Readonly_storage_buffer => wgt::BindingType::StorageBuffer {
|
||||||
dynamic: bind.hasDynamicOffset,
|
dynamic: bind.hasDynamicOffset.unwrap_or(false),
|
||||||
min_binding_size: wgt::BufferSize::new(bind.minBufferBindingSize),
|
min_binding_size: bind.minBufferBindingSize.and_then(wgt::BufferSize::new),
|
||||||
readonly: true,
|
readonly: true,
|
||||||
},
|
},
|
||||||
GPUBindingType::Sampled_texture => wgt::BindingType::SampledTexture {
|
GPUBindingType::Sampled_texture => wgt::BindingType::SampledTexture {
|
||||||
|
@ -458,16 +466,17 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
.map_or(wgt::TextureViewDimension::D2, |v| {
|
.map_or(wgt::TextureViewDimension::D2, |v| {
|
||||||
convert_texture_view_dimension(v)
|
convert_texture_view_dimension(v)
|
||||||
}),
|
}),
|
||||||
component_type: if let Some(c) = bind.textureComponentType {
|
component_type: convert_texture_component_type(bind.textureComponentType),
|
||||||
match c {
|
multisampled: false,
|
||||||
GPUTextureComponentType::Float => wgt::TextureComponentType::Float,
|
},
|
||||||
GPUTextureComponentType::Sint => wgt::TextureComponentType::Sint,
|
GPUBindingType::Multisampled_texture => wgt::BindingType::SampledTexture {
|
||||||
GPUTextureComponentType::Uint => wgt::TextureComponentType::Uint,
|
dimension: bind
|
||||||
}
|
.viewDimension
|
||||||
} else {
|
.map_or(wgt::TextureViewDimension::D2, |v| {
|
||||||
wgt::TextureComponentType::Float
|
convert_texture_view_dimension(v)
|
||||||
},
|
}),
|
||||||
multisampled: bind.multisampled,
|
component_type: convert_texture_component_type(bind.textureComponentType),
|
||||||
|
multisampled: true,
|
||||||
},
|
},
|
||||||
GPUBindingType::Readonly_storage_texture => wgt::BindingType::StorageTexture {
|
GPUBindingType::Readonly_storage_texture => wgt::BindingType::StorageTexture {
|
||||||
dimension: bind
|
dimension: bind
|
||||||
|
@ -742,6 +751,7 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
compute_pipeline,
|
compute_pipeline,
|
||||||
descriptor.parent.parent.label.as_ref().cloned(),
|
descriptor.parent.parent.label.as_ref().cloned(),
|
||||||
bgls,
|
bgls,
|
||||||
|
&self,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,6 +955,7 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
depth_bias: rs_desc.depthBias,
|
depth_bias: rs_desc.depthBias,
|
||||||
depth_bias_slope_scale: *rs_desc.depthBiasSlopeScale,
|
depth_bias_slope_scale: *rs_desc.depthBiasSlopeScale,
|
||||||
depth_bias_clamp: *rs_desc.depthBiasClamp,
|
depth_bias_clamp: *rs_desc.depthBiasClamp,
|
||||||
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
primitive_topology: match descriptor.primitiveTopology {
|
primitive_topology: match descriptor.primitiveTopology {
|
||||||
GPUPrimitiveTopology::Point_list => wgt::PrimitiveTopology::PointList,
|
GPUPrimitiveTopology::Point_list => wgt::PrimitiveTopology::PointList,
|
||||||
|
@ -1047,6 +1058,7 @@ impl GPUDeviceMethods for GPUDevice {
|
||||||
render_pipeline,
|
render_pipeline,
|
||||||
descriptor.parent.parent.label.as_ref().cloned(),
|
descriptor.parent.parent.label.as_ref().cloned(),
|
||||||
bgls,
|
bgls,
|
||||||
|
&self,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1272,7 +1284,6 @@ pub fn convert_texture_format(format: GPUTextureFormat) -> wgt::TextureFormat {
|
||||||
GPUTextureFormat::Bgra8unorm => wgt::TextureFormat::Bgra8Unorm,
|
GPUTextureFormat::Bgra8unorm => wgt::TextureFormat::Bgra8Unorm,
|
||||||
GPUTextureFormat::Bgra8unorm_srgb => wgt::TextureFormat::Bgra8UnormSrgb,
|
GPUTextureFormat::Bgra8unorm_srgb => wgt::TextureFormat::Bgra8UnormSrgb,
|
||||||
GPUTextureFormat::Rgb10a2unorm => wgt::TextureFormat::Rgb10a2Unorm,
|
GPUTextureFormat::Rgb10a2unorm => wgt::TextureFormat::Rgb10a2Unorm,
|
||||||
GPUTextureFormat::Rg11b10float => wgt::TextureFormat::Rg11b10Float,
|
|
||||||
GPUTextureFormat::Rg32uint => wgt::TextureFormat::Rg32Uint,
|
GPUTextureFormat::Rg32uint => wgt::TextureFormat::Rg32Uint,
|
||||||
GPUTextureFormat::Rg32sint => wgt::TextureFormat::Rg32Sint,
|
GPUTextureFormat::Rg32sint => wgt::TextureFormat::Rg32Sint,
|
||||||
GPUTextureFormat::Rg32float => wgt::TextureFormat::Rg32Float,
|
GPUTextureFormat::Rg32float => wgt::TextureFormat::Rg32Float,
|
||||||
|
@ -1285,6 +1296,34 @@ pub fn convert_texture_format(format: GPUTextureFormat) -> wgt::TextureFormat {
|
||||||
GPUTextureFormat::Depth32float => wgt::TextureFormat::Depth32Float,
|
GPUTextureFormat::Depth32float => wgt::TextureFormat::Depth32Float,
|
||||||
GPUTextureFormat::Depth24plus => wgt::TextureFormat::Depth24Plus,
|
GPUTextureFormat::Depth24plus => wgt::TextureFormat::Depth24Plus,
|
||||||
GPUTextureFormat::Depth24plus_stencil8 => wgt::TextureFormat::Depth24PlusStencil8,
|
GPUTextureFormat::Depth24plus_stencil8 => wgt::TextureFormat::Depth24PlusStencil8,
|
||||||
|
GPUTextureFormat::Bc1_rgba_unorm => wgt::TextureFormat::Bc1RgbaUnorm,
|
||||||
|
GPUTextureFormat::Bc1_rgba_unorm_srgb => wgt::TextureFormat::Bc1RgbaUnormSrgb,
|
||||||
|
GPUTextureFormat::Bc2_rgba_unorm => wgt::TextureFormat::Bc2RgbaUnorm,
|
||||||
|
GPUTextureFormat::Bc2_rgba_unorm_srgb => wgt::TextureFormat::Bc2RgbaUnormSrgb,
|
||||||
|
GPUTextureFormat::Bc3_rgba_unorm => wgt::TextureFormat::Bc3RgbaUnorm,
|
||||||
|
GPUTextureFormat::Bc3_rgba_unorm_srgb => wgt::TextureFormat::Bc3RgbaUnormSrgb,
|
||||||
|
GPUTextureFormat::Bc4_r_unorm => wgt::TextureFormat::Bc4RUnorm,
|
||||||
|
GPUTextureFormat::Bc4_r_snorm => wgt::TextureFormat::Bc4RSnorm,
|
||||||
|
GPUTextureFormat::Bc5_rg_unorm => wgt::TextureFormat::Bc5RgUnorm,
|
||||||
|
GPUTextureFormat::Bc5_rg_snorm => wgt::TextureFormat::Bc5RgSnorm,
|
||||||
|
GPUTextureFormat::Bc6h_rgb_ufloat => wgt::TextureFormat::Bc6hRgbUfloat,
|
||||||
|
GPUTextureFormat::Bc7_rgba_unorm => wgt::TextureFormat::Bc7RgbaUnorm,
|
||||||
|
GPUTextureFormat::Bc7_rgba_unorm_srgb => wgt::TextureFormat::Bc7RgbaUnormSrgb,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn convert_texture_component_type(
|
||||||
|
ty: Option<GPUTextureComponentType>,
|
||||||
|
) -> wgt::TextureComponentType {
|
||||||
|
if let Some(c) = ty {
|
||||||
|
match c {
|
||||||
|
GPUTextureComponentType::Float => wgt::TextureComponentType::Float,
|
||||||
|
GPUTextureComponentType::Sint => wgt::TextureComponentType::Sint,
|
||||||
|
GPUTextureComponentType::Uint => wgt::TextureComponentType::Uint,
|
||||||
|
GPUTextureComponentType::Depth_comparison => wgt::TextureComponentType::DepthComparison,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wgt::TextureComponentType::Float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ use crate::dom::bindings::codegen::Bindings::GPUCommandEncoderBinding::{
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::Bindings::GPUQueueBinding::GPUQueueMethods;
|
use crate::dom::bindings::codegen::Bindings::GPUQueueBinding::GPUQueueMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::GPUTextureBinding::GPUExtent3D;
|
use crate::dom::bindings::codegen::Bindings::GPUTextureBinding::GPUExtent3D;
|
||||||
|
use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer as BufferSource;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
|
@ -20,8 +21,6 @@ use crate::dom::gpucommandencoder::{convert_texture_cv, convert_texture_data_lay
|
||||||
use crate::dom::gpudevice::{convert_texture_size_to_dict, convert_texture_size_to_wgt, GPUDevice};
|
use crate::dom::gpudevice::{convert_texture_size_to_dict, convert_texture_size_to_wgt, GPUDevice};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc::IpcSharedMemory;
|
use ipc_channel::ipc::IpcSharedMemory;
|
||||||
use js::rust::CustomAutoRooterGuard;
|
|
||||||
use js::typedarray::ArrayBuffer;
|
|
||||||
use webgpu::{identity::WebGPUOpResult, wgt, WebGPU, WebGPUQueue, WebGPURequest};
|
use webgpu::{identity::WebGPUOpResult, wgt, WebGPU, WebGPUQueue, WebGPURequest};
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -104,11 +103,14 @@ impl GPUQueueMethods for GPUQueue {
|
||||||
&self,
|
&self,
|
||||||
buffer: &GPUBuffer,
|
buffer: &GPUBuffer,
|
||||||
buffer_offset: GPUSize64,
|
buffer_offset: GPUSize64,
|
||||||
data: CustomAutoRooterGuard<ArrayBuffer>,
|
data: BufferSource,
|
||||||
data_offset: GPUSize64,
|
data_offset: GPUSize64,
|
||||||
size: Option<GPUSize64>,
|
size: Option<GPUSize64>,
|
||||||
) -> Fallible<()> {
|
) -> Fallible<()> {
|
||||||
let bytes = data.to_vec();
|
let bytes = match data {
|
||||||
|
BufferSource::ArrayBufferView(d) => d.to_vec(),
|
||||||
|
BufferSource::ArrayBuffer(d) => d.to_vec(),
|
||||||
|
};
|
||||||
let content_size = if let Some(s) = size {
|
let content_size = if let Some(s) = size {
|
||||||
s
|
s
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,12 +148,15 @@ impl GPUQueueMethods for GPUQueue {
|
||||||
fn WriteTexture(
|
fn WriteTexture(
|
||||||
&self,
|
&self,
|
||||||
destination: &GPUTextureCopyView,
|
destination: &GPUTextureCopyView,
|
||||||
data: CustomAutoRooterGuard<ArrayBuffer>,
|
data: BufferSource,
|
||||||
data_layout: &GPUTextureDataLayout,
|
data_layout: &GPUTextureDataLayout,
|
||||||
size: GPUExtent3D,
|
size: GPUExtent3D,
|
||||||
) -> Fallible<()> {
|
) -> Fallible<()> {
|
||||||
let bytes = data.to_vec();
|
let (bytes, len) = match data {
|
||||||
let valid = data_layout.offset <= data.len() as u64;
|
BufferSource::ArrayBufferView(d) => (d.to_vec(), d.len() as u64),
|
||||||
|
BufferSource::ArrayBuffer(d) => (d.to_vec(), d.len() as u64),
|
||||||
|
};
|
||||||
|
let valid = data_layout.offset <= len;
|
||||||
|
|
||||||
if !valid {
|
if !valid {
|
||||||
return Err(Error::Operation);
|
return Err(Error::Operation);
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::GPUAdapterBinding::GPULimits;
|
|
||||||
use crate::dom::bindings::codegen::Bindings::GPURenderPipelineBinding::GPURenderPipelineMethods;
|
use crate::dom::bindings::codegen::Bindings::GPURenderPipelineBinding::GPURenderPipelineMethods;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::USVString;
|
use crate::dom::bindings::str::USVString;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
|
use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
|
||||||
|
use crate::dom::gpudevice::GPUDevice;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use webgpu::{WebGPUBindGroupLayout, WebGPURenderPipeline};
|
use webgpu::{WebGPUBindGroupLayout, WebGPURenderPipeline};
|
||||||
|
@ -21,6 +21,7 @@ pub struct GPURenderPipeline {
|
||||||
label: DomRefCell<Option<USVString>>,
|
label: DomRefCell<Option<USVString>>,
|
||||||
render_pipeline: WebGPURenderPipeline,
|
render_pipeline: WebGPURenderPipeline,
|
||||||
bind_group_layouts: Vec<WebGPUBindGroupLayout>,
|
bind_group_layouts: Vec<WebGPUBindGroupLayout>,
|
||||||
|
device: Dom<GPUDevice>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GPURenderPipeline {
|
impl GPURenderPipeline {
|
||||||
|
@ -28,12 +29,14 @@ impl GPURenderPipeline {
|
||||||
render_pipeline: WebGPURenderPipeline,
|
render_pipeline: WebGPURenderPipeline,
|
||||||
label: Option<USVString>,
|
label: Option<USVString>,
|
||||||
bgls: Vec<WebGPUBindGroupLayout>,
|
bgls: Vec<WebGPUBindGroupLayout>,
|
||||||
|
device: &GPUDevice,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
label: DomRefCell::new(label),
|
label: DomRefCell::new(label),
|
||||||
render_pipeline,
|
render_pipeline,
|
||||||
bind_group_layouts: bgls,
|
bind_group_layouts: bgls,
|
||||||
|
device: Dom::from_ref(device),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +45,14 @@ impl GPURenderPipeline {
|
||||||
render_pipeline: WebGPURenderPipeline,
|
render_pipeline: WebGPURenderPipeline,
|
||||||
label: Option<USVString>,
|
label: Option<USVString>,
|
||||||
bgls: Vec<WebGPUBindGroupLayout>,
|
bgls: Vec<WebGPUBindGroupLayout>,
|
||||||
|
device: &GPUDevice,
|
||||||
) -> DomRoot<Self> {
|
) -> DomRoot<Self> {
|
||||||
reflect_dom_object(
|
reflect_dom_object(
|
||||||
Box::new(GPURenderPipeline::new_inherited(
|
Box::new(GPURenderPipeline::new_inherited(
|
||||||
render_pipeline,
|
render_pipeline,
|
||||||
label,
|
label,
|
||||||
bgls,
|
bgls,
|
||||||
|
device,
|
||||||
)),
|
)),
|
||||||
global,
|
global,
|
||||||
)
|
)
|
||||||
|
@ -73,14 +78,13 @@ impl GPURenderPipelineMethods for GPURenderPipeline {
|
||||||
|
|
||||||
/// https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout
|
/// https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout
|
||||||
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>> {
|
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>> {
|
||||||
if index > self.bind_group_layouts.len() as u32 || index > GPULimits::empty().maxBindGroups
|
if index > self.bind_group_layouts.len() as u32 {
|
||||||
{
|
|
||||||
return Err(Error::Range(String::from("Index out of bounds")));
|
return Err(Error::Range(String::from("Index out of bounds")));
|
||||||
}
|
}
|
||||||
return Ok(GPUBindGroupLayout::new(
|
Ok(GPUBindGroupLayout::new(
|
||||||
&self.global(),
|
&self.global(),
|
||||||
self.bind_group_layouts[index as usize],
|
self.bind_group_layouts[index as usize],
|
||||||
None,
|
None,
|
||||||
));
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,12 @@ dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUExtensionName {
|
enum GPUExtensionName {
|
||||||
|
"depth-clamping",
|
||||||
|
"depth24unorm-stencil8",
|
||||||
|
"depth32float-stencil8",
|
||||||
|
"pipeline-statistics-query",
|
||||||
"texture-compression-bc",
|
"texture-compression-bc",
|
||||||
"pipeline-statistics-query"
|
"timestamp-query",
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPULimits {
|
dictionary GPULimits {
|
||||||
|
|
|
@ -16,11 +16,10 @@ dictionary GPUBindGroupLayoutEntry {
|
||||||
required GPUIndex32 binding;
|
required GPUIndex32 binding;
|
||||||
required GPUShaderStageFlags visibility;
|
required GPUShaderStageFlags visibility;
|
||||||
required GPUBindingType type;
|
required GPUBindingType type;
|
||||||
boolean hasDynamicOffset = false;
|
boolean hasDynamicOffset;
|
||||||
GPUSize64 minBufferBindingSize = 0;
|
GPUSize64 minBufferBindingSize;
|
||||||
GPUTextureViewDimension viewDimension;
|
GPUTextureViewDimension viewDimension;
|
||||||
GPUTextureComponentType textureComponentType;
|
GPUTextureComponentType textureComponentType;
|
||||||
boolean multisampled = false;
|
|
||||||
GPUTextureFormat storageTextureFormat;
|
GPUTextureFormat storageTextureFormat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,6 +30,7 @@ enum GPUBindingType {
|
||||||
"sampler",
|
"sampler",
|
||||||
"comparison-sampler",
|
"comparison-sampler",
|
||||||
"sampled-texture",
|
"sampled-texture",
|
||||||
|
"multisampled-texture",
|
||||||
"readonly-storage-texture",
|
"readonly-storage-texture",
|
||||||
"writeonly-storage-texture"
|
"writeonly-storage-texture"
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,5 +5,6 @@
|
||||||
// https://gpuweb.github.io/gpuweb/#gpucommandbuffer
|
// https://gpuweb.github.io/gpuweb/#gpucommandbuffer
|
||||||
[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"]
|
[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"]
|
||||||
interface GPUCommandBuffer {
|
interface GPUCommandBuffer {
|
||||||
|
//readonly attribute Promise<double> executionTime;
|
||||||
};
|
};
|
||||||
GPUCommandBuffer includes GPUObjectBase;
|
GPUCommandBuffer includes GPUObjectBase;
|
||||||
|
|
|
@ -9,6 +9,11 @@ interface GPUComputePassEncoder {
|
||||||
void dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1);
|
void dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1);
|
||||||
void dispatchIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
void dispatchIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
||||||
|
|
||||||
|
//void beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex);
|
||||||
|
//void endPipelineStatisticsQuery();
|
||||||
|
|
||||||
|
//void writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
|
||||||
|
|
||||||
void endPass();
|
void endPass();
|
||||||
};
|
};
|
||||||
GPUComputePassEncoder includes GPUObjectBase;
|
GPUComputePassEncoder includes GPUObjectBase;
|
||||||
|
|
|
@ -22,11 +22,16 @@ interface GPUDevice : EventTarget {
|
||||||
GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
|
GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
|
||||||
GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
|
GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
|
||||||
GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
|
GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
|
||||||
|
//Promise<GPUComputePipeline> createReadyComputePipeline(GPUComputePipelineDescriptor descriptor);
|
||||||
|
//Promise<GPURenderPipeline> createReadyRenderPipeline(GPURenderPipelineDescriptor descriptor);
|
||||||
|
|
||||||
GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
|
GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
|
||||||
GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
|
GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
|
||||||
|
|
||||||
|
//GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor);
|
||||||
};
|
};
|
||||||
GPUDevice includes GPUObjectBase;
|
GPUDevice includes GPUObjectBase;
|
||||||
|
|
||||||
dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
|
dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
|
||||||
|
boolean measureExecutionTime = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,13 +13,13 @@ interface GPUQueue {
|
||||||
[Throws] void writeBuffer(
|
[Throws] void writeBuffer(
|
||||||
GPUBuffer buffer,
|
GPUBuffer buffer,
|
||||||
GPUSize64 bufferOffset,
|
GPUSize64 bufferOffset,
|
||||||
/*[AllowShared]*/ ArrayBuffer data,
|
/*[AllowShared]*/ BufferSource data,
|
||||||
optional GPUSize64 dataOffset = 0,
|
optional GPUSize64 dataOffset = 0,
|
||||||
optional GPUSize64 size);
|
optional GPUSize64 size);
|
||||||
|
|
||||||
[Throws] void writeTexture(
|
[Throws] void writeTexture(
|
||||||
GPUTextureCopyView destination,
|
GPUTextureCopyView destination,
|
||||||
/*[AllowShared]*/ ArrayBuffer data,
|
/*[AllowShared]*/ BufferSource data,
|
||||||
GPUTextureDataLayout dataLayout,
|
GPUTextureDataLayout dataLayout,
|
||||||
GPUExtent3D size);
|
GPUExtent3D size);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,9 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
|
||||||
GPUFilterMode minFilter = "nearest";
|
GPUFilterMode minFilter = "nearest";
|
||||||
GPUFilterMode mipmapFilter = "nearest";
|
GPUFilterMode mipmapFilter = "nearest";
|
||||||
float lodMinClamp = 0;
|
float lodMinClamp = 0;
|
||||||
float lodMaxClamp = 0xfffff; // TODO: Update this. Value in spec was too big
|
float lodMaxClamp = 0xfffff; // TODO: What should this be? Was Number.MAX_VALUE.
|
||||||
GPUCompareFunction compare;
|
GPUCompareFunction compare;
|
||||||
|
unsigned short maxAnisotropy = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUAddressMode {
|
enum GPUAddressMode {
|
||||||
|
|
|
@ -57,8 +57,9 @@ enum GPUTextureFormat {
|
||||||
"bgra8unorm",
|
"bgra8unorm",
|
||||||
"bgra8unorm-srgb",
|
"bgra8unorm-srgb",
|
||||||
// Packed 32-bit formats
|
// Packed 32-bit formats
|
||||||
|
//"rgb9e5ufloat",
|
||||||
"rgb10a2unorm",
|
"rgb10a2unorm",
|
||||||
"rg11b10float",
|
//"rg11b10ufloat",
|
||||||
|
|
||||||
// 64-bit formats
|
// 64-bit formats
|
||||||
"rg32uint",
|
"rg32uint",
|
||||||
|
@ -74,15 +75,42 @@ enum GPUTextureFormat {
|
||||||
"rgba32float",
|
"rgba32float",
|
||||||
|
|
||||||
// Depth and stencil formats
|
// Depth and stencil formats
|
||||||
"depth32float",
|
//"stencil8",
|
||||||
|
//"depth16unorm",
|
||||||
"depth24plus",
|
"depth24plus",
|
||||||
"depth24plus-stencil8"
|
"depth24plus-stencil8",
|
||||||
|
"depth32float",
|
||||||
|
|
||||||
|
// BC compressed formats usable if "texture-compression-bc" is both
|
||||||
|
// supported by the device/user agent and enabled in requestDevice.
|
||||||
|
"bc1-rgba-unorm",
|
||||||
|
"bc1-rgba-unorm-srgb",
|
||||||
|
"bc2-rgba-unorm",
|
||||||
|
"bc2-rgba-unorm-srgb",
|
||||||
|
"bc3-rgba-unorm",
|
||||||
|
"bc3-rgba-unorm-srgb",
|
||||||
|
"bc4-r-unorm",
|
||||||
|
"bc4-r-snorm",
|
||||||
|
"bc5-rg-unorm",
|
||||||
|
"bc5-rg-snorm",
|
||||||
|
"bc6h-rgb-ufloat",
|
||||||
|
//"bc6h-rgb-float",
|
||||||
|
"bc7-rgba-unorm",
|
||||||
|
"bc7-rgba-unorm-srgb",
|
||||||
|
|
||||||
|
// "depth24unorm-stencil8" extension
|
||||||
|
//"depth24unorm-stencil8",
|
||||||
|
|
||||||
|
// "depth32float-stencil8" extension
|
||||||
|
//"depth32float-stencil8",
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUTextureComponentType {
|
enum GPUTextureComponentType {
|
||||||
"float",
|
"float",
|
||||||
"sint",
|
"sint",
|
||||||
"uint"
|
"uint",
|
||||||
|
// Texture is used with comparison sampling only.
|
||||||
|
"depth-comparison"
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPUExtent3DDict {
|
dictionary GPUExtent3DDict {
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub enum WebGPUResponse {
|
||||||
RequestDevice {
|
RequestDevice {
|
||||||
device_id: WebGPUDevice,
|
device_id: WebGPUDevice,
|
||||||
queue_id: WebGPUQueue,
|
queue_id: WebGPUQueue,
|
||||||
_descriptor: wgt::DeviceDescriptor,
|
descriptor: wgt::DeviceDescriptor,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
},
|
},
|
||||||
BufferMapAsync(IpcSharedMemory),
|
BufferMapAsync(IpcSharedMemory),
|
||||||
|
@ -960,7 +960,7 @@ impl<'a> WGPU<'a> {
|
||||||
if let Err(e) = sender.send(Ok(WebGPUResponse::RequestDevice {
|
if let Err(e) = sender.send(Ok(WebGPUResponse::RequestDevice {
|
||||||
device_id: device,
|
device_id: device,
|
||||||
queue_id: queue,
|
queue_id: queue,
|
||||||
_descriptor: descriptor,
|
descriptor,
|
||||||
label,
|
label,
|
||||||
})) {
|
})) {
|
||||||
warn!(
|
warn!(
|
||||||
|
|
|
@ -33,6 +33,7 @@ packages = [
|
||||||
"base64",
|
"base64",
|
||||||
"cloudabi",
|
"cloudabi",
|
||||||
"cocoa",
|
"cocoa",
|
||||||
|
"fixedbitset",
|
||||||
"gleam",
|
"gleam",
|
||||||
"libloading",
|
"libloading",
|
||||||
"lock_api",
|
"lock_api",
|
||||||
|
@ -41,6 +42,7 @@ packages = [
|
||||||
"num-rational",
|
"num-rational",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"parking_lot_core",
|
"parking_lot_core",
|
||||||
|
"petgraph",
|
||||||
"ron",
|
"ron",
|
||||||
"wayland-sys",
|
"wayland-sys",
|
||||||
|
|
||||||
|
|
|
@ -439,7 +439,7 @@
|
||||||
"testharness": {
|
"testharness": {
|
||||||
"webgpu": {
|
"webgpu": {
|
||||||
"cts.html": [
|
"cts.html": [
|
||||||
"63357f7e996ecadde32f6816dc131b94e9ab976c",
|
"c5bc2536ab14b1174b7c01f35c85cfc6e62f5418",
|
||||||
[
|
[
|
||||||
"webgpu/cts.html?q=webgpu:api,operation,buffers,map_detach:*",
|
"webgpu/cts.html?q=webgpu:api,operation,buffers,map_detach:*",
|
||||||
{}
|
{}
|
||||||
|
@ -460,18 +460,10 @@
|
||||||
"webgpu/cts.html?q=webgpu:api,operation,command_buffer,render,basic:*",
|
"webgpu/cts.html?q=webgpu:api,operation,command_buffer,render,basic:*",
|
||||||
{}
|
{}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"webgpu/cts.html?q=webgpu:api,operation,copyBetweenLinearDataAndTexture:*",
|
|
||||||
{}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"webgpu/cts.html?q=webgpu:api,operation,fences:*",
|
"webgpu/cts.html?q=webgpu:api,operation,fences:*",
|
||||||
{}
|
{}
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"webgpu/cts.html?q=webgpu:api,operation,render_pass,storeOp:*",
|
|
||||||
{}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"webgpu/cts.html?q=webgpu:api,validation,copyBufferToBuffer:*",
|
"webgpu/cts.html?q=webgpu:api,validation,copyBufferToBuffer:*",
|
||||||
{}
|
{}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,9 +33,9 @@
|
||||||
<meta name=variant content='?q=webgpu:api,operation,command_buffer,basic:*'>
|
<meta name=variant content='?q=webgpu:api,operation,command_buffer,basic:*'>
|
||||||
<meta name=variant content='?q=webgpu:api,operation,command_buffer,copies:*'>
|
<meta name=variant content='?q=webgpu:api,operation,command_buffer,copies:*'>
|
||||||
<meta name=variant content='?q=webgpu:api,operation,command_buffer,render,basic:*'>
|
<meta name=variant content='?q=webgpu:api,operation,command_buffer,render,basic:*'>
|
||||||
<meta name=variant content='?q=webgpu:api,operation,copyBetweenLinearDataAndTexture:*'>
|
<!--<meta name=variant content='?q=webgpu:api,operation,copyBetweenLinearDataAndTexture:*'>-->
|
||||||
<meta name=variant content='?q=webgpu:api,operation,fences:*'>
|
<meta name=variant content='?q=webgpu:api,operation,fences:*'>
|
||||||
<meta name=variant content='?q=webgpu:api,operation,render_pass,storeOp:*'>
|
<!--<meta name=variant content='?q=webgpu:api,operation,render_pass,storeOp:*'>-->
|
||||||
<!--<meta name=variant content='?q=webgpu:api,operation,resource_init,copied_texture_clear:*'>-->
|
<!--<meta name=variant content='?q=webgpu:api,operation,resource_init,copied_texture_clear:*'>-->
|
||||||
<meta name=variant content='?q=webgpu:api,validation,copyBufferToBuffer:*'>
|
<meta name=variant content='?q=webgpu:api,validation,copyBufferToBuffer:*'>
|
||||||
<meta name=variant content='?q=webgpu:api,validation,copy_between_linear_data_and_texture,copyBetweenLinearDataAndTexture_dataRelated:*'>
|
<meta name=variant content='?q=webgpu:api,validation,copy_between_linear_data_and_texture,copyBetweenLinearDataAndTexture_dataRelated:*'>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue