diff --git a/.github/workflows/package-size-check.js b/.github/workflows/package-size-check.js index ea58509b211..8f30f2e8099 100644 --- a/.github/workflows/package-size-check.js +++ b/.github/workflows/package-size-check.js @@ -11,7 +11,9 @@ const features = []; files.forEach(file => { const filePath = ps.join(exportsDir, file); const feature = ps.parse(ps.basename(filePath)).name; - features.push(feature); + if (feature !== 'vendor') { + features.push(feature); + } }); console.log(`features: [ ${features.join(', ')} ]`); diff --git a/@types/webGPU.d.ts b/@types/webGPU.d.ts index 8b2bebe872b..4d8b09d919d 100644 --- a/@types/webGPU.d.ts +++ b/@types/webGPU.d.ts @@ -68,15 +68,8 @@ type GPUColor = | GPUColorDict; type GPUColorWriteFlags = number; -type GPUDepthBias = - number; -type GPUExtent3D = - - | Iterable - | GPUExtent3DDict; -type GPUFlagsConstant = - number; -type GPUImageCopyExternalImageSource = +declare interface VideoFrame {} +type GPUCopyExternalImageSource = | ImageBitmap | ImageData @@ -85,6 +78,14 @@ type GPUImageCopyExternalImageSource = | VideoFrame | HTMLCanvasElement | OffscreenCanvas; +type GPUDepthBias = + number; +type GPUExtent3D = + + | Iterable + | GPUExtent3DDict; +type GPUFlagsConstant = + number; type GPUIndex32 = number; type GPUIntegerCoordinate = @@ -142,7 +143,11 @@ type GPUBlendFactor = | 'one-minus-dst-alpha' | 'src-alpha-saturated' | 'constant' - | 'one-minus-constant'; + | 'one-minus-constant' + | 'src1' + | 'one-minus-src1' + | 'src1-alpha' + | 'one-minus-src1-alpha'; type GPUBlendOperation = | 'add' @@ -164,6 +169,10 @@ type GPUCanvasAlphaMode = | 'opaque' | 'premultiplied'; +type GPUCanvasToneMappingMode = + + | 'standard' + | 'extended'; type GPUCompareFunction = | 'never' @@ -198,14 +207,19 @@ type GPUFeatureName = | 'depth-clip-control' | 'depth32float-stencil8' | 'texture-compression-bc' + | 'texture-compression-bc-sliced-3d' | 'texture-compression-etc2' | 'texture-compression-astc' + | 'texture-compression-astc-sliced-3d' | 'timestamp-query' | 'indirect-first-instance' | 'shader-f16' | 'rg11b10ufloat-renderable' | 'bgra8unorm-storage' - | 'float32-filterable'; + | 'float32-filterable' + | 'float32-blendable' + | 'clip-distances' + | 'dual-source-blending'; type GPUFilterMode = | 'nearest' @@ -393,22 +407,31 @@ type GPUTextureViewDimension = | '3d'; type GPUVertexFormat = + | 'uint8' | 'uint8x2' | 'uint8x4' + | 'sint8' | 'sint8x2' | 'sint8x4' + | 'unorm8' | 'unorm8x2' | 'unorm8x4' + | 'snorm8' | 'snorm8x2' | 'snorm8x4' + | 'uint16' | 'uint16x2' | 'uint16x4' + | 'sint16' | 'sint16x2' | 'sint16x4' + | 'unorm16' | 'unorm16x2' | 'unorm16x4' + | 'snorm16' | 'snorm16x2' | 'snorm16x4' + | 'float16' | 'float16x2' | 'float16x4' | 'float32' @@ -423,7 +446,8 @@ type GPUVertexFormat = | 'sint32x2' | 'sint32x3' | 'sint32x4' - | 'unorm10-10-10-2'; + | 'unorm10-10-10-2' + | 'unorm8x4-bgra'; type GPUVertexStepMode = | 'vertex' @@ -458,6 +482,9 @@ interface GPUBindGroupEntry { interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase { + /** + * A list of entries describing the shader resource bindings for a bind group. + */ entries: Iterable; } @@ -574,7 +601,7 @@ interface GPUBufferBindingLayout { */ minBindingSize?: GPUSize64; } -type PredefinedGPUColorSpace = 'display-p3' | 'srgb'; + interface GPUBufferDescriptor extends GPUObjectDescriptorBase { /** @@ -625,7 +652,12 @@ interface GPUCanvasConfiguration { * The color space that values written into textures returned by * {@link GPUCanvasContext#getCurrentTexture} should be displayed with. */ - colorSpace?: PredefinedGPUColorSpace; + colorSpace?: PredefinedColorSpace; + /** + * The tone mapping determines how the content of textures returned by + * {@link GPUCanvasContext#getCurrentTexture} are to be displayed. + */ + toneMapping?: GPUCanvasToneMapping; /** * Determines the effect that alpha values will have on the content of textures returned by * {@link GPUCanvasContext#getCurrentTexture} when read, displayed, or used as an image source. @@ -633,6 +665,25 @@ interface GPUCanvasConfiguration { alphaMode?: GPUCanvasAlphaMode; } +interface GPUCanvasConfigurationOut + extends Required< + Omit< + GPUCanvasConfiguration, + 'toneMapping' + > + > { + /** {@inheritDoc GPUCanvasConfiguration.viewFormats} */ + viewFormats: GPUTextureFormat[]; + /** + * {@inheritDoc GPUCanvasConfiguration.toneMapping} + */ + toneMapping?: GPUCanvasToneMapping; +} + +interface GPUCanvasToneMapping { + mode?: GPUCanvasToneMappingMode; +} + interface GPUColorDict { /** * The red channel value. @@ -709,6 +760,53 @@ interface GPUComputePipelineDescriptor compute: GPUProgrammableStage; } +interface GPUCopyExternalImageDestInfo + extends GPUTexelCopyTextureInfo { + /** + * Describes the color space and encoding used to encode data into the destination texture. + * This [[#color-space-conversions|may result]] in values outside of the range [0, 1] + * being written to the target texture, if its format can represent them. + * Otherwise, the results are clamped to the target texture format's range. + * Note: + * If {@link GPUCopyExternalImageDestInfo#colorSpace} matches the source image, + * conversion may not be necessary. See [[#color-space-conversion-elision]]. + */ + colorSpace?: PredefinedColorSpace; + /** + * Describes whether the data written into the texture should have its RGB channels + * premultiplied by the alpha channel, or not. + * If this option is set to `true` and the {@link GPUCopyExternalImageSourceInfo#source} is also + * premultiplied, the source RGB values must be preserved even if they exceed their + * corresponding alpha values. + * Note: + * If {@link GPUCopyExternalImageDestInfo#premultipliedAlpha} matches the source image, + * conversion may not be necessary. See [[#color-space-conversion-elision]]. + */ + premultipliedAlpha?: boolean; +} + +interface GPUCopyExternalImageSourceInfo { + /** + * The source of the texel copy. The copy source data is captured at the moment that + * {@link GPUQueue#copyExternalImageToTexture} is issued. Source size is determined as described + * by the external source dimensions table. + */ + source: GPUCopyExternalImageSource; + /** + * Defines the origin of the copy - the minimum (top-left) corner of the source sub-region to copy from. + * Together with `copySize`, defines the full copy sub-region. + */ + origin?: GPUOrigin2D; + /** + * Describes whether the source image is vertically flipped, or not. + * If this option is set to `true`, the copy is flipped vertically: the bottom row of the source + * region is copied into the first row of the destination region, and so on. + * The {@link GPUCopyExternalImageSourceInfo#origin} option is still relative to the top-left corner + * of the source image, increasing downward. + */ + flipY?: boolean; +} + interface GPUDepthStencilState { /** * The {@link GPUTextureViewDescriptor#format} of {@link GPURenderPassDescriptor#depthStencilAttachment} @@ -744,15 +842,15 @@ interface GPUDepthStencilState { */ stencilWriteMask?: GPUStencilValue; /** - * Constant depth bias added to each fragment. See [$biased fragment depth$] for details. + * Constant depth bias added to each triangle fragment. See [$biased fragment depth$] for details. */ depthBias?: GPUDepthBias; /** - * Depth bias that scales with the fragment’s slope. See [$biased fragment depth$] for details. + * Depth bias that scales with the triangle fragment’s slope. See [$biased fragment depth$] for details. */ depthBiasSlopeScale?: number; /** - * The maximum depth bias of a fragment. See [$biased fragment depth$] for details. + * The maximum depth bias of a triangle fragment. See [$biased fragment depth$] for details. */ depthBiasClamp?: number; } @@ -769,9 +867,9 @@ interface GPUDeviceDescriptor /** * Specifies the limits that are required by the device request. * The request will fail if the adapter cannot provide these limits. - * Each key must be the name of a member of supported limits. - * Exactly the specified limits, and no limit/better or worse, - * will be allowed in validation of API calls on the resulting device. + * Each key with a non-`undefined` value must be the name of a member of supported limits. + * API calls on the resulting device perform validation according to the exact limits of the + * device (not the adapter; see [[#limits]]). *