Auto merge of #27661 - kunalmohan:update-webgpu, r=kvark

WebGPU: Use GPULimits and extensions provided by user

<!-- Please describe your changes on the following line: -->
- update wgpu
- spec update

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

<!-- Either: -->
- [X] There are tests for these changes

<!-- 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-09-23 21:47:30 -04:00 committed by GitHub
commit 3c34da1c91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 9938 additions and 80 deletions

View file

@ -18,8 +18,12 @@ dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
};
enum GPUExtensionName {
"depth-clamping",
"depth24unorm-stencil8",
"depth32float-stencil8",
"pipeline-statistics-query",
"texture-compression-bc",
"pipeline-statistics-query"
"timestamp-query",
};
dictionary GPULimits {

View file

@ -16,11 +16,10 @@ dictionary GPUBindGroupLayoutEntry {
required GPUIndex32 binding;
required GPUShaderStageFlags visibility;
required GPUBindingType type;
boolean hasDynamicOffset = false;
GPUSize64 minBufferBindingSize = 0;
boolean hasDynamicOffset;
GPUSize64 minBufferBindingSize;
GPUTextureViewDimension viewDimension;
GPUTextureComponentType textureComponentType;
boolean multisampled = false;
GPUTextureFormat storageTextureFormat;
};
@ -31,6 +30,7 @@ enum GPUBindingType {
"sampler",
"comparison-sampler",
"sampled-texture",
"multisampled-texture",
"readonly-storage-texture",
"writeonly-storage-texture"
};

View file

@ -5,5 +5,6 @@
// https://gpuweb.github.io/gpuweb/#gpucommandbuffer
[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"]
interface GPUCommandBuffer {
//readonly attribute Promise<double> executionTime;
};
GPUCommandBuffer includes GPUObjectBase;

View file

@ -9,6 +9,11 @@ interface GPUComputePassEncoder {
void dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1);
void dispatchIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
//void beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex);
//void endPipelineStatisticsQuery();
//void writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
void endPass();
};
GPUComputePassEncoder includes GPUObjectBase;

View file

@ -22,11 +22,16 @@ interface GPUDevice : EventTarget {
GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
//Promise<GPUComputePipeline> createReadyComputePipeline(GPUComputePipelineDescriptor descriptor);
//Promise<GPURenderPipeline> createReadyRenderPipeline(GPURenderPipelineDescriptor descriptor);
GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
//GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor);
};
GPUDevice includes GPUObjectBase;
dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
boolean measureExecutionTime = false;
};

View file

@ -13,13 +13,13 @@ interface GPUQueue {
[Throws] void writeBuffer(
GPUBuffer buffer,
GPUSize64 bufferOffset,
/*[AllowShared]*/ ArrayBuffer data,
/*[AllowShared]*/ BufferSource data,
optional GPUSize64 dataOffset = 0,
optional GPUSize64 size);
[Throws] void writeTexture(
GPUTextureCopyView destination,
/*[AllowShared]*/ ArrayBuffer data,
/*[AllowShared]*/ BufferSource data,
GPUTextureDataLayout dataLayout,
GPUExtent3D size);

View file

@ -16,8 +16,9 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
GPUFilterMode minFilter = "nearest";
GPUFilterMode mipmapFilter = "nearest";
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;
unsigned short maxAnisotropy = 1;
};
enum GPUAddressMode {

View file

@ -57,8 +57,9 @@ enum GPUTextureFormat {
"bgra8unorm",
"bgra8unorm-srgb",
// Packed 32-bit formats
//"rgb9e5ufloat",
"rgb10a2unorm",
"rg11b10float",
//"rg11b10ufloat",
// 64-bit formats
"rg32uint",
@ -74,15 +75,42 @@ enum GPUTextureFormat {
"rgba32float",
// Depth and stencil formats
"depth32float",
//"stencil8",
//"depth16unorm",
"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 {
"float",
"sint",
"uint"
"uint",
// Texture is used with comparison sampling only.
"depth-comparison"
};
dictionary GPUExtent3DDict {