summaryrefslogtreecommitdiff
path: root/ext/webgpu/webgpu.idl
diff options
context:
space:
mode:
authorDante Issaias <dante@issaias.com>2022-07-20 01:22:26 +0100
committerGitHub <noreply@github.com>2022-07-20 02:22:26 +0200
commit2b1f145c3e51cf9885c073b78bd5882e80d258e3 (patch)
treeface88f9a6d6d109ebf8f659a59bc74e6f6ae8ee /ext/webgpu/webgpu.idl
parent649536e2669eb496fc2d4dacd92fd1d6dbed50a7 (diff)
chore(ext): update webgpu (#15059)
Diffstat (limited to 'ext/webgpu/webgpu.idl')
-rw-r--r--ext/webgpu/webgpu.idl195
1 files changed, 113 insertions, 82 deletions
diff --git a/ext/webgpu/webgpu.idl b/ext/webgpu/webgpu.idl
index 79d65791d..cda505715 100644
--- a/ext/webgpu/webgpu.idl
+++ b/ext/webgpu/webgpu.idl
@@ -1,5 +1,5 @@
interface mixin GPUObjectBase {
- attribute USVString? label;
+ attribute USVString label;
};
dictionary GPUObjectDescriptorBase {
@@ -41,6 +41,14 @@ interface GPUSupportedFeatures {
readonly setlike<DOMString>;
};
+[Exposed=(Window, DedicatedWorker), SecureContext]
+interface GPUAdapterInfo {
+ readonly attribute DOMString vendor;
+ readonly attribute DOMString architecture;
+ readonly attribute DOMString device;
+ readonly attribute DOMString description;
+};
+
enum GPUPredefinedColorSpace {
"srgb",
};
@@ -68,12 +76,12 @@ enum GPUPowerPreference {
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUAdapter {
- readonly attribute DOMString name;
[SameObject] readonly attribute GPUSupportedFeatures features;
[SameObject] readonly attribute GPUSupportedLimits limits;
readonly attribute boolean isFallbackAdapter;
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
+ Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []);
};
dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
@@ -85,12 +93,12 @@ enum GPUFeatureName {
"depth-clip-control",
"depth24unorm-stencil8",
"depth32float-stencil8",
- "pipeline-statistics-query",
"texture-compression-bc",
"texture-compression-etc2",
"texture-compression-astc",
"timestamp-query",
"indirect-first-instance",
+ "shader-f16",
};
[Exposed=(Window, DedicatedWorker), SecureContext]
@@ -141,7 +149,7 @@ dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
[Exposed=(Window, DedicatedWorker)]
-interface GPUBufferUsage {
+namespace GPUBufferUsage {
const GPUFlagsConstant MAP_READ = 0x0001;
const GPUFlagsConstant MAP_WRITE = 0x0002;
const GPUFlagsConstant COPY_SRC = 0x0004;
@@ -156,7 +164,7 @@ interface GPUBufferUsage {
typedef [EnforceRange] unsigned long GPUMapModeFlags;
[Exposed=(Window, DedicatedWorker)]
-interface GPUMapMode {
+namespace GPUMapMode {
const GPUFlagsConstant READ = 0x0001;
const GPUFlagsConstant WRITE = 0x0002;
};
@@ -186,7 +194,7 @@ enum GPUTextureDimension {
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
[Exposed=(Window, DedicatedWorker)]
-interface GPUTextureUsage {
+namespace GPUTextureUsage {
const GPUFlagsConstant COPY_SRC = 0x01;
const GPUFlagsConstant COPY_DST = 0x02;
const GPUFlagsConstant TEXTURE_BINDING = 0x04;
@@ -272,13 +280,19 @@ enum GPUTextureFormat {
"rgba32sint",
"rgba32float",
- // Depth and stencil formats
+ // Depth/stencil formats
"stencil8",
"depth16unorm",
"depth24plus",
"depth24plus-stencil8",
"depth32float",
+ // "depth24unorm-stencil8" feature
+ "depth24unorm-stencil8",
+
+ // "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",
@@ -339,12 +353,6 @@ enum GPUTextureFormat {
"astc-12x10-unorm-srgb",
"astc-12x12-unorm",
"astc-12x12-unorm-srgb",
-
- // "depth24unorm-stencil8" feature
- "depth24unorm-stencil8",
-
- // "depth32float-stencil8" feature
- "depth32float-stencil8",
};
[Exposed=(Window, DedicatedWorker), SecureContext]
@@ -358,7 +366,7 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
GPUAddressMode addressModeW = "clamp-to-edge";
GPUFilterMode magFilter = "nearest";
GPUFilterMode minFilter = "nearest";
- GPUFilterMode mipmapFilter = "nearest";
+ GPUMipmapFilterMode mipmapFilter = "nearest";
float lodMinClamp = 0;
float lodMaxClamp = 32;
GPUCompareFunction compare;
@@ -376,6 +384,11 @@ enum GPUFilterMode {
"linear",
};
+enum GPUMipmapFilterMode {
+ "nearest",
+ "linear",
+};
+
enum GPUCompareFunction {
"never",
"less",
@@ -396,14 +409,6 @@ dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
required sequence<GPUBindGroupLayoutEntry> entries;
};
-typedef [EnforceRange] unsigned long GPUShaderStageFlags;
-[Exposed=(Window, DedicatedWorker)]
-interface GPUShaderStage {
- const GPUFlagsConstant VERTEX = 0x1;
- const GPUFlagsConstant FRAGMENT = 0x2;
- const GPUFlagsConstant COMPUTE = 0x4;
-};
-
dictionary GPUBindGroupLayoutEntry {
required GPUIndex32 binding;
required GPUShaderStageFlags visibility;
@@ -414,6 +419,14 @@ dictionary GPUBindGroupLayoutEntry {
GPUStorageTextureBindingLayout storageTexture;
};
+typedef [EnforceRange] unsigned long GPUShaderStageFlags;
+[Exposed=(Window, DedicatedWorker)]
+namespace GPUShaderStage {
+ const GPUFlagsConstant VERTEX = 0x1;
+ const GPUFlagsConstant FRAGMENT = 0x2;
+ const GPUFlagsConstant COMPUTE = 0x4;
+};
+
enum GPUBufferBindingType {
"uniform",
"storage",
@@ -524,12 +537,16 @@ interface GPUCompilationInfo {
readonly attribute FrozenArray<GPUCompilationMessage> messages;
};
+enum GPUAutoLayoutMode {
+ "auto"
+};
+
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
- GPUPipelineLayout layout;
+ required (GPUPipelineLayout or GPUAutoLayoutMode) layout;
};
interface mixin GPUPipelineBase {
- GPUBindGroupLayout getBindGroupLayout(unsigned long index);
+ [NewObject] GPUBindGroupLayout getBindGroupLayout(unsigned long index);
};
dictionary GPUProgrammableStage {
@@ -564,14 +581,6 @@ dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
GPUFragmentState fragment;
};
-enum GPUPrimitiveTopology {
- "point-list",
- "line-list",
- "line-strip",
- "triangle-list",
- "triangle-strip",
-};
-
dictionary GPUPrimitiveState {
GPUPrimitiveTopology topology = "triangle-list";
GPUIndexFormat stripIndexFormat;
@@ -582,6 +591,14 @@ dictionary GPUPrimitiveState {
boolean unclippedDepth = false;
};
+enum GPUPrimitiveTopology {
+ "point-list",
+ "line-list",
+ "line-strip",
+ "triangle-list",
+ "triangle-strip",
+};
+
enum GPUFrontFace {
"ccw",
"cw",
@@ -600,7 +617,7 @@ dictionary GPUMultisampleState {
};
dictionary GPUFragmentState : GPUProgrammableStage {
- required sequence<GPUColorTargetState> targets;
+ required sequence<GPUColorTargetState?> targets;
};
dictionary GPUColorTargetState {
@@ -617,7 +634,7 @@ dictionary GPUBlendState {
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
[Exposed=(Window, DedicatedWorker)]
-interface GPUColorWrite {
+namespace GPUColorWrite {
const GPUFlagsConstant RED = 0x1;
const GPUFlagsConstant GREEN = 0x2;
const GPUFlagsConstant BLUE = 0x4;
@@ -758,6 +775,9 @@ GPUCommandBuffer includes GPUObjectBase;
dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase {
};
+interface mixin GPUCommandsMixin {
+};
+
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUCommandEncoder {
GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor);
@@ -786,13 +806,9 @@ interface GPUCommandEncoder {
GPUExtent3D copySize);
undefined clearBuffer(
- GPUBuffer destination,
- GPUSize64 destinationOffset,
- GPUSize64 size);
-
- undefined pushDebugGroup(USVString groupLabel);
- undefined popDebugGroup();
- undefined insertDebugMarker(USVString markerLabel);
+ GPUBuffer buffer,
+ optional GPUSize64 offset = 0,
+ optional GPUSize64 size);
undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
@@ -806,6 +822,8 @@ interface GPUCommandEncoder {
GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {});
};
GPUCommandEncoder includes GPUObjectBase;
+GPUCommandEncoder includes GPUCommandsMixin;
+GPUCommandEncoder includes GPUDebugCommandsMixin;
dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
};
@@ -827,7 +845,7 @@ dictionary GPUImageCopyTexture {
GPUTextureAspect aspect = "all";
};
-interface mixin GPUProgrammablePassEncoder {
+interface mixin GPUBindingCommandsMixin {
undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
@@ -835,7 +853,9 @@ interface mixin GPUProgrammablePassEncoder {
Uint32Array dynamicOffsetsData,
GPUSize64 dynamicOffsetsDataStart,
GPUSize32 dynamicOffsetsDataLength);
+};
+interface mixin GPUDebugCommandsMixin {
undefined pushDebugGroup(USVString groupLabel);
undefined popDebugGroup();
undefined insertDebugMarker(USVString markerLabel);
@@ -844,39 +864,24 @@ interface mixin GPUProgrammablePassEncoder {
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUComputePassEncoder {
undefined setPipeline(GPUComputePipeline pipeline);
- undefined dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1);
- undefined dispatchIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
+ undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1);
+ undefined dispatchWorkgroupsIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
undefined beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex);
undefined endPipelineStatisticsQuery();
undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
- undefined endPass();
+ undefined end();
};
GPUComputePassEncoder includes GPUObjectBase;
-GPUComputePassEncoder includes GPUProgrammablePassEncoder;
+GPUComputePassEncoder includes GPUCommandsMixin;
+GPUComputePassEncoder includes GPUDebugCommandsMixin;
+GPUComputePassEncoder includes GPUBindingCommandsMixin;
dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase {
};
-interface mixin GPURenderEncoderBase {
- undefined setPipeline(GPURenderPipeline pipeline);
-
- undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size);
- undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size);
-
- undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1,
- optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0);
- undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1,
- optional GPUSize32 firstIndex = 0,
- optional GPUSignedOffset32 baseVertex = 0,
- optional GPUSize32 firstInstance = 0);
-
- undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
- undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
-};
-
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPURenderPassEncoder {
undefined setViewport(float x, float y,
@@ -898,14 +903,16 @@ interface GPURenderPassEncoder {
undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
undefined executeBundles(sequence<GPURenderBundle> bundles);
- undefined endPass();
+ undefined end();
};
GPURenderPassEncoder includes GPUObjectBase;
-GPURenderPassEncoder includes GPUProgrammablePassEncoder;
-GPURenderPassEncoder includes GPURenderEncoderBase;
+GPURenderPassEncoder includes GPUCommandsMixin;
+GPURenderPassEncoder includes GPUDebugCommandsMixin;
+GPURenderPassEncoder includes GPUBindingCommandsMixin;
+GPURenderPassEncoder includes GPURenderCommandsMixin;
dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
- required sequence<GPURenderPassColorAttachment> colorAttachments;
+ required sequence<GPURenderPassColorAttachment?> colorAttachments;
GPURenderPassDepthStencilAttachment depthStencilAttachment;
GPUQuerySet occlusionQuerySet;
};
@@ -914,24 +921,28 @@ dictionary GPURenderPassColorAttachment {
required GPUTextureView view;
GPUTextureView resolveTarget;
- required (GPULoadOp or GPUColor) loadValue;
+ GPUColor clearValue;
+ required GPULoadOp loadOp;
required GPUStoreOp storeOp;
};
dictionary GPURenderPassDepthStencilAttachment {
required GPUTextureView view;
- required (GPULoadOp or float) depthLoadValue;
- required GPUStoreOp depthStoreOp;
+ float depthClearValue = 0;
+ GPULoadOp depthLoadOp;
+ GPUStoreOp depthStoreOp;
boolean depthReadOnly = false;
- required (GPULoadOp or GPUStencilValue) stencilLoadValue;
- required GPUStoreOp stencilStoreOp;
+ GPUStencilValue stencilClearValue = 0;
+ GPULoadOp stencilLoadOp;
+ GPUStoreOp stencilStoreOp;
boolean stencilReadOnly = false;
};
enum GPULoadOp {
"load",
+ "clear",
};
enum GPUStoreOp {
@@ -940,11 +951,28 @@ enum GPUStoreOp {
};
dictionary GPURenderPassLayout: GPUObjectDescriptorBase {
- required sequence<GPUTextureFormat> colorFormats;
+ required sequence<GPUTextureFormat?> colorFormats;
GPUTextureFormat depthStencilFormat;
GPUSize32 sampleCount = 1;
};
+interface mixin GPURenderCommandsMixin {
+ undefined setPipeline(GPURenderPipeline pipeline);
+
+ undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size);
+ undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size);
+
+ undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1,
+ optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0);
+ undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1,
+ optional GPUSize32 firstIndex = 0,
+ optional GPUSignedOffset32 baseVertex = 0,
+ optional GPUSize32 firstInstance = 0);
+
+ undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
+ undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
+};
+
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPURenderBundle {
};
@@ -958,8 +986,10 @@ interface GPURenderBundleEncoder {
GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {});
};
GPURenderBundleEncoder includes GPUObjectBase;
-GPURenderBundleEncoder includes GPUProgrammablePassEncoder;
-GPURenderBundleEncoder includes GPURenderEncoderBase;
+GPURenderBundleEncoder includes GPUCommandsMixin;
+GPURenderBundleEncoder includes GPUDebugCommandsMixin;
+GPURenderBundleEncoder includes GPUBindingCommandsMixin;
+GPURenderBundleEncoder includes GPURenderCommandsMixin;
dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout {
boolean depthReadOnly = false;
@@ -1033,17 +1063,19 @@ enum GPUErrorFilter {
};
[Exposed=(Window, DedicatedWorker), SecureContext]
-interface GPUOutOfMemoryError {
- constructor();
+interface GPUError {
+ readonly attribute DOMString message;
};
[Exposed=(Window, DedicatedWorker), SecureContext]
-interface GPUValidationError {
+interface GPUOutOfMemoryError : GPUError {
constructor(DOMString message);
- readonly attribute DOMString message;
};
-typedef (GPUOutOfMemoryError or GPUValidationError) GPUError;
+[Exposed=(Window, DedicatedWorker), SecureContext]
+interface GPUValidationError : GPUError {
+ constructor(DOMString message);
+};
partial interface GPUDevice {
undefined pushErrorScope(GPUErrorFilter filter);
@@ -1056,7 +1088,7 @@ interface GPUUncapturedErrorEvent : Event {
DOMString type,
GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict
);
- [SameObject] readonly attribute GPUError error;
+ readonly attribute GPUError error;
};
dictionary GPUUncapturedErrorEventInit : EventInit {
@@ -1108,4 +1140,3 @@ dictionary GPUExtent3DDict {
GPUIntegerCoordinate depthOrArrayLayers = 1;
};
typedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D;
-