diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2023-01-30 15:14:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-30 15:14:16 +0100 |
commit | 3035dee9f14402f57d42ff0b362152140b4dca13 (patch) | |
tree | b9a3d3d36e368b3585970ffe00127c90e16b7a09 /ext/webgpu/webgpu.idl | |
parent | 266915d5ce354fde12b20f8f5ceb5ffdfacb7983 (diff) |
chore: update webgpu (#17534)
Diffstat (limited to 'ext/webgpu/webgpu.idl')
-rw-r--r-- | ext/webgpu/webgpu.idl | 206 |
1 files changed, 116 insertions, 90 deletions
diff --git a/ext/webgpu/webgpu.idl b/ext/webgpu/webgpu.idl index cda505715..4b8865e30 100644 --- a/ext/webgpu/webgpu.idl +++ b/ext/webgpu/webgpu.idl @@ -13,6 +13,7 @@ interface GPUSupportedLimits { readonly attribute unsigned long maxTextureDimension3D; readonly attribute unsigned long maxTextureArrayLayers; readonly attribute unsigned long maxBindGroups; + readonly attribute unsigned long maxBindingsPerBindGroup; readonly attribute unsigned long maxDynamicUniformBuffersPerPipelineLayout; readonly attribute unsigned long maxDynamicStorageBuffersPerPipelineLayout; readonly attribute unsigned long maxSampledTexturesPerShaderStage; @@ -25,6 +26,7 @@ interface GPUSupportedLimits { readonly attribute unsigned long minUniformBufferOffsetAlignment; readonly attribute unsigned long minStorageBufferOffsetAlignment; readonly attribute unsigned long maxVertexBuffers; + readonly attribute unsigned long long maxBufferSize; readonly attribute unsigned long maxVertexAttributes; readonly attribute unsigned long maxVertexBufferArrayStride; readonly attribute unsigned long maxInterStageShaderComponents; @@ -43,14 +45,10 @@ interface GPUSupportedFeatures { [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", + readonly attribute DOMString vendor; + readonly attribute DOMString architecture; + readonly attribute DOMString device; + readonly attribute DOMString description; }; interface mixin NavigatorGPU { @@ -71,7 +69,7 @@ dictionary GPURequestAdapterOptions { enum GPUPowerPreference { "low-power", - "high-performance", + "high-performance" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -91,7 +89,6 @@ dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase { enum GPUFeatureName { "depth-clip-control", - "depth24unorm-stencil8", "depth32float-stencil8", "texture-compression-bc", "texture-compression-etc2", @@ -133,6 +130,11 @@ GPUDevice includes GPUObjectBase; [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUBuffer { + readonly attribute GPUSize64 size; + readonly attribute GPUBufferUsageFlags usage; + + readonly attribute GPUBufferMapState mapState; + Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); undefined unmap(); @@ -141,6 +143,12 @@ interface GPUBuffer { }; GPUBuffer includes GPUObjectBase; +enum GPUBufferMapState { + "unmapped", + "pending", + "mapped" +}; + dictionary GPUBufferDescriptor : GPUObjectDescriptorBase { required GPUSize64 size; required GPUBufferUsageFlags usage; @@ -174,6 +182,15 @@ interface GPUTexture { GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); undefined destroy(); + + readonly attribute GPUIntegerCoordinate width; + readonly attribute GPUIntegerCoordinate height; + readonly attribute GPUIntegerCoordinate depthOrArrayLayers; + readonly attribute GPUIntegerCoordinate mipLevelCount; + readonly attribute GPUSize32 sampleCount; + readonly attribute GPUTextureDimension dimension; + readonly attribute GPUTextureFormat format; + readonly attribute GPUTextureUsageFlags usage; }; GPUTexture includes GPUObjectBase; @@ -184,12 +201,13 @@ dictionary GPUTextureDescriptor : GPUObjectDescriptorBase { GPUTextureDimension dimension = "2d"; required GPUTextureFormat format; required GPUTextureUsageFlags usage; + sequence<GPUTextureFormat> viewFormats = []; }; enum GPUTextureDimension { "1d", "2d", - "3d", + "3d" }; typedef [EnforceRange] unsigned long GPUTextureUsageFlags; @@ -223,13 +241,13 @@ enum GPUTextureViewDimension { "2d-array", "cube", "cube-array", - "3d", + "3d" }; enum GPUTextureAspect { "all", "stencil-only", - "depth-only", + "depth-only" }; enum GPUTextureFormat { @@ -287,9 +305,6 @@ enum GPUTextureFormat { "depth24plus-stencil8", "depth32float", - // "depth24unorm-stencil8" feature - "depth24unorm-stencil8", - // "depth32float-stencil8" feature "depth32float-stencil8", @@ -352,7 +367,7 @@ enum GPUTextureFormat { "astc-12x10-unorm", "astc-12x10-unorm-srgb", "astc-12x12-unorm", - "astc-12x12-unorm-srgb", + "astc-12x12-unorm-srgb" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -376,17 +391,17 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase { enum GPUAddressMode { "clamp-to-edge", "repeat", - "mirror-repeat", + "mirror-repeat" }; enum GPUFilterMode { "nearest", - "linear", + "linear" }; enum GPUMipmapFilterMode { "nearest", - "linear", + "linear" }; enum GPUCompareFunction { @@ -397,7 +412,7 @@ enum GPUCompareFunction { "greater", "not-equal", "greater-equal", - "always", + "always" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -430,7 +445,7 @@ namespace GPUShaderStage { enum GPUBufferBindingType { "uniform", "storage", - "read-only-storage", + "read-only-storage" }; dictionary GPUBufferBindingLayout { @@ -442,7 +457,7 @@ dictionary GPUBufferBindingLayout { enum GPUSamplerBindingType { "filtering", "non-filtering", - "comparison", + "comparison" }; dictionary GPUSamplerBindingLayout { @@ -454,7 +469,7 @@ enum GPUTextureSampleType { "unfilterable-float", "depth", "sint", - "uint", + "uint" }; dictionary GPUTextureBindingLayout { @@ -464,7 +479,7 @@ dictionary GPUTextureBindingLayout { }; enum GPUStorageTextureAccess { - "write-only", + "write-only" }; dictionary GPUStorageTextureBindingLayout { @@ -513,13 +528,12 @@ GPUShaderModule includes GPUObjectBase; dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { required USVString code; - object sourceMap; }; enum GPUCompilationMessageType { "error", "warning", - "info", + "info" }; [Exposed=(Window, DedicatedWorker), Serializable, SecureContext] @@ -555,7 +569,7 @@ dictionary GPUProgrammableStage { record<USVString, GPUPipelineConstantValue> constants; }; -typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32. +typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32, and f16 if enabled. [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUComputePipeline { @@ -596,18 +610,18 @@ enum GPUPrimitiveTopology { "line-list", "line-strip", "triangle-list", - "triangle-strip", + "triangle-strip" }; enum GPUFrontFace { "ccw", - "cw", + "cw" }; enum GPUCullMode { "none", "front", - "back", + "back" }; dictionary GPUMultisampleState { @@ -661,7 +675,7 @@ enum GPUBlendFactor { "one-minus-dst-alpha", "src-alpha-saturated", "constant", - "one-minus-constant", + "one-minus-constant" }; enum GPUBlendOperation { @@ -669,7 +683,7 @@ enum GPUBlendOperation { "subtract", "reverse-subtract", "min", - "max", + "max" }; dictionary GPUDepthStencilState { @@ -704,12 +718,12 @@ enum GPUStencilOperation { "increment-clamp", "decrement-clamp", "increment-wrap", - "decrement-wrap", + "decrement-wrap" }; enum GPUIndexFormat { "uint16", - "uint32", + "uint32" }; enum GPUVertexFormat { @@ -742,12 +756,12 @@ enum GPUVertexFormat { "sint32", "sint32x2", "sint32x3", - "sint32x4", + "sint32x4" }; enum GPUVertexStepMode { "vertex", - "instance", + "instance" }; dictionary GPUVertexState : GPUProgrammableStage { @@ -767,6 +781,23 @@ dictionary GPUVertexAttribute { required GPUIndex32 shaderLocation; }; +dictionary GPUImageDataLayout { + GPUSize64 offset = 0; + GPUSize32 bytesPerRow; + GPUSize32 rowsPerImage; +}; + +dictionary GPUImageCopyBuffer : GPUImageDataLayout { + required GPUBuffer buffer; +}; + +dictionary GPUImageCopyTexture { + required GPUTexture texture; + GPUIntegerCoordinate mipLevel = 0; + GPUOrigin3D origin = {}; + GPUTextureAspect aspect = "all"; +}; + [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUCommandBuffer { }; @@ -828,31 +859,14 @@ GPUCommandEncoder includes GPUDebugCommandsMixin; dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { }; -dictionary GPUImageDataLayout { - GPUSize64 offset = 0; - GPUSize32 bytesPerRow; - GPUSize32 rowsPerImage; -}; - -dictionary GPUImageCopyBuffer : GPUImageDataLayout { - required GPUBuffer buffer; -}; - -dictionary GPUImageCopyTexture { - required GPUTexture texture; - GPUIntegerCoordinate mipLevel = 0; - GPUOrigin3D origin = {}; - GPUTextureAspect aspect = "all"; -}; - interface mixin GPUBindingCommandsMixin { undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, - optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []); + optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []); undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, - Uint32Array dynamicOffsetsData, - GPUSize64 dynamicOffsetsDataStart, - GPUSize32 dynamicOffsetsDataLength); + Uint32Array dynamicOffsetsData, + GPUSize64 dynamicOffsetsDataStart, + GPUSize32 dynamicOffsetsDataLength); }; interface mixin GPUDebugCommandsMixin { @@ -885,8 +899,8 @@ dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase { [Exposed=(Window, DedicatedWorker), SecureContext] interface GPURenderPassEncoder { undefined setViewport(float x, float y, - float width, float height, - float minDepth, float maxDepth); + float width, float height, + float minDepth, float maxDepth); undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y, GPUIntegerCoordinate width, GPUIntegerCoordinate height); @@ -914,7 +928,6 @@ GPURenderPassEncoder includes GPURenderCommandsMixin; dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase { required sequence<GPURenderPassColorAttachment?> colorAttachments; GPURenderPassDepthStencilAttachment depthStencilAttachment; - GPUQuerySet occlusionQuerySet; }; dictionary GPURenderPassColorAttachment { @@ -942,15 +955,15 @@ dictionary GPURenderPassDepthStencilAttachment { enum GPULoadOp { "load", - "clear", + "clear" }; enum GPUStoreOp { "store", - "discard", + "discard" }; -dictionary GPURenderPassLayout: GPUObjectDescriptorBase { +dictionary GPURenderPassLayout : GPUObjectDescriptorBase { required sequence<GPUTextureFormat?> colorFormats; GPUTextureFormat depthStencilFormat; GPUSize32 sampleCount = 1; @@ -963,11 +976,11 @@ interface mixin GPURenderCommandsMixin { 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); + 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); + optional GPUSize32 firstIndex = 0, + optional GPUSignedOffset32 baseVertex = 0, + optional GPUSize32 firstInstance = 0); undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); @@ -1020,6 +1033,9 @@ GPUQueue includes GPUObjectBase; [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUQuerySet { undefined destroy(); + + readonly attribute GPUQueryType type; + readonly attribute GPUSize32 count; }; GPUQuerySet includes GPUObjectBase; @@ -1032,7 +1048,7 @@ dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase { enum GPUQueryType { "occlusion", "pipeline-statistics", - "timestamp", + "timestamp" }; enum GPUPipelineStatisticName { @@ -1043,8 +1059,31 @@ enum GPUPipelineStatisticName { "compute-shader-invocations", }; +[Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUCanvasContext { + readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; + + undefined configure(GPUCanvasConfiguration configuration); + undefined unconfigure(); + + GPUTexture getCurrentTexture(); +}; + +enum GPUCanvasAlphaMode { + "opaque", + "premultiplied" +}; + +dictionary GPUCanvasConfiguration { + required GPUDevice device; + required GPUTextureFormat format; + GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT + GPUCanvasAlphaMode alphaMode = "opaque"; + sequence<GPUTextureFormat> viewFormats = []; +}; + enum GPUDeviceLostReason { - "destroyed", + "destroyed" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -1057,44 +1096,31 @@ partial interface GPUDevice { readonly attribute Promise<GPUDeviceLostInfo> lost; }; -enum GPUErrorFilter { - "out-of-memory", - "validation", -}; - [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUError { readonly attribute DOMString message; }; [Exposed=(Window, DedicatedWorker), SecureContext] -interface GPUOutOfMemoryError : GPUError { +interface GPUValidationError : GPUError { constructor(DOMString message); }; [Exposed=(Window, DedicatedWorker), SecureContext] -interface GPUValidationError : GPUError { +interface GPUOutOfMemoryError : GPUError { constructor(DOMString message); }; +enum GPUErrorFilter { + "validation", + "out-of-memory" +}; + partial interface GPUDevice { undefined pushErrorScope(GPUErrorFilter filter); Promise<GPUError?> popErrorScope(); }; -[Exposed=(Window, DedicatedWorker), SecureContext] -interface GPUUncapturedErrorEvent : Event { - constructor( - DOMString type, - GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict - ); - readonly attribute GPUError error; -}; - -dictionary GPUUncapturedErrorEventInit : EventInit { - required GPUError error; -}; - partial interface GPUDevice { [Exposed=(Window, DedicatedWorker)] attribute EventHandler onuncapturederror; |