@webgpu/types
Advanced tools
Comparing version 0.0.16 to 0.0.17
245
index.d.ts
@@ -1,4 +0,4 @@ | ||
// https://github.com/gpuweb/gpuweb/blob/0a2bb28a584aa1c6adabaec1f841ed29de400626/spec/index.bs | ||
// https://github.com/gpuweb/gpuweb/blob/37812f5f39ae8c6dc85f6a12c0f65e9c9d6e2155 | ||
// except #280 setSubData (TODO) | ||
// plus #449 stencilFront/stencilBack | ||
// plus #489 GPUAdapter.limits | ||
@@ -8,2 +8,7 @@ export {}; | ||
declare global { | ||
// Appends members to the `Navigator` interface defined globally. | ||
export interface Navigator { | ||
readonly gpu: GPU | undefined; | ||
} | ||
export interface GPUColorDict { | ||
@@ -332,16 +337,16 @@ a: number; | ||
export interface GPUVertexAttributeDescriptor { | ||
offset?: number; | ||
format: GPUVertexFormat; | ||
offset: number; | ||
shaderLocation: number; | ||
} | ||
export interface GPUVertexBufferDescriptor { | ||
stride: number; | ||
export interface GPUVertexBufferLayoutDescriptor { | ||
arrayStride: number; | ||
stepMode?: GPUInputStepMode; | ||
attributeSet: GPUVertexAttributeDescriptor[]; | ||
attributes: GPUVertexAttributeDescriptor[]; | ||
} | ||
export interface GPUVertexInputDescriptor { | ||
export interface GPUVertexStateDescriptor { | ||
indexFormat?: GPUIndexFormat; | ||
vertexBuffers?: GPUVertexBufferDescriptor[]; | ||
vertexBuffers?: GPUVertexBufferLayoutDescriptor[]; | ||
} | ||
@@ -355,3 +360,3 @@ | ||
maxSamplersPerShaderStage?: number; | ||
maxStorageBuffersPerPipelineLayout?: number; | ||
maxStorageBuffersPerShaderStage?: number; | ||
maxStorageTexturesPerShaderStage?: number; | ||
@@ -361,2 +366,13 @@ maxUniformBuffersPerShaderStage?: number; | ||
export interface GPULimitsOut { | ||
maxBindGroups: number; | ||
maxDynamicUniformBuffersPerPipelineLayout: number; | ||
maxDynamicStorageBuffersPerPipelineLayout: number; | ||
maxSampledTexturesPerShaderStage: number; | ||
maxSamplersPerShaderStage: number; | ||
maxStorageBuffersPerShaderStage: number; | ||
maxStorageTexturesPerShaderStage: number; | ||
maxUniformBuffersPerShaderStage: number; | ||
} | ||
export interface GPUPipelineDescriptorBase { | ||
@@ -416,3 +432,3 @@ label?: string; | ||
depthStencilState?: GPUDepthStencilStateDescriptor; | ||
vertexInput?: GPUVertexInputDescriptor; | ||
vertexState?: GPUVertexStateDescriptor; | ||
@@ -475,13 +491,21 @@ sampleCount?: number; | ||
export interface GPUAdapter extends GPUObjectBase { | ||
export class GPUAdapter { | ||
readonly name: string; | ||
readonly extensions: GPUExtensions; | ||
readonly name: string; | ||
readonly limits: GPULimitsOut; | ||
requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice>; | ||
} | ||
export interface GPUBindGroup extends GPUObjectBase {} | ||
export class GPUBindGroup implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
export interface GPUBindGroupLayout extends GPUObjectBase {} | ||
export class GPUBindGroupLayout implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
export interface GPUBuffer extends GPUObjectBase { | ||
export class GPUBuffer implements GPUObjectBase { | ||
label: string | undefined; | ||
//readonly mapping: ArrayBuffer | null; | ||
@@ -502,7 +526,11 @@ destroy(): void; | ||
export interface GPUCommandBuffer extends GPUObjectBase {} | ||
export class GPUCommandBuffer implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
export interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {} | ||
export interface GPUCommandEncoder extends GPUObjectBase { | ||
export class GPUCommandEncoder implements GPUObjectBase { | ||
label: string | undefined; | ||
beginComputePass( | ||
@@ -548,3 +576,15 @@ descriptor?: GPUComputePassDescriptor | ||
export interface GPUComputePassEncoder extends GPUProgrammablePassEncoder { | ||
export class GPUComputePassEncoder implements GPUProgrammablePassEncoder { | ||
label: string | undefined; | ||
setBindGroup( | ||
index: number, | ||
bindGroup: GPUBindGroup, | ||
dynamicOffsets?: number[] | ||
): void; | ||
popDebugGroup(): void; | ||
pushDebugGroup(groupLabel: string): void; | ||
insertDebugMarker(markerLabel: string): void; | ||
setPipeline(pipeline: GPUComputePipeline): void; | ||
@@ -557,3 +597,5 @@ dispatch(x: number, y?: number, z?: number): void; | ||
export interface GPUComputePipeline extends GPUObjectBase {} | ||
export class GPUComputePipeline implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
@@ -569,3 +611,3 @@ export interface GPUObjectBase { | ||
// SwapChain / CanvasContext | ||
export interface GPUCanvasContext { | ||
export class GPUCanvasContext { | ||
configureSwapChain(descriptor: GPUSwapChainDescriptor): GPUSwapChain; | ||
@@ -576,6 +618,8 @@ | ||
export interface GPUDevice extends GPUObjectBase { | ||
export class GPUDevice extends EventTarget implements GPUObjectBase { | ||
label: string | undefined; | ||
readonly adapter: GPUAdapter; | ||
readonly extensions: GPUExtensions; | ||
readonly limits: GPULimits; | ||
readonly limits: GPULimitsOut; | ||
@@ -615,6 +659,11 @@ createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup; | ||
pushErrorScope(filter: GPUErrorFilter): void; | ||
popErrorScope(): Promise<GPUError | null>; | ||
onuncapturederror: Event | undefined; | ||
readonly lost: Promise<GPUDeviceLostInfo>; | ||
} | ||
export interface GPUFence extends GPUObjectBase { | ||
export class GPUFence implements GPUObjectBase { | ||
label: string | undefined; | ||
getCompletedValue(): number; | ||
@@ -624,6 +673,12 @@ onCompletion(completionValue: number): Promise<void>; | ||
export interface GPUPipelineLayout extends GPUObjectBase {} | ||
export class GPUPipelineLayout implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
export interface GPUProgrammablePassEncoder extends GPUObjectBase { | ||
setBindGroup(index: number, bindGroup: GPUBindGroup, dynamicOffsets?: number[]): void; | ||
setBindGroup( | ||
index: number, | ||
bindGroup: GPUBindGroup, | ||
dynamicOffsets?: number[] | ||
): void; | ||
@@ -635,5 +690,7 @@ popDebugGroup(): void; | ||
export interface GPUQueue extends GPUObjectBase { | ||
export class GPUQueue implements GPUObjectBase { | ||
label: string | undefined; | ||
signal(fence: GPUFence, signalValue: number): void; | ||
submit(buffers: GPUCommandBuffer[]): void; | ||
submit(commandBuffers: GPUCommandBuffer[]): void; | ||
createFence(descriptor?: GPUFenceDescriptor): GPUFence; | ||
@@ -669,3 +726,40 @@ } | ||
export interface GPURenderPassEncoder extends GPURenderEncoderBase { | ||
export class GPURenderPassEncoder implements GPURenderEncoderBase { | ||
label: string | undefined; | ||
setBindGroup( | ||
index: number, | ||
bindGroup: GPUBindGroup, | ||
dynamicOffsets?: number[] | ||
): void; | ||
popDebugGroup(): void; | ||
pushDebugGroup(groupLabel: string): void; | ||
insertDebugMarker(markerLabel: string): void; | ||
setPipeline(pipeline: GPURenderPipeline): void; | ||
setIndexBuffer(buffer: GPUBuffer, offset?: number): void; | ||
setVertexBuffer(slot: number, buffer: GPUBuffer, offset?: number): void; | ||
draw( | ||
vertexCount: number, | ||
instanceCount: number, | ||
firstVertex: number, | ||
firstInstance: number | ||
): void; | ||
drawIndexed( | ||
indexCount: number, | ||
instanceCount: number, | ||
firstIndex: number, | ||
baseVertex: number, | ||
firstInstance: number | ||
): void; | ||
drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void; | ||
drawIndexedIndirect( | ||
indirectBuffer: GPUBuffer, | ||
indirectOffset: number | ||
): void; | ||
setViewport( | ||
@@ -690,5 +784,44 @@ x: number, | ||
export interface GPURenderBundle extends GPUObjectBase {} | ||
export class GPURenderBundle implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
export interface GPURenderBundleEncoder extends GPURenderEncoderBase { | ||
export class GPURenderBundleEncoder implements GPURenderEncoderBase { | ||
label: string | undefined; | ||
setBindGroup( | ||
index: number, | ||
bindGroup: GPUBindGroup, | ||
dynamicOffsets?: number[] | ||
): void; | ||
popDebugGroup(): void; | ||
pushDebugGroup(groupLabel: string): void; | ||
insertDebugMarker(markerLabel: string): void; | ||
setPipeline(pipeline: GPURenderPipeline): void; | ||
setIndexBuffer(buffer: GPUBuffer, offset?: number): void; | ||
setVertexBuffer(slot: number, buffer: GPUBuffer, offset?: number): void; | ||
draw( | ||
vertexCount: number, | ||
instanceCount: number, | ||
firstVertex: number, | ||
firstInstance: number | ||
): void; | ||
drawIndexed( | ||
indexCount: number, | ||
instanceCount: number, | ||
firstIndex: number, | ||
baseVertex: number, | ||
firstInstance: number | ||
): void; | ||
drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void; | ||
drawIndexedIndirect( | ||
indirectBuffer: GPUBuffer, | ||
indirectOffset: number | ||
): void; | ||
finish(descriptor?: GPURenderBundleDescriptor): GPURenderBundle; | ||
@@ -704,13 +837,23 @@ } | ||
export interface GPURenderPipeline extends GPUObjectBase {} | ||
export class GPURenderPipeline implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
export interface GPUSampler extends GPUObjectBase {} | ||
export class GPUSampler implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
export interface GPUShaderModule extends GPUObjectBase {} | ||
export class GPUShaderModule implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
export interface GPUSwapChain extends GPUObjectBase { | ||
export class GPUSwapChain implements GPUObjectBase { | ||
label: string | undefined; | ||
getCurrentTexture(): GPUTexture; | ||
} | ||
export interface GPUTexture extends GPUObjectBase { | ||
export class GPUTexture implements GPUObjectBase { | ||
label: string | undefined; | ||
createView(descriptor?: GPUTextureViewDescriptor): GPUTextureView; | ||
@@ -720,3 +863,5 @@ destroy(): void; | ||
export interface GPUTextureView extends GPUObjectBase {} | ||
export class GPUTextureView implements GPUObjectBase { | ||
label: string | undefined; | ||
} | ||
@@ -728,3 +873,3 @@ export type GPUPowerPreference = "low-power" | "high-performance"; | ||
export interface GPU { | ||
export class GPU { | ||
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter>; | ||
@@ -750,7 +895,2 @@ } | ||
export interface GPUDevice { | ||
pushErrorScope(filter: GPUErrorFilter): void; | ||
popErrorScope(): Promise<GPUError | null>; | ||
} | ||
// **************************************************************************** | ||
@@ -760,3 +900,7 @@ // TELEMETRY | ||
export interface GPUUncapturedErrorEvent extends Event { | ||
export class GPUUncapturedErrorEvent extends Event { | ||
constructor( | ||
type: string, | ||
gpuUncapturedErrorEventInitDict: GPUUncapturedErrorEventInit | ||
); | ||
readonly error: GPUError; | ||
@@ -769,18 +913,5 @@ } | ||
export interface GPUDevice extends EventTarget { | ||
onuncapturederror: Event | undefined; | ||
} | ||
export interface GPUDeviceLostInfo { | ||
export class GPUDeviceLostInfo { | ||
readonly message: string; | ||
} | ||
export interface GPU { | ||
// May reject with DOMException // TODO: DOMException("OperationError")? | ||
requestAdapter(options?: GPURequestAdapterOptions): Promise<GPUAdapter>; | ||
} | ||
export interface Navigator { | ||
readonly gpu: GPU | undefined; | ||
} | ||
} |
{ | ||
"name": "@webgpu/types", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"main": "", | ||
"license": "Apache-2.0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23447
757