Add GPUSampler and GPUTextureView to BindingResource

Add validation for BindGroups
This commit is contained in:
Kunal Mohan 2020-06-02 15:36:08 +05:30
parent abc3ed40c9
commit 00b3f785c4
12 changed files with 591 additions and 123 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,19 @@ dictionary GPUBindGroupLayoutEntry {
required GPUIndex32 binding;
required GPUShaderStageFlags visibility;
required GPUBindingType type;
GPUTextureViewDimension viewDimension = "2d";
GPUTextureComponentType textureComponentType = "float";
GPUTextureFormat storageTextureFormat;
boolean multisampled = false;
// Used for uniform buffer and storage buffer bindings.
boolean hasDynamicOffset = false;
// Used for sampled texture and storage texture bindings.
GPUTextureViewDimension viewDimension;
// Used for sampled texture bindings.
GPUTextureComponentType textureComponentType;
boolean multisampled = false;
// Used for storage texture bindings.
GPUTextureFormat storageTextureFormat;
};
enum GPUBindingType {
@ -31,5 +39,5 @@ enum GPUBindingType {
"sampled-texture",
"readonly-storage-texture",
"writeonly-storage-texture",
//"comparison-sampler",
"comparison-sampler",
};