mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Use Device limits and features provided by user
Spec update
This commit is contained in:
parent
cd73193efe
commit
3661aa3d8c
16 changed files with 210 additions and 57 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -7044,7 +7044,7 @@ 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#d423d3d5d7cb7e21e5277628681a1a9dc1715c8e"
|
source = "git+https://github.com/gfx-rs/wgpu#e72724a6e393503c73f37e86aa9317a5c62e32b8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec 0.5.1",
|
"arrayvec 0.5.1",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -7072,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#d423d3d5d7cb7e21e5277628681a1a9dc1715c8e"
|
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,7 +78,8 @@ 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 ||
|
||||||
|
index > self.device.limits().maxBindGroups
|
||||||
{
|
{
|
||||||
return Err(Error::Range(String::from("Index out of bounds")));
|
return Err(Error::Range(String::from("Index out of bounds")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
|
||||||
GPUTextureComponentType::Uint => wgt::TextureComponentType::Uint,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
wgt::TextureComponentType::Float
|
|
||||||
},
|
},
|
||||||
multisampled: bind.multisampled,
|
GPUBindingType::Multisampled_texture => wgt::BindingType::SampledTexture {
|
||||||
|
dimension: bind
|
||||||
|
.viewDimension
|
||||||
|
.map_or(wgt::TextureViewDimension::D2, |v| {
|
||||||
|
convert_texture_view_dimension(v)
|
||||||
|
}),
|
||||||
|
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,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,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,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,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,
|
||||||
|
@ -1286,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,7 +78,8 @@ 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 ||
|
||||||
|
index > self.device.limits().maxBindGroups
|
||||||
{
|
{
|
||||||
return Err(Error::Range(String::from("Index out of bounds")));
|
return Err(Error::Range(String::from("Index out of bounds")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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",
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue