Skip to main content

GPU

GPU programming and rendering. Efficiently use a device’s graphics processing unit (GPU) for high-performance computations and complex image rendering.

Eg GPUDevice

Classes

c
GPU

The entry point to WebGPU in Deno, accessed via the global navigator.gpu property.

c
GPUAdapter

Represents a physical GPU device that can be used to create a logical GPU device.

c
GPUBindGroup
No documentation available
c
GPUBindGroupLayout
No documentation available
c
GPUBuffer

Represents a block of memory allocated on the GPU.

c
GPUColorWrite
No documentation available
c
GPUCommandBuffer
No documentation available
c
GPUCompilationInfo
No documentation available
c
GPUMapMode
No documentation available
c
GPUPipelineLayout
No documentation available
c
GPUQuerySet
No documentation available
c
GPUQueue

Represents a queue to submit commands to the GPU.

c
GPURenderBundle
No documentation available
c
c
GPUSampler
No documentation available
c
GPUShaderModule

Represents a compiled shader module that can be used to create graphics or compute pipelines.

c
GPUShaderStage
No documentation available
c
GPUTextureView
No documentation available
c
GPUUncapturedErrorEvent
No documentation available

Interfaces

I
GPUBindGroupDescriptor
No documentation available
I
GPUBindGroupEntry
No documentation available
I
GPUBindGroupLayoutDescriptor
No documentation available
I
GPUBlendState
No documentation available
I
GPUBufferBinding
No documentation available
I
GPUColorDict
No documentation available
I
GPUColorTargetState
No documentation available
I
GPUCommandBufferDescriptor
No documentation available
    I
    GPUCommandEncoderDescriptor
    No documentation available
      I
      GPUComputePassDescriptor
      No documentation available
      I
      GPUComputePipelineDescriptor
      No documentation available
      I
      GPUDeviceLostInfo
      No documentation available
      I
      v
      GPUError

      The GPUError interface of the WebGPU API is the base interface for errors surfaced by GPUDevice.popErrorScope and the GPUDevice.uncapturederror_event event. Available only in secure contexts.

      I
      GPUFragmentState
      No documentation available
      I
      v
      GPUInternalError
      No documentation available
      I
      GPUObjectBase
      No documentation available
      I
      GPUObjectDescriptorBase
      No documentation available
      I
      GPUOrigin3DDict
      No documentation available
      I
      v
      GPUOutOfMemoryError
      No documentation available
      I
      GPUPipelineBase
      No documentation available
      I
      GPUPipelineDescriptorBase
      No documentation available
      I
      v
      GPUPipelineError

      The GPUPipelineError interface of the WebGPU API describes a pipeline failure. Available only in secure contexts.

      I
      GPUPipelineErrorInit
      No documentation available
      I
      GPUQuerySetDescriptor
      No documentation available
      I
      GPURenderBundleDescriptor
      No documentation available
        I
        GPUSamplerBindingLayout
        No documentation available
        I
        GPUShaderModuleDescriptor
        No documentation available
        I
        GPUTexelCopyBufferInfo
        No documentation available
        I
        GPUUncapturedErrorEventInit
        No documentation available
        I
        v
        GPUValidationError
        No documentation available
        I
        GPUVertexState
        No documentation available

        Type Aliases

        T
        GPUAddressMode
        No documentation available
          T
          GPUAutoLayoutMode
          No documentation available
            T
            GPUBindingResource
            No documentation available
              T
              GPUBlendFactor
              No documentation available
                T
                GPUBlendOperation
                No documentation available
                  T
                  GPUBufferBindingType
                  No documentation available
                    T
                    GPUBufferMapState
                    No documentation available
                      T
                      GPUBufferUsageFlags
                      No documentation available
                        T
                        GPUColor
                        No documentation available
                          T
                          GPUColorWriteFlags
                          No documentation available
                            T
                            GPUCompareFunction
                            No documentation available
                              T
                              GPUCompilationMessageType
                              No documentation available
                                T
                                GPUCullMode
                                No documentation available
                                  T
                                  GPUDeviceLostReason
                                  No documentation available
                                    T
                                    GPUErrorFilter
                                    No documentation available
                                      T
                                      GPUExtent3D
                                      No documentation available
                                        T
                                        GPUFeatureName
                                        No documentation available
                                          T
                                          GPUFilterMode
                                          No documentation available
                                            T
                                            GPUFlagsConstant
                                            No documentation available
                                              T
                                              GPUFrontFace
                                              No documentation available
                                                T
                                                GPUIndexFormat
                                                No documentation available
                                                  T
                                                  GPULoadOp
                                                  No documentation available
                                                    T
                                                    GPUMapModeFlags
                                                    No documentation available
                                                      T
                                                      GPUMipmapFilterMode
                                                      No documentation available
                                                        T
                                                        GPUOrigin3D
                                                        No documentation available
                                                          T
                                                          GPUPowerPreference
                                                          No documentation available
                                                            T
                                                            GPUPrimitiveTopology
                                                            No documentation available
                                                              T
                                                              GPUQueryType
                                                              No documentation available
                                                                T
                                                                GPUSamplerBindingType
                                                                No documentation available
                                                                  T
                                                                  GPUShaderStageFlags
                                                                  No documentation available
                                                                    T
                                                                    GPUStencilOperation
                                                                    No documentation available
                                                                      T
                                                                      GPUStorageTextureAccess
                                                                      No documentation available
                                                                        T
                                                                        GPUStoreOp
                                                                        No documentation available
                                                                          T
                                                                          GPUTextureAspect
                                                                          No documentation available
                                                                            T
                                                                            GPUTextureDimension
                                                                            No documentation available
                                                                              T
                                                                              GPUTextureFormat
                                                                              No documentation available
                                                                                T
                                                                                GPUTextureSampleType
                                                                                No documentation available
                                                                                  T
                                                                                  GPUTextureUsageFlags
                                                                                  No documentation available
                                                                                    T
                                                                                    GPUTextureViewDimension
                                                                                    No documentation available
                                                                                      T
                                                                                      GPUVertexFormat
                                                                                      No documentation available
                                                                                        T
                                                                                        GPUVertexStepMode
                                                                                        No documentation available

                                                                                          class GPU

                                                                                          The entry point to WebGPU in Deno, accessed via the global navigator.gpu property.

                                                                                          Examples #

                                                                                          #
                                                                                          // Basic WebGPU initialization in Deno
                                                                                          const gpu = navigator.gpu;
                                                                                          if (!gpu) {
                                                                                            console.error("WebGPU not supported in this Deno environment");
                                                                                            Deno.exit(1);
                                                                                          }
                                                                                          
                                                                                          // Request an adapter (physical GPU device)
                                                                                          const adapter = await gpu.requestAdapter();
                                                                                          if (!adapter) {
                                                                                            console.error("Couldn't request WebGPU adapter");
                                                                                            Deno.exit(1);
                                                                                          }
                                                                                          
                                                                                          // Get the preferred format for canvas rendering
                                                                                          // Useful when working with canvas in browser/Deno environments
                                                                                          const preferredFormat = gpu.getPreferredCanvasFormat();
                                                                                          console.log(`Preferred canvas format: ${preferredFormat}`);
                                                                                          
                                                                                          // Create a device with default settings
                                                                                          const device = await adapter.requestDevice();
                                                                                          console.log("WebGPU device created successfully");
                                                                                          

                                                                                          Methods #


                                                                                          class GPUAdapter

                                                                                          Represents a physical GPU device that can be used to create a logical GPU device.

                                                                                          Examples #

                                                                                          #
                                                                                          // Request an adapter with specific power preference
                                                                                          const adapter = await navigator.gpu.requestAdapter({
                                                                                            powerPreference: "high-performance"
                                                                                          });
                                                                                          
                                                                                          if (!adapter) {
                                                                                            console.error("WebGPU not supported or no appropriate adapter found");
                                                                                            Deno.exit(1);
                                                                                          }
                                                                                          
                                                                                          // Check adapter capabilities
                                                                                          if (adapter.features.has("shader-f16")) {
                                                                                            console.log("Adapter supports 16-bit shader operations");
                                                                                          }
                                                                                          
                                                                                          console.log(`Maximum buffer size: ${adapter.limits.maxBufferSize} bytes`);
                                                                                          
                                                                                          // Get adapter info (vendor, device, etc.)
                                                                                          console.log(`GPU Vendor: ${adapter.info.vendor}`);
                                                                                          console.log(`GPU Device: ${adapter.info.device}`);
                                                                                          
                                                                                          // Request a logical device with specific features and limits
                                                                                          const device = await adapter.requestDevice({
                                                                                            requiredFeatures: ["shader-f16"],
                                                                                            requiredLimits: {
                                                                                              maxStorageBufferBindingSize: 128 * 1024 * 1024, // 128MB
                                                                                            }
                                                                                          });
                                                                                          

                                                                                          Properties #

                                                                                          Methods #





                                                                                          class GPUBuffer

                                                                                          implements GPUObjectBase

                                                                                          Represents a block of memory allocated on the GPU.

                                                                                          Examples #

                                                                                          #
                                                                                          // Create a buffer that can be used as a vertex buffer and can be written to
                                                                                          const vertexBuffer = device.createBuffer({
                                                                                            label: "Vertex Buffer",
                                                                                            size: vertices.byteLength,
                                                                                            usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
                                                                                          });
                                                                                          
                                                                                          // Write data to the buffer
                                                                                          device.queue.writeBuffer(vertexBuffer, 0, vertices);
                                                                                          
                                                                                          // Example of creating a mapped buffer for CPU access
                                                                                          const stagingBuffer = device.createBuffer({
                                                                                            size: data.byteLength,
                                                                                            usage: GPUBufferUsage.MAP_WRITE | GPUBufferUsage.COPY_SRC,
                                                                                            mappedAtCreation: true,
                                                                                          });
                                                                                          
                                                                                          // Copy data to the mapped buffer
                                                                                          new Uint8Array(stagingBuffer.getMappedRange()).set(data);
                                                                                          stagingBuffer.unmap();
                                                                                          

                                                                                          Properties #

                                                                                          #label: string
                                                                                          #size: number
                                                                                          readonly

                                                                                          Methods #

                                                                                          #destroy(): undefined
                                                                                          #getMappedRange(
                                                                                          offset?: number,
                                                                                          size?: number,
                                                                                          ): ArrayBuffer
                                                                                          #mapAsync(
                                                                                          offset?: number,
                                                                                          size?: number,
                                                                                          ): Promise<undefined>
                                                                                          #unmap(): undefined




                                                                                          class GPUCommandEncoder

                                                                                          implements GPUObjectBase

                                                                                          Used to record GPU commands for later execution by the GPU.

                                                                                          Examples #

                                                                                          #
                                                                                          // Create a command encoder
                                                                                          const commandEncoder = device.createCommandEncoder({
                                                                                            label: "Main Command Encoder"
                                                                                          });
                                                                                          
                                                                                          // Record a copy from one buffer to another
                                                                                          commandEncoder.copyBufferToBuffer(
                                                                                            sourceBuffer, 0, // Source buffer and offset
                                                                                            destinationBuffer, 0, // Destination buffer and offset
                                                                                            sourceBuffer.size // Size to copy
                                                                                          );
                                                                                          
                                                                                          // Begin a compute pass to execute a compute shader
                                                                                          const computePass = commandEncoder.beginComputePass();
                                                                                          computePass.setPipeline(computePipeline);
                                                                                          computePass.setBindGroup(0, bindGroup);
                                                                                          computePass.dispatchWorkgroups(32, 1, 1); // Run 32 workgroups
                                                                                          computePass.end();
                                                                                          
                                                                                          // Begin a render pass to draw to a texture
                                                                                          const renderPass = commandEncoder.beginRenderPass({
                                                                                            colorAttachments: [{
                                                                                              view: textureView,
                                                                                              clearValue: { r: 0.0, g: 0.0, b: 0.0, a: 1.0 },
                                                                                              loadOp: "clear",
                                                                                              storeOp: "store"
                                                                                            }]
                                                                                          });
                                                                                          renderPass.setPipeline(renderPipeline);
                                                                                          renderPass.draw(3, 1, 0, 0); // Draw a triangle
                                                                                          renderPass.end();
                                                                                          
                                                                                          // Finish encoding and submit to GPU
                                                                                          const commandBuffer = commandEncoder.finish();
                                                                                          device.queue.submit([commandBuffer]);
                                                                                          

                                                                                          Properties #

                                                                                          #label: string

                                                                                          Methods #

                                                                                          #clearBuffer(
                                                                                          destination: GPUBuffer,
                                                                                          destinationOffset?: number,
                                                                                          size?: number,
                                                                                          ): undefined
                                                                                          #copyBufferToBuffer(
                                                                                          source: GPUBuffer,
                                                                                          sourceOffset: number,
                                                                                          destination: GPUBuffer,
                                                                                          destinationOffset: number,
                                                                                          size: number,
                                                                                          ): undefined
                                                                                          #insertDebugMarker(markerLabel: string): undefined
                                                                                          #popDebugGroup(): undefined
                                                                                          #pushDebugGroup(groupLabel: string): undefined
                                                                                          #resolveQuerySet(
                                                                                          querySet: GPUQuerySet,
                                                                                          firstQuery: number,
                                                                                          queryCount: number,
                                                                                          destination: GPUBuffer,
                                                                                          destinationOffset: number,
                                                                                          ): undefined
                                                                                          #writeTimestamp(
                                                                                          querySet: GPUQuerySet,
                                                                                          queryIndex: number,
                                                                                          ): undefined



                                                                                          class GPUComputePassEncoder

                                                                                          Properties #

                                                                                          #label: string

                                                                                          Methods #

                                                                                          #dispatchWorkgroups(
                                                                                          x: number,
                                                                                          y?: number,
                                                                                          z?: number,
                                                                                          ): undefined
                                                                                          #dispatchWorkgroupsIndirect(
                                                                                          indirectBuffer: GPUBuffer,
                                                                                          indirectOffset: number,
                                                                                          ): undefined
                                                                                          #end(): undefined
                                                                                          #insertDebugMarker(markerLabel: string): undefined
                                                                                          #popDebugGroup(): undefined
                                                                                          #pushDebugGroup(groupLabel: string): undefined
                                                                                          #setBindGroup(
                                                                                          index: number,
                                                                                          bindGroup: GPUBindGroup | null,
                                                                                          dynamicOffsets?: number[],
                                                                                          ): undefined
                                                                                          #setBindGroup(
                                                                                          index: number,
                                                                                          bindGroup: GPUBindGroup | null,
                                                                                          dynamicOffsetsData: Uint32Array,
                                                                                          dynamicOffsetsDataStart: number,
                                                                                          dynamicOffsetsDataLength: number,
                                                                                          ): undefined
                                                                                          #setPipeline(pipeline: GPUComputePipeline): undefined


                                                                                          class GPUDevice

                                                                                          implements GPUObjectBase
                                                                                          extends EventTarget

                                                                                          The primary interface for interacting with a WebGPU device.

                                                                                          Examples #

                                                                                          #
                                                                                          // Request a GPU adapter from the browser/Deno
                                                                                          const adapter = await navigator.gpu.requestAdapter();
                                                                                          if (!adapter) throw new Error("WebGPU not supported");
                                                                                          
                                                                                          // Request a device from the adapter
                                                                                          const device = await adapter.requestDevice();
                                                                                          
                                                                                          // Create a buffer on the GPU
                                                                                          const buffer = device.createBuffer({
                                                                                            size: 128,
                                                                                            usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
                                                                                          });
                                                                                          
                                                                                          // Use device.queue to submit commands
                                                                                          device.queue.writeBuffer(buffer, 0, new Uint8Array([1, 2, 3, 4]));
                                                                                          

                                                                                          Properties #

                                                                                          Methods #





                                                                                          class GPUQueue

                                                                                          implements GPUObjectBase

                                                                                          Represents a queue to submit commands to the GPU.

                                                                                          Examples #

                                                                                          #
                                                                                          // Get a queue from the device (each device has a default queue)
                                                                                          const queue = device.queue;
                                                                                          
                                                                                          // Write data to a buffer
                                                                                          const buffer = device.createBuffer({
                                                                                            size: data.byteLength,
                                                                                            usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.STORAGE
                                                                                          });
                                                                                          queue.writeBuffer(buffer, 0, data);
                                                                                          
                                                                                          // Submit command buffers to the GPU for execution
                                                                                          const commandBuffer = commandEncoder.finish();
                                                                                          queue.submit([commandBuffer]);
                                                                                          
                                                                                          // Wait for all submitted operations to complete
                                                                                          await queue.onSubmittedWorkDone();
                                                                                          
                                                                                          // Example: Write data to a texture
                                                                                          const texture = device.createTexture({
                                                                                            size: { width: 256, height: 256 },
                                                                                            format: "rgba8unorm",
                                                                                            usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST
                                                                                          });
                                                                                          
                                                                                          const data = new Uint8Array(256 * 256 * 4); // RGBA data
                                                                                          // Fill data with your texture content...
                                                                                          
                                                                                          queue.writeTexture(
                                                                                            { texture },
                                                                                            data,
                                                                                            { bytesPerRow: 256 * 4 },
                                                                                            { width: 256, height: 256 }
                                                                                          );
                                                                                          

                                                                                          Properties #

                                                                                          #label: string

                                                                                          Methods #

                                                                                          #onSubmittedWorkDone(): Promise<undefined>
                                                                                          #submit(commandBuffers: GPUCommandBuffer[]): undefined
                                                                                          #writeBuffer(
                                                                                          buffer: GPUBuffer,
                                                                                          bufferOffset: number,
                                                                                          dataOffset?: number,
                                                                                          size?: number,
                                                                                          ): undefined


                                                                                          class GPURenderBundleEncoder

                                                                                          Properties #

                                                                                          #label: string

                                                                                          Methods #

                                                                                          #draw(
                                                                                          vertexCount: number,
                                                                                          instanceCount?: number,
                                                                                          firstVertex?: number,
                                                                                          firstInstance?: number,
                                                                                          ): undefined
                                                                                          #drawIndexed(
                                                                                          indexCount: number,
                                                                                          instanceCount?: number,
                                                                                          firstIndex?: number,
                                                                                          baseVertex?: number,
                                                                                          firstInstance?: number,
                                                                                          ): undefined
                                                                                          #drawIndexedIndirect(
                                                                                          indirectBuffer: GPUBuffer,
                                                                                          indirectOffset: number,
                                                                                          ): undefined
                                                                                          #drawIndirect(
                                                                                          indirectBuffer: GPUBuffer,
                                                                                          indirectOffset: number,
                                                                                          ): undefined
                                                                                          #insertDebugMarker(markerLabel: string): undefined
                                                                                          #popDebugGroup(): undefined
                                                                                          #pushDebugGroup(groupLabel: string): undefined
                                                                                          #setBindGroup(
                                                                                          index: number,
                                                                                          bindGroup: GPUBindGroup | null,
                                                                                          dynamicOffsets?: number[],
                                                                                          ): undefined
                                                                                          #setBindGroup(
                                                                                          index: number,
                                                                                          bindGroup: GPUBindGroup | null,
                                                                                          dynamicOffsetsData: Uint32Array,
                                                                                          dynamicOffsetsDataStart: number,
                                                                                          dynamicOffsetsDataLength: number,
                                                                                          ): undefined
                                                                                          #setIndexBuffer(
                                                                                          buffer: GPUBuffer,
                                                                                          indexFormat: GPUIndexFormat,
                                                                                          offset?: number,
                                                                                          size?: number,
                                                                                          ): undefined
                                                                                          #setPipeline(pipeline: GPURenderPipeline): undefined
                                                                                          #setVertexBuffer(
                                                                                          slot: number,
                                                                                          buffer: GPUBuffer,
                                                                                          offset?: number,
                                                                                          size?: number,
                                                                                          ): undefined

                                                                                          class GPURenderPassEncoder

                                                                                          Properties #

                                                                                          #label: string

                                                                                          Methods #

                                                                                          #beginOcclusionQuery(queryIndex: number): undefined
                                                                                          #draw(
                                                                                          vertexCount: number,
                                                                                          instanceCount?: number,
                                                                                          firstVertex?: number,
                                                                                          firstInstance?: number,
                                                                                          ): undefined
                                                                                          #drawIndexed(
                                                                                          indexCount: number,
                                                                                          instanceCount?: number,
                                                                                          firstIndex?: number,
                                                                                          baseVertex?: number,
                                                                                          firstInstance?: number,
                                                                                          ): undefined
                                                                                          #drawIndexedIndirect(
                                                                                          indirectBuffer: GPUBuffer,
                                                                                          indirectOffset: number,
                                                                                          ): undefined
                                                                                          #drawIndirect(
                                                                                          indirectBuffer: GPUBuffer,
                                                                                          indirectOffset: number,
                                                                                          ): undefined
                                                                                          #end(): undefined
                                                                                          #endOcclusionQuery(): undefined
                                                                                          #executeBundles(bundles: GPURenderBundle[]): undefined
                                                                                          #insertDebugMarker(markerLabel: string): undefined
                                                                                          #popDebugGroup(): undefined
                                                                                          #pushDebugGroup(groupLabel: string): undefined
                                                                                          #setBindGroup(
                                                                                          index: number,
                                                                                          bindGroup: GPUBindGroup | null,
                                                                                          dynamicOffsets?: number[],
                                                                                          ): undefined
                                                                                          #setBindGroup(
                                                                                          index: number,
                                                                                          bindGroup: GPUBindGroup | null,
                                                                                          dynamicOffsetsData: Uint32Array,
                                                                                          dynamicOffsetsDataStart: number,
                                                                                          dynamicOffsetsDataLength: number,
                                                                                          ): undefined
                                                                                          #setBlendConstant(color: GPUColor): undefined
                                                                                          #setIndexBuffer(
                                                                                          buffer: GPUBuffer,
                                                                                          indexFormat: GPUIndexFormat,
                                                                                          offset?: number,
                                                                                          size?: number,
                                                                                          ): undefined
                                                                                          #setPipeline(pipeline: GPURenderPipeline): undefined
                                                                                          #setScissorRect(
                                                                                          x: number,
                                                                                          y: number,
                                                                                          width: number,
                                                                                          height: number,
                                                                                          ): undefined
                                                                                          #setStencilReference(reference: number): undefined
                                                                                          #setVertexBuffer(
                                                                                          slot: number,
                                                                                          buffer: GPUBuffer,
                                                                                          offset?: number,
                                                                                          size?: number,
                                                                                          ): undefined
                                                                                          #setViewport(
                                                                                          x: number,
                                                                                          y: number,
                                                                                          width: number,
                                                                                          height: number,
                                                                                          minDepth: number,
                                                                                          maxDepth: number,
                                                                                          ): undefined



                                                                                          class GPUShaderModule

                                                                                          implements GPUObjectBase

                                                                                          Represents a compiled shader module that can be used to create graphics or compute pipelines.

                                                                                          Examples #

                                                                                          #
                                                                                          // Create a shader module using WGSL (WebGPU Shading Language)
                                                                                          const shaderModule = device.createShaderModule({
                                                                                            label: "My Shader",
                                                                                            code: `

                                                                                          Properties #

                                                                                          #label: string

                                                                                          Methods #

                                                                                          Returns compilation messages for this shader module, which can include errors, warnings and info messages.




                                                                                          class GPUSupportedLimits


                                                                                          class GPUTexture

                                                                                          implements GPUObjectBase

                                                                                          Represents a texture (image) in GPU memory.

                                                                                          Examples #

                                                                                          #
                                                                                          // Create a texture to render to
                                                                                          const texture = device.createTexture({
                                                                                            label: "Output Texture",
                                                                                            size: { width: 640, height: 480 },
                                                                                            format: "rgba8unorm",
                                                                                            usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
                                                                                          });
                                                                                          
                                                                                          // Get a view of the texture (needed for most operations)
                                                                                          const textureView = texture.createView();
                                                                                          
                                                                                          // When the texture is no longer needed
                                                                                          texture.destroy();
                                                                                          
                                                                                          // Example: Creating a depth texture
                                                                                          const depthTexture = device.createTexture({
                                                                                            size: { width: 640, height: 480 },
                                                                                            format: "depth24plus",
                                                                                            usage: GPUTextureUsage.RENDER_ATTACHMENT,
                                                                                          });
                                                                                          

                                                                                          Properties #

                                                                                          #depthOrArrayLayers: number
                                                                                          readonly
                                                                                          #height: number
                                                                                          readonly
                                                                                          #label: string
                                                                                          #mipLevelCount: number
                                                                                          readonly
                                                                                          #sampleCount: number
                                                                                          readonly
                                                                                          #width: number
                                                                                          readonly

                                                                                          Methods #
























                                                                                          interface GPUError

                                                                                          The GPUError interface of the WebGPU API is the base interface for errors surfaced by GPUDevice.popErrorScope and the GPUDevice.uncapturederror_event event. Available only in secure contexts.

                                                                                          MDN Reference

                                                                                          Properties #

                                                                                          #message: string
                                                                                          readonly

                                                                                          The message read-only property of the A string. The message read-only property of the GPUError interface provides a human-readable message that explains why the error occurred.

                                                                                          MDN Reference

                                                                                          variable GPUError

                                                                                          Properties #





















                                                                                          interface GPURenderEncoderBase

                                                                                          Methods #

                                                                                          #setPipeline(pipeline: GPURenderPipeline): undefined
                                                                                          #setIndexBuffer(
                                                                                          buffer: GPUBuffer,
                                                                                          indexFormat: GPUIndexFormat,
                                                                                          offset?: number,
                                                                                          size?: number,
                                                                                          ): undefined
                                                                                          #setVertexBuffer(
                                                                                          slot: number,
                                                                                          buffer: GPUBuffer,
                                                                                          offset?: number,
                                                                                          size?: number,
                                                                                          ): undefined
                                                                                          #draw(
                                                                                          vertexCount: number,
                                                                                          instanceCount?: number,
                                                                                          firstVertex?: number,
                                                                                          firstInstance?: number,
                                                                                          ): undefined
                                                                                          #drawIndexed(
                                                                                          indexCount: number,
                                                                                          instanceCount?: number,
                                                                                          firstIndex?: number,
                                                                                          baseVertex?: number,
                                                                                          firstInstance?: number,
                                                                                          ): undefined
                                                                                          #drawIndirect(
                                                                                          indirectBuffer: GPUBuffer,
                                                                                          indirectOffset: number,
                                                                                          ): undefined
                                                                                          #drawIndexedIndirect(
                                                                                          indirectBuffer: GPUBuffer,
                                                                                          indirectOffset: number,
                                                                                          ): undefined
























                                                                                          type alias GPUAddressMode

                                                                                          Definition #

                                                                                          "clamp-to-edge"
                                                                                          | "repeat"
                                                                                          | "mirror-repeat"



                                                                                          type alias GPUBlendFactor

                                                                                          Definition #

                                                                                          "zero"
                                                                                          | "one"
                                                                                          | "src"
                                                                                          | "one-minus-src"
                                                                                          | "src-alpha"
                                                                                          | "one-minus-src-alpha"
                                                                                          | "dst"
                                                                                          | "one-minus-dst"
                                                                                          | "dst-alpha"
                                                                                          | "one-minus-dst-alpha"
                                                                                          | "src-alpha-saturated"
                                                                                          | "constant"
                                                                                          | "one-minus-constant"
                                                                                          | "src1"
                                                                                          | "one-minus-src1"
                                                                                          | "src1-alpha"
                                                                                          | "one-minus-src1-alpha"

                                                                                          type alias GPUBlendOperation

                                                                                          Definition #

                                                                                          "add"
                                                                                          | "subtract"
                                                                                          | "reverse-subtract"
                                                                                          | "min"
                                                                                          | "max"






                                                                                          type alias GPUCompareFunction

                                                                                          Definition #

                                                                                          "never"
                                                                                          | "less"
                                                                                          | "equal"
                                                                                          | "less-equal"
                                                                                          | "greater"
                                                                                          | "not-equal"
                                                                                          | "greater-equal"
                                                                                          | "always"


                                                                                          type alias GPUCullMode

                                                                                          Definition #

                                                                                          "none"
                                                                                          | "front"
                                                                                          | "back"


                                                                                          type alias GPUErrorFilter

                                                                                          Definition #

                                                                                          "out-of-memory"
                                                                                          | "validation"
                                                                                          | "internal"


                                                                                          type alias GPUFeatureName

                                                                                          Definition #

                                                                                          "depth-clip-control"
                                                                                          | "timestamp-query"
                                                                                          | "indirect-first-instance"
                                                                                          | "shader-f16"
                                                                                          | "depth32float-stencil8"
                                                                                          | "texture-compression-bc"
                                                                                          | "texture-compression-bc-sliced-3d"
                                                                                          | "texture-compression-etc2"
                                                                                          | "texture-compression-astc"
                                                                                          | "rg11b10ufloat-renderable"
                                                                                          | "bgra8unorm-storage"
                                                                                          | "float32-filterable"
                                                                                          | "dual-source-blending"
                                                                                          | "subgroups"
                                                                                          | "texture-format-16-bit-norm"
                                                                                          | "texture-compression-astc-hdr"
                                                                                          | "texture-adapter-specific-format-features"
                                                                                          | "pipeline-statistics-query"
                                                                                          | "timestamp-query-inside-passes"
                                                                                          | "mappable-primary-buffers"
                                                                                          | "texture-binding-array"
                                                                                          | "buffer-binding-array"
                                                                                          | "storage-resource-binding-array"
                                                                                          | "sampled-texture-and-storage-buffer-array-non-uniform-indexing"
                                                                                          | "uniform-buffer-and-storage-texture-array-non-uniform-indexing"
                                                                                          | "partially-bound-binding-array"
                                                                                          | "multi-draw-indirect"
                                                                                          | "multi-draw-indirect-count"
                                                                                          | "push-constants"
                                                                                          | "address-mode-clamp-to-zero"
                                                                                          | "address-mode-clamp-to-border"
                                                                                          | "polygon-mode-line"
                                                                                          | "polygon-mode-point"
                                                                                          | "conservative-rasterization"
                                                                                          | "vertex-writable-storage"
                                                                                          | "clear-texture"
                                                                                          | "spirv-shader-passthrough"
                                                                                          | "multiview"
                                                                                          | "vertex-attribute-64-bit"
                                                                                          | "shader-f64"
                                                                                          | "shader-i16"
                                                                                          | "shader-primitive-index"
                                                                                          | "shader-early-depth-test"










                                                                                          type alias GPUPrimitiveTopology

                                                                                          Definition #

                                                                                          "point-list"
                                                                                          | "line-list"
                                                                                          | "line-strip"
                                                                                          | "triangle-list"
                                                                                          | "triangle-strip"




                                                                                          type alias GPUStencilOperation

                                                                                          Definition #

                                                                                          "keep"
                                                                                          | "zero"
                                                                                          | "replace"
                                                                                          | "invert"
                                                                                          | "increment-clamp"
                                                                                          | "decrement-clamp"
                                                                                          | "increment-wrap"
                                                                                          | "decrement-wrap"





                                                                                          type alias GPUTextureFormat

                                                                                          Definition #

                                                                                          "r8unorm"
                                                                                          | "r8snorm"
                                                                                          | "r8uint"
                                                                                          | "r8sint"
                                                                                          | "r16uint"
                                                                                          | "r16sint"
                                                                                          | "r16float"
                                                                                          | "rg8unorm"
                                                                                          | "rg8snorm"
                                                                                          | "rg8uint"
                                                                                          | "rg8sint"
                                                                                          | "r32uint"
                                                                                          | "r32sint"
                                                                                          | "r32float"
                                                                                          | "rg16uint"
                                                                                          | "rg16sint"
                                                                                          | "rg16float"
                                                                                          | "rgba8unorm"
                                                                                          | "rgba8unorm-srgb"
                                                                                          | "rgba8snorm"
                                                                                          | "rgba8uint"
                                                                                          | "rgba8sint"
                                                                                          | "bgra8unorm"
                                                                                          | "bgra8unorm-srgb"
                                                                                          | "rgb9e5ufloat"
                                                                                          | "rgb10a2uint"
                                                                                          | "rgb10a2unorm"
                                                                                          | "rg11b10ufloat"
                                                                                          | "rg32uint"
                                                                                          | "rg32sint"
                                                                                          | "rg32float"
                                                                                          | "rgba16uint"
                                                                                          | "rgba16sint"
                                                                                          | "rgba16float"
                                                                                          | "rgba32uint"
                                                                                          | "rgba32sint"
                                                                                          | "rgba32float"
                                                                                          | "stencil8"
                                                                                          | "depth16unorm"
                                                                                          | "depth24plus"
                                                                                          | "depth24plus-stencil8"
                                                                                          | "depth32float"
                                                                                          | "depth32float-stencil8"
                                                                                          | "bc1-rgba-unorm"
                                                                                          | "bc1-rgba-unorm-srgb"
                                                                                          | "bc2-rgba-unorm"
                                                                                          | "bc2-rgba-unorm-srgb"
                                                                                          | "bc3-rgba-unorm"
                                                                                          | "bc3-rgba-unorm-srgb"
                                                                                          | "bc4-r-unorm"
                                                                                          | "bc4-r-snorm"
                                                                                          | "bc5-rg-unorm"
                                                                                          | "bc5-rg-snorm"
                                                                                          | "bc6h-rgb-ufloat"
                                                                                          | "bc6h-rgb-float"
                                                                                          | "bc7-rgba-unorm"
                                                                                          | "bc7-rgba-unorm-srgb"
                                                                                          | "etc2-rgb8unorm"
                                                                                          | "etc2-rgb8unorm-srgb"
                                                                                          | "etc2-rgb8a1unorm"
                                                                                          | "etc2-rgb8a1unorm-srgb"
                                                                                          | "etc2-rgba8unorm"
                                                                                          | "etc2-rgba8unorm-srgb"
                                                                                          | "eac-r11unorm"
                                                                                          | "eac-r11snorm"
                                                                                          | "eac-rg11unorm"
                                                                                          | "eac-rg11snorm"
                                                                                          | "astc-4x4-unorm"
                                                                                          | "astc-4x4-unorm-srgb"
                                                                                          | "astc-5x4-unorm"
                                                                                          | "astc-5x4-unorm-srgb"
                                                                                          | "astc-5x5-unorm"
                                                                                          | "astc-5x5-unorm-srgb"
                                                                                          | "astc-6x5-unorm"
                                                                                          | "astc-6x5-unorm-srgb"
                                                                                          | "astc-6x6-unorm"
                                                                                          | "astc-6x6-unorm-srgb"
                                                                                          | "astc-8x5-unorm"
                                                                                          | "astc-8x5-unorm-srgb"
                                                                                          | "astc-8x6-unorm"
                                                                                          | "astc-8x6-unorm-srgb"
                                                                                          | "astc-8x8-unorm"
                                                                                          | "astc-8x8-unorm-srgb"
                                                                                          | "astc-10x5-unorm"
                                                                                          | "astc-10x5-unorm-srgb"
                                                                                          | "astc-10x6-unorm"
                                                                                          | "astc-10x6-unorm-srgb"
                                                                                          | "astc-10x8-unorm"
                                                                                          | "astc-10x8-unorm-srgb"
                                                                                          | "astc-10x10-unorm"
                                                                                          | "astc-10x10-unorm-srgb"
                                                                                          | "astc-12x10-unorm"
                                                                                          | "astc-12x10-unorm-srgb"
                                                                                          | "astc-12x12-unorm"
                                                                                          | "astc-12x12-unorm-srgb"




                                                                                          type alias GPUVertexFormat

                                                                                          Definition #

                                                                                          "uint8x2"
                                                                                          | "uint8x4"
                                                                                          | "sint8x2"
                                                                                          | "sint8x4"
                                                                                          | "unorm8x2"
                                                                                          | "unorm8x4"
                                                                                          | "snorm8x2"
                                                                                          | "snorm8x4"
                                                                                          | "uint16x2"
                                                                                          | "uint16x4"
                                                                                          | "sint16x2"
                                                                                          | "sint16x4"
                                                                                          | "unorm16x2"
                                                                                          | "unorm16x4"
                                                                                          | "snorm16x2"
                                                                                          | "snorm16x4"
                                                                                          | "float16x2"
                                                                                          | "float16x4"
                                                                                          | "float32"
                                                                                          | "float32x2"
                                                                                          | "float32x3"
                                                                                          | "float32x4"
                                                                                          | "uint32"
                                                                                          | "uint32x2"
                                                                                          | "uint32x3"
                                                                                          | "uint32x4"
                                                                                          | "sint32"
                                                                                          | "sint32x2"
                                                                                          | "sint32x3"
                                                                                          | "sint32x4"
                                                                                          | "unorm10-10-10-2"


                                                                                          Did you find what you needed?

                                                                                          Privacy policy