Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gpuweb #155

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 37 additions & 74 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ type GPUCanvasAlphaMode =
| "premultiplied";
type GPUCanvasToneMappingMode =

| "standard"
| "extended";
| "standard"
| "extended";
type GPUCompareFunction =

| "never"
Expand Down Expand Up @@ -206,8 +206,10 @@ 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"
Expand Down Expand Up @@ -766,15 +768,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;
}
Expand All @@ -791,17 +793,18 @@ 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]]).
* <!-- If we ever need limit types other than GPUSize32/GPUSize64, we can change the value
* type to `double` or `any` in the future and write out the type conversion explicitly (by
* reference to WebIDL spec). Or change the entire type to `any` and add back a `dictionary
* GPULimits` and define the conversion of the whole object by reference to WebIDL. -->
*/
requiredLimits?: Record<
string,
GPUSize64
| GPUSize64
| undefined
>;
/**
* The descriptor for the default {@link GPUQueue}.
Expand Down Expand Up @@ -832,7 +835,8 @@ interface GPUExternalTextureBindingLayout {}
interface GPUExternalTextureDescriptor
extends GPUObjectDescriptorBase {
/**
* The video source to import the external texture from.
* The video source to import the external texture from. Source size is determined as described
* by the external source dimensions table.
*/
source:
| HTMLVideoElement
Expand Down Expand Up @@ -865,50 +869,8 @@ interface GPUImageCopyBuffer
interface GPUImageCopyExternalImage {
/**
* The source of the image copy. The copy source data is captured at the moment that
* {@link GPUQueue#copyExternalImageToTexture} is issued. Source size is defined by source
* type, given by this table:
* <table class=data>
* <thead>
* <tr>
* <th>Source type
* <th>Dimensions
* </thead>
* <tbody>
* <tr>
* <td>{@link ImageBitmap}
* <td>{@link ImageBitmap#width|ImageBitmap.width},
* {@link ImageBitmap#height|ImageBitmap.height}
* <tr>
* <td>{@link HTMLImageElement}
* <td>{@link HTMLImageElement#naturalWidth|HTMLImageElement.naturalWidth},
* {@link HTMLImageElement#naturalHeight|HTMLImageElement.naturalHeight}
* <tr>
* <td>{@link HTMLVideoElement}
* <td>video/intrinsic width|intrinsic width of the frame,
* video/intrinsic height|intrinsic height of the frame
* <tr>
* <td>{@link VideoFrame}
* <td>{@link VideoFrame#codedWidth|VideoFrame.codedWidth},
* {@link VideoFrame#codedHeight|VideoFrame.codedHeight}
* <tr>
* <td>{@link ImageData}
* <td>{@link ImageData#width|ImageData.width},
* {@link ImageData#height|ImageData.height}
* <tr>
* <td>{@link HTMLCanvasElement} or {@link OffscreenCanvas} with {@link CanvasRenderingContext2D} or {@link GPUCanvasContext}
* <td>{@link HTMLCanvasElement#width|HTMLCanvasElement.width},
* {@link HTMLCanvasElement#height|HTMLCanvasElement.height}
* <tr>
* <td>{@link HTMLCanvasElement} or {@link OffscreenCanvas} with {@link WebGLRenderingContextBase}
* <td>{@link WebGLRenderingContextBase#drawingBufferWidth|WebGLRenderingContextBase.drawingBufferWidth},
* {@link WebGLRenderingContextBase#drawingBufferHeight|WebGLRenderingContextBase.drawingBufferHeight}
* <tr>
* <td>{@link HTMLCanvasElement} or {@link OffscreenCanvas} with {@link ImageBitmapRenderingContext}
* <td>{@link ImageBitmapRenderingContext}'s internal output bitmap
* {@link ImageBitmap#width|ImageBitmap.width},
* {@link ImageBitmap#height|ImageBitmap.height}
* </tbody>
* </table>
* {@link GPUQueue#copyExternalImageToTexture} is issued. Source size is determined as described
* by the external source dimensions table.
*/
source: GPUImageCopyExternalImageSource;
/**
Expand Down Expand Up @@ -1153,12 +1115,14 @@ interface GPURenderBundleEncoderDescriptor
* If `true`, indicates that the render bundle does not modify the depth component of the
* {@link GPURenderPassDepthStencilAttachment} of any render pass the render bundle is executed
* in.
* See read-only depth-stencil.
*/
depthReadOnly?: boolean;
/**
* If `true`, indicates that the render bundle does not modify the stencil component of the
* {@link GPURenderPassDepthStencilAttachment} of any render pass the render bundle is executed
* in.
* See read-only depth-stencil.
*/
stencilReadOnly?: boolean;
}
Expand Down Expand Up @@ -1349,6 +1313,7 @@ interface GPURenderPipelineDescriptor
}

interface GPURequestAdapterOptions {
featureLevel?: any;
/**
* Optionally provides a hint indicating what class of adapter should be selected from
* the system's available adapters.
Expand Down Expand Up @@ -1466,18 +1431,6 @@ interface GPUShaderModuleDescriptor
* module.
*/
code: string;
/**
* If defined, **may** be interpreted in the [[!SourceMap]] v3 format.
* If an implementation supports this option but is unable to process the provided value,
* it should show a developer-visible warning but must not produce any application-observable
* error.
* Note:
* Source map support is optional, but serves as a semi-standardized way to support dev-tool
* integration such as source-language debugging.
* WGSL names (identifiers) in source maps follow the rules defined in WGSL identifier
* comparison.
*/
sourceMap?: any;
/**
* A list of {@link GPUShaderModuleCompilationHint}s.
* Any hint provided by an application **should** contain information about one entry point of
Expand Down Expand Up @@ -1508,8 +1461,8 @@ interface GPUShaderModuleDescriptor

interface GPUStencilFaceState {
/**
* The {@link GPUCompareFunction} used when testing fragments against
* {@link GPURenderPassDescriptor#depthStencilAttachment} stencil values.
* The {@link GPUCompareFunction} used when testing the {@link RenderState#[[stencilReference]]} value
* against the fragment's {@link GPURenderPassDescriptor#depthStencilAttachment} stencil values.
*/
compare?: GPUCompareFunction;
/**
Expand Down Expand Up @@ -1624,6 +1577,15 @@ interface GPUTextureViewDescriptor
* The dimension to view the texture as.
*/
dimension?: GPUTextureViewDimension;
/**
* The allowed {@link GPUTextureUsage|usage(s)} for the texture view. Must be a subset of the
* {@link GPUTexture#usage} flags of the texture. If 0, defaults to the full set of
* {@link GPUTexture#usage} flags of the texture.
* Note: If the view's {@link GPUTextureViewDescriptor#format} doesn't support all of the
* texture's {@link GPUTextureDescriptor#usage}s, the default will fail,
* and the view's {@link GPUTextureViewDescriptor#usage} must be specified explicitly.
*/
usage?: GPUTextureUsageFlags;
/**
* Which {@link GPUTextureAspect|aspect(s)} of the texture are accessible to the texture view.
*/
Expand Down Expand Up @@ -1688,8 +1650,8 @@ interface GPUVertexBufferLayout {
interface GPUVertexState
extends GPUProgrammableStage {
/**
* A list of {@link GPUVertexBufferLayout}s defining the layout of the vertex attribute data in the
* vertex buffers used by this pipeline.
* A list of {@link GPUVertexBufferLayout}s, each defining the layout of vertex attribute data in a
* vertex buffer used by this pipeline.
*/
buffers?: Iterable<GPUVertexBufferLayout | null>;
}
Expand Down Expand Up @@ -1941,7 +1903,7 @@ interface GPUAdapter {
/**
* Requests a device from the adapter.
* This is a one-time action: if a device is returned successfully,
* the adapter [$expires$].
* the adapter becomes {@link adapter#[[state]]} "consumed".
* @param descriptor - Description of the {@link GPUDevice} to request.
*/
requestDevice(
Expand Down Expand Up @@ -2065,7 +2027,7 @@ interface GPUBuffer
size?: GPUSize64
): ArrayBuffer;
/**
* Unmaps the mapped range of the {@link GPUBuffer} and makes it's contents available for use by the
* Unmaps the mapped range of the {@link GPUBuffer} and makes its contents available for use by the
* GPU again.
*/
unmap(): undefined;
Expand Down Expand Up @@ -2506,6 +2468,7 @@ interface GPUDevice
* The returned {@link Promise} resolves when the created pipeline
* is ready to be used without additional delay.
* If pipeline creation fails, the returned {@link Promise} rejects with an {@link GPUPipelineError}.
* (A {@link GPUError} is not dispatched to the device.)
* Note: Use of this method is preferred whenever possible, as it prevents blocking the
* queue timeline work on pipeline compilation.
* @param descriptor - Description of the {@link GPUComputePipeline} to create.
Expand All @@ -2518,6 +2481,7 @@ interface GPUDevice
* The returned {@link Promise} resolves when the created pipeline
* is ready to be used without additional delay.
* If pipeline creation fails, the returned {@link Promise} rejects with an {@link GPUPipelineError}.
* (A {@link GPUError} is not dispatched to the device.)
* Note: Use of this method is preferred whenever possible, as it prevents blocking the
* queue timeline work on pipeline compilation.
* @param descriptor - Description of the {@link GPURenderPipeline} to create.
Expand Down Expand Up @@ -3002,7 +2966,7 @@ interface GPUShaderModule
readonly __brand: "GPUShaderModule";
/**
* Returns any messages generated during the {@link GPUShaderModule}'s compilation.
* The locations, order, and contents of messages are implementation-defined.
* The locations, order, and contents of messages are implementation-defined
* In particular, messages may not be ordered by {@link GPUCompilationMessage#lineNum}.
*/
getCompilationInfo(): Promise<GPUCompilationInfo>;
Expand Down Expand Up @@ -3045,7 +3009,6 @@ interface GPUSupportedLimits {
readonly maxBufferSize: number;
readonly maxVertexAttributes: number;
readonly maxVertexBufferArrayStride: number;
readonly maxInterStageShaderComponents: number;
readonly maxInterStageShaderVariables: number;
readonly maxColorAttachments: number;
readonly maxColorAttachmentBytesPerSample: number;
Expand Down
Loading
Loading