mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Initial implementation of GPUBindGroupLayout for WebGPU
Added WebIDL bindings for `GPUBindGroupLayout`, `GPUBindGroupLayoutDescriptor`, `GPUBindingType`, `GPUShaderStage` and `GPUBindGroupLayoutBinding` (Note: The servo's codegen doesn't like the name, because its already occupied). Implemented the `createBindGroupLayout` function of `GPUDevice`.
This commit is contained in:
parent
95614f57f1
commit
9cf007472b
13 changed files with 397 additions and 11 deletions
34
components/script/dom/webidls/GPUBindGroupLayout.webidl
Normal file
34
components/script/dom/webidls/GPUBindGroupLayout.webidl
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* 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/#gpubindgrouplayout
|
||||
[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"]
|
||||
interface GPUBindGroupLayout {
|
||||
};
|
||||
GPUBindGroupLayout includes GPUObjectBase;
|
||||
|
||||
dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
|
||||
required sequence<GPUBindGroupLayoutBindings> bindings;
|
||||
};
|
||||
|
||||
// Note: Servo codegen doesn't like the name `GPUBindGroupLayoutBinding` because it's already occupied
|
||||
// dictionary GPUBindGroupLayoutBinding {
|
||||
dictionary GPUBindGroupLayoutBindings {
|
||||
required unsigned long binding;
|
||||
required GPUShaderStageFlags visibility;
|
||||
required GPUBindingType type;
|
||||
//GPUTextureViewDimension textureDimension = "2d";
|
||||
//GPUTextureComponentType textureComponentType = "float";
|
||||
boolean multisampled = false;
|
||||
boolean hasDynamicOffset = false;
|
||||
};
|
||||
|
||||
enum GPUBindingType {
|
||||
"uniform-buffer",
|
||||
"storage-buffer",
|
||||
"readonly-storage-buffer",
|
||||
"sampler",
|
||||
"sampled-texture",
|
||||
"storage-texture"
|
||||
};
|
|
@ -11,12 +11,12 @@ interface GPUDevice : EventTarget {
|
|||
|
||||
GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
|
||||
GPUMappedBuffer createBufferMapped(GPUBufferDescriptor descriptor);
|
||||
/*Promise<GPUMappedBuffer> createBufferMappedAsync(GPUBufferDescriptor descriptor);
|
||||
GPUTexture createTexture(GPUTextureDescriptor descriptor);
|
||||
GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
|
||||
//Promise<GPUMappedBuffer> createBufferMappedAsync(GPUBufferDescriptor descriptor);
|
||||
//GPUTexture createTexture(GPUTextureDescriptor descriptor);
|
||||
//GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
|
||||
|
||||
GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor);
|
||||
GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor);
|
||||
/*GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor);
|
||||
GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor);
|
||||
|
||||
GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
|
||||
|
|
13
components/script/dom/webidls/GPUShaderStage.webidl
Normal file
13
components/script/dom/webidls/GPUShaderStage.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/#typedefdef-gpushaderstageflags
|
||||
[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"]
|
||||
interface GPUShaderStage {
|
||||
const GPUShaderStageFlags VERTEX = 0x1;
|
||||
const GPUShaderStageFlags FRAGMENT = 0x2;
|
||||
const GPUShaderStageFlags COMPUTE = 0x4;
|
||||
};
|
||||
|
||||
typedef unsigned long GPUShaderStageFlags;
|
Loading…
Add table
Add a link
Reference in a new issue