mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
webgpu: Sync various parts of spec (#33009)
* Sync `GPUObjectDescriptorBase` (label is not option anymore) Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Sync `GPUFeatureName` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * shader_f16 feature is not usable in wgpu so disable it Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * sync `GPUTextureFormat` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * `validate_texture_format_required_features` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Sync `GPUTexture` attributes Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Make `entryPoint` in `GPUProgrammableStage` optional Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Set good expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Bad expectations because naga does not support cons declarations Also fail on firefox, where skipped before due to missing device features Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Bad expectation, also fails on firefox Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Bad expectations, because naga does not support `let pos = positions[vertex_index];` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Set expectation external texture does not work in firefox too (again naga) Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * set bad expectations, because naga does not support `enable` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Set bad expectations for, `Texture with '' label has been destroyed` also fails in firefox with same reason Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * one bad expectation also on firefox Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * expect that also matches firefox Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * more expect Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Use only 1 proc for _webgpu Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * better doc comment Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
f45c98496e
commit
94ff89a5e4
11 changed files with 910 additions and 4947 deletions
|
@ -11,7 +11,7 @@ interface mixin GPUObjectBase {
|
|||
};
|
||||
|
||||
dictionary GPUObjectDescriptorBase {
|
||||
USVString label;
|
||||
USVString label = "";
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), Pref="dom.webgpu.enabled"]
|
||||
|
@ -100,21 +100,26 @@ interface GPUAdapter {
|
|||
Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []);
|
||||
};
|
||||
|
||||
dictionary GPUDeviceDescriptor {
|
||||
dictionary GPUDeviceDescriptor: GPUObjectDescriptorBase {
|
||||
sequence<GPUFeatureName> requiredFeatures = [];
|
||||
record<DOMString, GPUSize64> requiredLimits;
|
||||
record<DOMString, GPUSize64> requiredLimits;// = {};
|
||||
};
|
||||
|
||||
enum GPUFeatureName {
|
||||
"depth-clip-control",
|
||||
"depth24unorm-stencil8",
|
||||
"depth32float-stencil8",
|
||||
"pipeline-statistics-query",
|
||||
"texture-compression-bc",
|
||||
"texture-compression-bc-sliced-3d",
|
||||
"texture-compression-etc2",
|
||||
"texture-compression-astc",
|
||||
"timestamp-query",
|
||||
"indirect-first-instance",
|
||||
"shader-f16",
|
||||
"rg11b10ufloat-renderable",
|
||||
"bgra8unorm-storage",
|
||||
"float32-filterable",
|
||||
"clip-distances",
|
||||
"dual-source-blending",
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), /*Serializable,*/ Pref="dom.webgpu.enabled"]
|
||||
|
@ -134,22 +139,24 @@ interface GPUDevice: EventTarget {
|
|||
[NewObject]
|
||||
GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
|
||||
|
||||
[Throws]
|
||||
GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor);
|
||||
GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor);
|
||||
GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor);
|
||||
|
||||
GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
|
||||
GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
|
||||
[Throws]
|
||||
GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
|
||||
|
||||
[NewObject]
|
||||
Promise<GPUComputePipeline> createComputePipelineAsync(GPUComputePipelineDescriptor descriptor);
|
||||
[NewObject]
|
||||
[Throws, NewObject]
|
||||
Promise<GPURenderPipeline> createRenderPipelineAsync(GPURenderPipelineDescriptor descriptor);
|
||||
|
||||
[NewObject]
|
||||
GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
|
||||
[NewObject]
|
||||
[Throws, NewObject]
|
||||
GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
|
||||
//[NewObject]
|
||||
//GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor);
|
||||
|
@ -199,10 +206,19 @@ interface GPUMapMode {
|
|||
|
||||
[Exposed=(Window, DedicatedWorker), Serializable , Pref="dom.webgpu.enabled"]
|
||||
interface GPUTexture {
|
||||
[NewObject]
|
||||
[Throws, NewObject]
|
||||
GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {});
|
||||
|
||||
undefined destroy();
|
||||
|
||||
readonly attribute GPUIntegerCoordinateOut width;
|
||||
readonly attribute GPUIntegerCoordinateOut height;
|
||||
readonly attribute GPUIntegerCoordinateOut depthOrArrayLayers;
|
||||
readonly attribute GPUIntegerCoordinateOut mipLevelCount;
|
||||
readonly attribute GPUSize32Out sampleCount;
|
||||
readonly attribute GPUTextureDimension dimension;
|
||||
readonly attribute GPUTextureFormat format;
|
||||
readonly attribute GPUFlagsConstant usage;
|
||||
};
|
||||
GPUTexture includes GPUObjectBase;
|
||||
|
||||
|
@ -293,8 +309,10 @@ enum GPUTextureFormat {
|
|||
"bgra8unorm",
|
||||
"bgra8unorm-srgb",
|
||||
// Packed 32-bit formats
|
||||
"rgb9e5ufloat",
|
||||
"rgb10a2uint",
|
||||
"rgb10a2unorm",
|
||||
"rg11b10float",
|
||||
"rg11b10ufloat",
|
||||
|
||||
// 64-bit formats
|
||||
"rg32uint",
|
||||
|
@ -309,13 +327,16 @@ enum GPUTextureFormat {
|
|||
"rgba32sint",
|
||||
"rgba32float",
|
||||
|
||||
// Depth and stencil formats
|
||||
//"stencil8", //TODO
|
||||
//"depth16unorm",
|
||||
// Depth/stencil formats
|
||||
"stencil8",
|
||||
"depth16unorm",
|
||||
"depth24plus",
|
||||
"depth24plus-stencil8",
|
||||
"depth32float",
|
||||
|
||||
// "depth32float-stencil8" feature
|
||||
"depth32float-stencil8",
|
||||
|
||||
// BC compressed formats usable if "texture-compression-bc" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"bc1-rgba-unorm",
|
||||
|
@ -333,11 +354,49 @@ enum GPUTextureFormat {
|
|||
"bc7-rgba-unorm",
|
||||
"bc7-rgba-unorm-srgb",
|
||||
|
||||
// "depth24unorm-stencil8" feature
|
||||
//"depth24unorm-stencil8",
|
||||
// ETC2 compressed formats usable if "texture-compression-etc2" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"etc2-rgb8unorm",
|
||||
"etc2-rgb8unorm-srgb",
|
||||
"etc2-rgb8a1unorm",
|
||||
"etc2-rgb8a1unorm-srgb",
|
||||
"etc2-rgba8unorm",
|
||||
"etc2-rgba8unorm-srgb",
|
||||
"eac-r11unorm",
|
||||
"eac-r11snorm",
|
||||
"eac-rg11unorm",
|
||||
"eac-rg11snorm",
|
||||
|
||||
// "depth32float-stencil8" feature
|
||||
//"depth32float-stencil8",
|
||||
// ASTC compressed formats usable if "texture-compression-astc" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"astc-4x4-unorm",
|
||||
"astc-4x4-unorm-srgb",
|
||||
"astc-5x4-unorm",
|
||||
"astc-5x4-unorm-srgb",
|
||||
"astc-5x5-unorm",
|
||||
"astc-5x5-unorm-srgb",
|
||||
"astc-6x5-unorm",
|
||||
"astc-6x5-unorm-srgb",
|
||||
"astc-6x6-unorm",
|
||||
"astc-6x6-unorm-srgb",
|
||||
"astc-8x5-unorm",
|
||||
"astc-8x5-unorm-srgb",
|
||||
"astc-8x6-unorm",
|
||||
"astc-8x6-unorm-srgb",
|
||||
"astc-8x8-unorm",
|
||||
"astc-8x8-unorm-srgb",
|
||||
"astc-10x5-unorm",
|
||||
"astc-10x5-unorm-srgb",
|
||||
"astc-10x6-unorm",
|
||||
"astc-10x6-unorm-srgb",
|
||||
"astc-10x8-unorm",
|
||||
"astc-10x8-unorm-srgb",
|
||||
"astc-10x10-unorm",
|
||||
"astc-10x10-unorm-srgb",
|
||||
"astc-12x10-unorm",
|
||||
"astc-12x10-unorm-srgb",
|
||||
"astc-12x12-unorm",
|
||||
"astc-12x12-unorm-srgb",
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), Pref="dom.webgpu.enabled"]
|
||||
|
@ -547,7 +606,7 @@ interface mixin GPUPipelineBase {
|
|||
|
||||
dictionary GPUProgrammableStage {
|
||||
required GPUShaderModule module;
|
||||
required USVString entryPoint;
|
||||
USVString entryPoint;
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"]
|
||||
|
@ -1160,6 +1219,12 @@ typedef [EnforceRange] unsigned long GPUIndex32;
|
|||
typedef [EnforceRange] unsigned long GPUSize32;
|
||||
typedef [EnforceRange] long GPUSignedOffset32;
|
||||
|
||||
typedef unsigned long long GPUSize64Out;
|
||||
typedef unsigned long GPUIntegerCoordinateOut;
|
||||
typedef unsigned long GPUSize32Out;
|
||||
|
||||
typedef unsigned long GPUFlagsConstant;
|
||||
|
||||
dictionary GPUColorDict {
|
||||
required double r;
|
||||
required double g;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue