Auto merge of #26984 - kunalmohan:gpu-bind-group, r=kvark

Add GPUSampler and GPUTextureView to BindingResources and update wgpu-core

<!-- Please describe your changes on the following line: -->
This also completes validation for `GPUBindGroup` and `GPUBindGroupLayout`.
`entry_map` is stored in `GPUBindGroupLayout` for validating `createBindGroup()`.

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
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- 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:
bors-servo 2020-06-22 13:40:29 -04:00 committed by GitHub
commit 77a75403db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 313 additions and 396 deletions

View file

@ -24,12 +24,13 @@ enum GPUExtensionName {
};
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;
GPUSize32 maxBindGroups = 4;
GPUSize32 maxDynamicUniformBuffersPerPipelineLayout = 8;
GPUSize32 maxDynamicStorageBuffersPerPipelineLayout = 4;
GPUSize32 maxSampledTexturesPerShaderStage = 16;
GPUSize32 maxSamplersPerShaderStage = 16;
GPUSize32 maxStorageBuffersPerShaderStage = 4;
GPUSize32 maxStorageTexturesPerShaderStage = 4;
GPUSize32 maxUniformBuffersPerShaderStage = 12;
GPUSize32 maxUniformBufferBindingSize = 16384;
};

View file

@ -3,7 +3,7 @@
* 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"]
[Exposed=(Window, DedicatedWorker), Pref="dom.webgpu.enabled"]
interface GPUBindGroup {
};
GPUBindGroup includes GPUObjectBase;
@ -13,10 +13,10 @@ dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase {
required sequence<GPUBindGroupEntry> entries;
};
typedef /*(GPUSampler or GPUTextureView or*/ GPUBufferBindings/*)*/ GPUBindingResource;
typedef (GPUSampler or GPUTextureView or GPUBufferBindings) GPUBindingResource;
dictionary GPUBindGroupEntry {
required unsigned long binding;
required GPUIndex32 binding;
required GPUBindingResource resource;
};

View file

@ -16,11 +16,12 @@ dictionary GPUBindGroupLayoutEntry {
required GPUIndex32 binding;
required GPUShaderStageFlags visibility;
required GPUBindingType type;
GPUTextureViewDimension viewDimension = "2d";
GPUTextureComponentType textureComponentType = "float";
GPUTextureFormat storageTextureFormat;
boolean multisampled = false;
boolean hasDynamicOffset = false;
GPUSize64 minBufferBindingSize = 0;
GPUTextureViewDimension viewDimension;
GPUTextureComponentType textureComponentType;
boolean multisampled = false;
GPUTextureFormat storageTextureFormat;
};
enum GPUBindingType {
@ -28,8 +29,8 @@ enum GPUBindingType {
"storage-buffer",
"readonly-storage-buffer",
"sampler",
"comparison-sampler",
"sampled-texture",
"readonly-storage-texture",
"writeonly-storage-texture",
//"comparison-sampler",
"writeonly-storage-texture"
};