Skip to content

Commit 53efbce

Browse files
authored
Roll gpuweb 3745c1d -> 4660d83 (gpuweb#101)
1 parent d67592a commit 53efbce

File tree

3 files changed

+234
-52
lines changed

3 files changed

+234
-52
lines changed

dist/index.d.ts

Lines changed: 120 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,13 @@ type GPUBufferBindingType =
130130
| "uniform"
131131
| "storage"
132132
| "read-only-storage";
133-
type GPUCanvasCompositingAlphaMode =
133+
type GPUCanvasAlphaMode =
134134

135135
| "opaque"
136136
| "premultiplied";
137+
/** @deprecated use GPUCanvasAlphaMode instead */
138+
type GPUCanvasCompositingAlphaMode =
139+
GPUCanvasAlphaMode;
137140
type GPUCompareFunction =
138141

139142
| "never"
@@ -558,13 +561,42 @@ interface GPUBufferDescriptor
558561
}
559562

560563
interface GPUCanvasConfiguration {
564+
/**
565+
* The {@link GPUDevice} that textures returned by {@link GPUCanvasContext#getCurrentTexture} will be
566+
* compatible with.
567+
*/
561568
device: GPUDevice;
569+
/**
570+
* The format that textures returned by {@link GPUCanvasContext#getCurrentTexture} will have.
571+
* Must be one of the Supported context formats.
572+
*/
562573
format: GPUTextureFormat;
574+
/**
575+
* The usage that textures returned by {@link GPUCanvasContext#getCurrentTexture} will have.
576+
* {@link GPUTextureUsage#RENDER_ATTACHMENT} is the default, but is not automatically included
577+
* if the usage is explicitly set. Be sure to include {@link GPUTextureUsage#RENDER_ATTACHMENT}
578+
* when setting a custom usage if you wish to use textures returned by
579+
* {@link GPUCanvasContext#getCurrentTexture} as color targets for a render pass.
580+
*/
563581
usage?: GPUTextureUsageFlags;
582+
/**
583+
* The formats that views created from textures returned by
584+
* {@link GPUCanvasContext#getCurrentTexture} may use.
585+
*/
564586
viewFormats?: Iterable<GPUTextureFormat>;
587+
/**
588+
* The color space that values written into textures returned by
589+
* {@link GPUCanvasContext#getCurrentTexture} should be displayed with.
590+
*/
565591
colorSpace?: GPUPredefinedColorSpace;
592+
/**
593+
* Determines the effect that alpha values will have on the content of textures returned by
594+
* {@link GPUCanvasContext#getCurrentTexture} when read, displayed, or used as an image source.
595+
*/
596+
alphaMode?: GPUCanvasAlphaMode;
597+
/** @deprecated use alphaMode instead (it is specified to affect the behavior of reading from the canvas) */
566598
compositingAlphaMode?: GPUCanvasCompositingAlphaMode;
567-
/** @deprecated */
599+
/** @deprecated use the canvas width/height instead */
568600
size?: GPUExtent3D;
569601
}
570602

@@ -602,6 +634,9 @@ interface GPUComputePassTimestampWrite {
602634

603635
interface GPUComputePipelineDescriptor
604636
extends GPUPipelineDescriptorBase {
637+
/**
638+
* Describes the compute shader entry point of the pipeline.
639+
*/
605640
compute: GPUProgrammableStage;
606641
}
607642

@@ -763,21 +798,19 @@ interface GPUImageCopyTextureTagged
763798
* being written to the target texture, if its format can represent them.
764799
* Otherwise, the results are clamped to the target texture format's range.
765800
* Note:
766-
* If {@link GPUImageCopyTextureTagged#colorSpace} matches the source image, no conversion occurs.
767-
* {@link ImageBitmap} color space tagging and conversion can be controlled via {@link ImageBitmapOptions}.
801+
* If {@link GPUImageCopyTextureTagged#colorSpace} matches the source image,
802+
* conversion may not be necessary. See [[#color-space-conversion-elision]].
768803
*/
769804
colorSpace?: GPUPredefinedColorSpace;
770805
/**
771-
* Describes whether the data written into the texture should be have its RGB channels
806+
* Describes whether the data written into the texture should have its RGB channels
772807
* premultiplied by the alpha channel, or not.
773808
* If this option is set to `true` and the {@link GPUImageCopyExternalImage#source} is also
774809
* premultiplied, the source RGB values must be preserved even if they exceed their
775810
* corresponding alpha values.
776811
* Note:
777-
* If {@link GPUImageCopyTextureTagged#premultipliedAlpha} matches the source image, no conversion occurs.
778-
* 2d canvases are [[html#premultiplied-alpha-and-the-2d-rendering-context|always premultiplied]],
779-
* while WebGL canvases can be controlled via <l spec=html>WebGLContextAttributes</l>.
780-
* {@link ImageBitmap} premultiplication can be controlled via {@link ImageBitmapOptions}.
812+
* If {@link GPUImageCopyTextureTagged#premultipliedAlpha} matches the source image,
813+
* conversion may not be necessary. See [[#color-space-conversion-elision]].
781814
*/
782815
premultipliedAlpha?: boolean;
783816
}
@@ -817,7 +850,7 @@ interface GPUMultisampleState {
817850
mask?: GPUSampleMask;
818851
/**
819852
* When `true` indicates that a fragment's alpha channel should be used to generate a sample
820-
* covarge mask.
853+
* coverage mask.
821854
*/
822855
alphaToCoverageEnabled?: boolean;
823856
}
@@ -859,7 +892,7 @@ interface GPUPipelineLayoutDescriptor
859892

860893
interface GPUPrimitiveState {
861894
/**
862-
* The type of primitive to be constructed from the vertex inptus.
895+
* The type of primitive to be constructed from the vertex inputs.
863896
*/
864897
topology?: GPUPrimitiveTopology;
865898
/**
@@ -1054,10 +1087,26 @@ interface GPURenderPassTimestampWrite {
10541087

10551088
interface GPURenderPipelineDescriptor
10561089
extends GPUPipelineDescriptorBase {
1090+
/**
1091+
* Describes the vertex shader entry point of the pipeline and its input buffer layouts.
1092+
*/
10571093
vertex: GPUVertexState;
1094+
/**
1095+
* Describes the primitive-related properties of the pipeline.
1096+
*/
10581097
primitive?: GPUPrimitiveState;
1098+
/**
1099+
* Describes the optional depth-stencil properties, including the testing, operations, and bias.
1100+
*/
10591101
depthStencil?: GPUDepthStencilState;
1102+
/**
1103+
* Describes the multi-sampling properties of the pipeline.
1104+
*/
10601105
multisample?: GPUMultisampleState;
1106+
/**
1107+
* Describes the fragment shader entry point of the pipeline and its output colors. If
1108+
* `undefined`, the [[#no-color-output]] mode is enabled.
1109+
*/
10611110
fragment?: GPUFragmentState;
10621111
}
10631112

@@ -1130,7 +1179,7 @@ interface GPUShaderModuleCompilationHint {
11301179
* If set to {@link GPUAutoLayoutMode#"auto"} the layout will be the [$default pipeline layout$]
11311180
* for the entry point associated with this hint will be used.
11321181
*/
1133-
layout:
1182+
layout?:
11341183
| GPUPipelineLayout
11351184
| GPUAutoLayoutMode;
11361185
}
@@ -1581,10 +1630,7 @@ interface GPUAdapter {
15811630
* @internal
15821631
*/
15831632
readonly __brand: "GPUAdapter";
1584-
/**
1585-
* A human-readable name identifying the adapter.
1586-
* The contents are implementation-defined.
1587-
*/
1633+
/** @deprecated use requestAdapterInfo instead */
15881634
readonly name: string;
15891635
/**
15901636
* The set of values in `this`.{@link GPUAdapter#[[adapter]]}.{@link adapter#[[features]]}.
@@ -1605,13 +1651,63 @@ interface GPUAdapter {
16051651
requestDevice(
16061652
descriptor?: GPUDeviceDescriptor
16071653
): Promise<GPUDevice>;
1654+
/**
1655+
* Requests the {@link GPUAdapterInfo} for this {@link GPUAdapter}.
1656+
* Note: Adapter info values are returned with a Promise to give user agents an
1657+
* opportunity to perform potentially long-running checks when requesting unmasked values,
1658+
* such as asking for user consent before returning. If no `unmaskHints` are specified,
1659+
* however, no dialogs should be displayed to the user.
1660+
* @param unmaskHints - A list of {@link GPUAdapterInfo} attribute names for which unmasked
1661+
* values are desired if available.
1662+
*/
1663+
requestAdapterInfo(
1664+
unmaskHints?: Array<string>
1665+
): Promise<GPUAdapterInfo>;
16081666
}
16091667

16101668
declare var GPUAdapter: {
16111669
prototype: GPUAdapter;
16121670
new (): never;
16131671
};
16141672

1673+
interface GPUAdapterInfo {
1674+
/**
1675+
* Nominal type branding.
1676+
* https://github.com/microsoft/TypeScript/pull/33038
1677+
* @internal
1678+
*/
1679+
readonly __brand: "GPUAdapterInfo";
1680+
/**
1681+
* The name of the vendor of the adapter, if available. Empty string otherwise.
1682+
*/
1683+
readonly vendor: string;
1684+
/**
1685+
* The name of the family or class of GPUs the adapter belongs to, if available. Empty
1686+
* string otherwise.
1687+
*/
1688+
readonly architecture: string;
1689+
/**
1690+
* A vendor-specific identifier for the adapter, if available. Empty string otherwise.
1691+
* Note: This is a value that represents the type of adapter. For example, it may be a
1692+
* [PCI device ID](https://pcisig.com/). It does not uniquely identify a given piece of
1693+
* hardware like a serial number.
1694+
*/
1695+
readonly device: string;
1696+
/**
1697+
* A human readable string describing the adapter as reported by the driver, if available.
1698+
* Empty string otherwise.
1699+
* Note: Because no formatting is applied to {@link GPUAdapterInfo#description} attempting to parse
1700+
* this value is not recommended. Applications which change their behavior based on the
1701+
* {@link GPUAdapterInfo}, such as applying workarounds for known driver issues, should rely on the
1702+
* other fields when possible.
1703+
*/
1704+
readonly description: string;
1705+
}
1706+
1707+
declare var GPUAdapterInfo: {
1708+
prototype: GPUAdapterInfo;
1709+
};
1710+
16151711
interface GPUBindGroup
16161712
extends GPUObjectBase {
16171713
/**
@@ -1704,8 +1800,8 @@ interface GPUCanvasContext {
17041800
| HTMLCanvasElement
17051801
| OffscreenCanvas;
17061802
/**
1707-
* Configures the context for this canvas. Destroys any textures produced with a previous
1708-
* configuration.
1803+
* Configures the context for this canvas.
1804+
* This clears the drawing buffer to transparent black (in [$Replace the drawing buffer$]).
17091805
* @param configuration - Desired configuration for the context.
17101806
*/
17111807
configure(
@@ -1715,23 +1811,18 @@ interface GPUCanvasContext {
17151811
* Removes the context configuration. Destroys any textures produced while configured.
17161812
*/
17171813
unconfigure(): undefined;
1718-
/**
1719-
* @deprecated Use {@link GPU#getPreferredCanvasFormat} instead.
1720-
* Returns an optimal {@link GPUTextureFormat} to use with this context and devices created from
1721-
* the given adapter.
1722-
* @param adapter - Adapter the format should be queried for.
1723-
*/
1814+
/** @deprecated Use {@link GPU#getPreferredCanvasFormat} instead. */
17241815
getPreferredFormat(
17251816
adapter: GPUAdapter
17261817
): GPUTextureFormat;
17271818
/**
17281819
* Get the {@link GPUTexture} that will be composited to the document by the {@link GPUCanvasContext}
17291820
* next.
1730-
* Note: Developers can expect that the same {@link GPUTexture} object will be returned by every
1821+
* Note: The same {@link GPUTexture} object will be returned by every
17311822
* call to {@link GPUCanvasContext#getCurrentTexture} made within the same frame (i.e. between
1732-
* invocations of the "update the rendering or user interface of that `Document`" sub-step of
1733-
* the "Update the rendering" step) unless the current texture has been
1734-
* [$Invalidate the current texture|invalidated$].
1823+
* invocations of "[$update the rendering of the WebGPU canvas$]"), even if that {@link GPUTexture}
1824+
* is destroyed, failed validation, or failed to allocate, **unless** the current texture has
1825+
* been removed (in [$Replace the drawing buffer$]).
17351826
*/
17361827
getCurrentTexture(): GPUTexture;
17371828
}
@@ -2622,6 +2713,7 @@ interface GPUSupportedLimits {
26222713
readonly maxVertexAttributes: number;
26232714
readonly maxVertexBufferArrayStride: number;
26242715
readonly maxInterStageShaderComponents: number;
2716+
readonly maxInterStageShaderVariables: number;
26252717
readonly maxComputeWorkgroupStorageSize: number;
26262718
readonly maxComputeInvocationsPerWorkgroup: number;
26272719
readonly maxComputeWorkgroupSizeX: number;

0 commit comments

Comments
 (0)