Skip to main content

@std/webgpu@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
default

Utilities for interacting with the WebGPU API.

Functions

f
createCapture(
device: GPUDevice,
width: number,
height: number
): CreateCapture

Creates a texture and buffer to use as a capture.

f
createTextureWithData(
device: GPUDevice,
descriptor: GPUTextureDescriptor,
data: Uint8Array
): GPUTexture

Create a GPUTexture with data.

f
describeTextureFormat(format: GPUTextureFormat): TextureFormatInfo

Get various information about a specific GPUTextureFormat.

f
getRowPadding(width: number): Padding

Calculates the number of bytes including necessary padding when passing a GPUImageCopyBuffer.

f
resliceBufferWithPadding(
buffer: Uint8Array,
width: number,
height: number
): Uint8Array

Creates a new buffer while removing any unnecessary empty bytes. Useful for when wanting to save an image as a specific format.

Interfaces

I

Return value for createCapture.

  • outputBuffer: GPUBuffer

    Represents the output buffer of the rendered texture. Can then be used to access and retrieve raw image data.

  • texture: GPUTexture

    Texture to be used as view to render to.

I

Return value for getRowPadding.

  • padded: number

    The number of bytes per row with padding calculated.

  • unpadded: number

    The number of bytes per row without padding calculated.

I

Return type for describeTextureFormat.

  • Valid bits of GPUTextureUsage.

  • blockDimensions: [number, number]

    Dimension of a "block" of texels. This is always [1, 1] on uncompressed textures.

  • blockSize: number

    Size in bytes of a "block" of texels. This is the size per pixel on uncompressed textures.

  • components: number

    Count of components in the texture. This determines which components there will be actual data in the shader for.

  • requiredFeature: GPUFeatureName

    The specific feature needed to use the format, if any.

  • sampleType: GPUTextureSampleType

    Type of sampling that is valid for the texture.

Variables

v

Number of bytes per pixel.

v

Buffer-Texture copies must have [bytes_per_row] aligned to this number.

create_capture

Functions

f
createCapture(
device: GPUDevice,
width: number,
height: number
): CreateCapture

Creates a texture and buffer to use as a capture.

Interfaces

I

Return value for createCapture.

  • outputBuffer: GPUBuffer

    Represents the output buffer of the rendered texture. Can then be used to access and retrieve raw image data.

  • texture: GPUTexture

    Texture to be used as view to render to.

describe_texture_format

Functions

f
describeTextureFormat(format: GPUTextureFormat): TextureFormatInfo

Get various information about a specific GPUTextureFormat.

Interfaces

I

Return type for describeTextureFormat.

  • Valid bits of GPUTextureUsage.

  • blockDimensions: [number, number]

    Dimension of a "block" of texels. This is always [1, 1] on uncompressed textures.

  • blockSize: number

    Size in bytes of a "block" of texels. This is the size per pixel on uncompressed textures.

  • components: number

    Count of components in the texture. This determines which components there will be actual data in the shader for.

  • requiredFeature: GPUFeatureName

    The specific feature needed to use the format, if any.

  • sampleType: GPUTextureSampleType

    Type of sampling that is valid for the texture.

row_padding

Functions

f
getRowPadding(width: number): Padding

Calculates the number of bytes including necessary padding when passing a GPUImageCopyBuffer.

f
resliceBufferWithPadding(
buffer: Uint8Array,
width: number,
height: number
): Uint8Array

Creates a new buffer while removing any unnecessary empty bytes. Useful for when wanting to save an image as a specific format.

Interfaces

I

Return value for getRowPadding.

  • padded: number

    The number of bytes per row with padding calculated.

  • unpadded: number

    The number of bytes per row without padding calculated.

Variables

v

Number of bytes per pixel.

v

Buffer-Texture copies must have [bytes_per_row] aligned to this number.

texture_with_data

Functions

f
createTextureWithData(
device: GPUDevice,
descriptor: GPUTextureDescriptor,
data: Uint8Array
): GPUTexture

Create a GPUTexture with data.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.