mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Initial implementation of GPUDevice for WebGPU
Added the WebIDL bindigs for GPUDevice, GPUObjectDescriptorBase, GPUDeviceDescriptor, GPUObjectBase Implemented the `requestDevice` function of `GPUAdapter`
This commit is contained in:
parent
7aa68c8fe7
commit
b15d2bb7d7
11 changed files with 270 additions and 16 deletions
|
@ -10,5 +10,25 @@ interface GPUAdapter {
|
|||
//readonly attribute GPULimits limits; Don’t expose higher limits for now.
|
||||
|
||||
// May reject with DOMException // TODO: DOMException("OperationError")?
|
||||
// Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
||||
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
||||
};
|
||||
|
||||
dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
||||
GPUExtensions extensions = {};
|
||||
GPULimits limits = {};
|
||||
};
|
||||
|
||||
dictionary GPUExtensions {
|
||||
boolean anisotropicFiltering = false;
|
||||
};
|
||||
|
||||
dictionary GPULimits {
|
||||
unsigned long maxBindGroups = 4;
|
||||
unsigned long maxDynamicUniformBuffersPerPipelineLayout = 8;
|
||||
unsigned long maxDynamicStorageBuffersPerPipelineLayout = 4;
|
||||
unsigned long maxSampledTexturesPerShaderStage = 16;
|
||||
unsigned long maxSamplersPerShaderStage = 16;
|
||||
unsigned long maxStorageBuffersPerShaderStage = 4;
|
||||
unsigned long maxStorageTexturesPerShaderStage = 4;
|
||||
unsigned long maxUniformBuffersPerShaderStage = 12;
|
||||
};
|
||||
|
|
31
components/script/dom/webidls/GPUDevice.webidl
Normal file
31
components/script/dom/webidls/GPUDevice.webidl
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://gpuweb.github.io/gpuweb/#gpudevice
|
||||
[Exposed=(Window, DedicatedWorker)/*, Serializable */, Pref="dom.webgpu.enabled"]
|
||||
interface GPUDevice : EventTarget {
|
||||
readonly attribute GPUAdapter adapter;
|
||||
readonly attribute object extensions;
|
||||
readonly attribute object limits;
|
||||
|
||||
/*GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
|
||||
GPUMappedBuffer createBufferMapped(GPUBufferDescriptor descriptor);
|
||||
Promise<GPUMappedBuffer> createBufferMappedAsync(GPUBufferDescriptor descriptor);
|
||||
GPUTexture createTexture(GPUTextureDescriptor descriptor);
|
||||
GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
|
||||
|
||||
GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor);
|
||||
GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor);
|
||||
GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor);
|
||||
|
||||
GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
|
||||
GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
|
||||
GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
|
||||
|
||||
GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
|
||||
GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
|
||||
|
||||
GPUQueue getQueue();*/
|
||||
};
|
||||
GPUDevice includes GPUObjectBase;
|
13
components/script/dom/webidls/GPUObjectBase.webidl
Normal file
13
components/script/dom/webidls/GPUObjectBase.webidl
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://gpuweb.github.io/gpuweb/#gpuobjectbase
|
||||
[Exposed=(Window)]
|
||||
interface mixin GPUObjectBase {
|
||||
attribute DOMString? label;
|
||||
};
|
||||
|
||||
dictionary GPUObjectDescriptorBase {
|
||||
DOMString? label;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue