WebGPU.rocks Logo

GPUDevice

  • GPUAdapter.requestDevice(descriptor: GPUDeviceDescriptor): Promise<GPUDevice>

    GPUDeviceDescriptor

    • label: USVString
    • requiredFeatures: sequence<GPUFeatureName>= []
    • requiredLimits: record<DOMString, GPUSize64>= {}
    • defaultQueue: GPUQueueDescriptor= {}

    GPUFeatureName

    'depth-clip-control', 'depth32float-stencil8', 'texture-compression-bc', 'texture-compression-etc2', 'texture-compression-astc', 'timestamp-query', 'indirect-first-instance', 'shader-f16', 'rg11b10ufloat-renderable', 'bgra8unorm-storage', 'float32-filterable'

    GPUSize64

    typedef GPUSize64 = unsigned long long

    GPUQueueDescriptor

    • label: USVString
  • label: USVString
  • queue: GPUQueue
  • lost: Promise<GPUDeviceLostInfo>
  • onuncapturederror: EventHandler
  • destroy(): void
  • createBuffer(descriptor: GPUBufferDescriptor): GPUBuffer

    GPUBufferDescriptor

    • label: USVString
    • size: GPUSize64required
    • usage: GPUBufferUsageFlagsrequired
    • mappedAtCreation: boolean= 'false'

    GPUSize64

    typedef GPUSize64 = unsigned long long

    GPUBufferUsageFlags

    typedef GPUBufferUsageFlags = unsigned long
    • GPUBufferUsage.MAP_READ = 0x0001
    • GPUBufferUsage.MAP_WRITE = 0x0002
    • GPUBufferUsage.COPY_SRC = 0x0004
    • GPUBufferUsage.COPY_DST = 0x0008
    • GPUBufferUsage.INDEX = 0x0010
    • GPUBufferUsage.VERTEX = 0x0020
    • GPUBufferUsage.UNIFORM = 0x0040
    • GPUBufferUsage.STORAGE = 0x0080
    • GPUBufferUsage.INDIRECT = 0x0100
    • GPUBufferUsage.QUERY_RESOLVE = 0x0200
  • createTexture(descriptor: GPUTextureDescriptor): GPUTexture

    GPUTextureDescriptor

    • label: USVString
    • size: GPUExtent3Drequired
    • mipLevelCount: GPUIntegerCoordinate= 1
    • sampleCount: GPUSize32= 1
    • dimension: GPUTextureDimension= '2d'
    • format: GPUTextureFormatrequired
    • usage: GPUTextureUsageFlagsrequired
    • viewFormats: sequence<GPUTextureFormat>= []

    GPUExtent3D

    typedef GPUExtent3D = sequence<GPUIntegerCoordinate> | GPUExtent3DDict

    GPUIntegerCoordinate

    typedef GPUIntegerCoordinate = unsigned long

    GPUExtent3DDict

    • width: GPUIntegerCoordinaterequired
    • height: GPUIntegerCoordinate= 1
    • depthOrArrayLayers: GPUIntegerCoordinate= 1

    GPUSize32

    typedef GPUSize32 = unsigned long

    GPUTextureDimension

    '1d', '2d', '3d'

    GPUTextureFormat

    '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', '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'

    GPUTextureUsageFlags

    typedef GPUTextureUsageFlags = unsigned long
    • GPUTextureUsage.COPY_SRC = 0x01
    • GPUTextureUsage.COPY_DST = 0x02
    • GPUTextureUsage.TEXTURE_BINDING = 0x04
    • GPUTextureUsage.STORAGE_BINDING = 0x08
    • GPUTextureUsage.RENDER_ATTACHMENT = 0x10
  • createSampler(descriptor: GPUSamplerDescriptor): GPUSampler

    GPUSamplerDescriptor

    • label: USVString
    • addressModeU: GPUAddressMode= 'clamp-to-edge'
    • addressModeV: GPUAddressMode= 'clamp-to-edge'
    • addressModeW: GPUAddressMode= 'clamp-to-edge'
    • magFilter: GPUFilterMode= 'nearest'
    • minFilter: GPUFilterMode= 'nearest'
    • mipmapFilter: GPUMipmapFilterMode= 'nearest'
    • lodMinClamp: float= 0
    • lodMaxClamp: float= 32
    • compare: GPUCompareFunction
    • maxAnisotropy: unsigned short= 1

    GPUAddressMode

    'clamp-to-edge', 'repeat', 'mirror-repeat'

    GPUFilterMode

    'nearest', 'linear'

    GPUMipmapFilterMode

    'nearest', 'linear'

    GPUCompareFunction

    'never', 'less', 'equal', 'less-equal', 'greater', 'not-equal', 'greater-equal', 'always'
  • importExternalTexture(descriptor: GPUExternalTextureDescriptor): GPUExternalTexture

    GPUExternalTextureDescriptor

    • label: USVString
    • source: HTMLVideoElement | VideoFramerequired
    • colorSpace: PredefinedColorSpace= 'srgb'
  • createBindGroupLayout(descriptor: GPUBindGroupLayoutDescriptor): GPUBindGroupLayout

    GPUBindGroupLayoutDescriptor

    • label: USVString
    • entries: sequence<GPUBindGroupLayoutEntry>required

    GPUBindGroupLayoutEntry

    • binding: GPUIndex32required
    • visibility: GPUShaderStageFlagsrequired
    • buffer: GPUBufferBindingLayout
    • sampler: GPUSamplerBindingLayout
    • texture: GPUTextureBindingLayout
    • storageTexture: GPUStorageTextureBindingLayout
    • externalTexture: GPUExternalTextureBindingLayout

    GPUIndex32

    typedef GPUIndex32 = unsigned long

    GPUShaderStageFlags

    typedef GPUShaderStageFlags = unsigned long
    • GPUShaderStage.VERTEX = 0x1
    • GPUShaderStage.FRAGMENT = 0x2
    • GPUShaderStage.COMPUTE = 0x4

    GPUBufferBindingLayout

    • type: GPUBufferBindingType= 'uniform'
    • hasDynamicOffset: boolean= 'false'
    • minBindingSize: GPUSize64= 0

    GPUBufferBindingType

    'uniform', 'storage', 'read-only-storage'

    GPUSize64

    typedef GPUSize64 = unsigned long long

    GPUSamplerBindingLayout

    • type: GPUSamplerBindingType= 'filtering'

    GPUSamplerBindingType

    'filtering', 'non-filtering', 'comparison'

    GPUTextureBindingLayout

    • sampleType: GPUTextureSampleType= 'float'
    • viewDimension: GPUTextureViewDimension= '2d'
    • multisampled: boolean= 'false'

    GPUTextureSampleType

    'float', 'unfilterable-float', 'depth', 'sint', 'uint'

    GPUTextureViewDimension

    '1d', '2d', '2d-array', 'cube', 'cube-array', '3d'

    GPUStorageTextureBindingLayout

    • access: GPUStorageTextureAccess= 'write-only'
    • format: GPUTextureFormatrequired
    • viewDimension: GPUTextureViewDimension= '2d'

    GPUStorageTextureAccess

    'write-only'

    GPUTextureFormat

    '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', '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'

    GPUExternalTextureBindingLayout

    (no members)
  • createPipelineLayout(descriptor: GPUPipelineLayoutDescriptor): GPUPipelineLayout

    GPUPipelineLayoutDescriptor

    GPUBindGroupLayout

    • label: USVString
  • createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup

    GPUBindGroupDescriptor

    • label: USVString
    • layout: GPUBindGroupLayoutrequired
    • entries: sequence<GPUBindGroupEntry>required

    GPUBindGroupEntry

    • binding: GPUIndex32required
    • resource: GPUBindingResourcerequired

    GPUIndex32

    typedef GPUIndex32 = unsigned long

    GPUBindingResource

    typedef GPUBindingResource = GPUSampler | GPUTextureView | GPUBufferBinding | GPUExternalTexture

    GPUSampler

    • label: USVString

    GPUTextureView

    • label: USVString

    GPUBufferBinding

    • buffer: GPUBufferrequired
    • offset: GPUSize64= 0
    • size: GPUSize64

    GPUSize64

    typedef GPUSize64 = unsigned long long

    GPUExternalTexture

    • label: USVString
  • createShaderModule(descriptor: GPUShaderModuleDescriptor): GPUShaderModule

    GPUShaderModuleDescriptor

    • label: USVString
    • code: USVStringrequired
    • sourceMap: object
    • hints: record<USVString, GPUShaderModuleCompilationHint>

    GPUShaderModuleCompilationHint

    GPUPipelineLayout

    • label: USVString

    GPUAutoLayoutMode

    'auto'
  • createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline

    GPUComputePipelineDescriptor

    • label: USVString
    • layout: GPUPipelineLayout | GPUAutoLayoutModerequired
    • compute: GPUProgrammableStagerequired

    GPUPipelineLayout

    • label: USVString

    GPUAutoLayoutMode

    'auto'

    GPUProgrammableStage

    • module: GPUShaderModulerequired
    • entryPoint: USVStringrequired
    • constants: record<USVString, GPUPipelineConstantValue>

    GPUPipelineConstantValue

    typedef GPUPipelineConstantValue = double
  • createRenderPipeline(descriptor: GPURenderPipelineDescriptor): GPURenderPipeline

    GPURenderPipelineDescriptor

    • label: USVString
    • layout: GPUPipelineLayout | GPUAutoLayoutModerequired
    • vertex: GPUVertexStaterequired
    • primitive: GPUPrimitiveState= {}
    • depthStencil: GPUDepthStencilState
    • multisample: GPUMultisampleState= {}
    • fragment: GPUFragmentState

    GPUPipelineLayout

    • label: USVString

    GPUAutoLayoutMode

    'auto'

    GPUVertexState

    • module: GPUShaderModulerequired
    • entryPoint: USVStringrequired
    • constants: record<USVString, GPUPipelineConstantValue>
    • buffers: sequence<GPUVertexBufferLayout>= []

    GPUPipelineConstantValue

    typedef GPUPipelineConstantValue = double

    GPUVertexBufferLayout

    • arrayStride: GPUSize64required
    • stepMode: GPUVertexStepMode= 'vertex'
    • attributes: sequence<GPUVertexAttribute>required

    GPUSize64

    typedef GPUSize64 = unsigned long long

    GPUVertexStepMode

    'vertex', 'instance'

    GPUVertexAttribute

    • format: GPUVertexFormatrequired
    • offset: GPUSize64required
    • shaderLocation: GPUIndex32required

    GPUVertexFormat

    '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'

    GPUIndex32

    typedef GPUIndex32 = unsigned long

    GPUPrimitiveState

    • topology: GPUPrimitiveTopology= 'triangle-list'
    • stripIndexFormat: GPUIndexFormat
    • frontFace: GPUFrontFace= 'ccw'
    • cullMode: GPUCullMode= 'none'
    • unclippedDepth: boolean= 'false'

    GPUPrimitiveTopology

    'point-list', 'line-list', 'line-strip', 'triangle-list', 'triangle-strip'

    GPUIndexFormat

    'uint16', 'uint32'

    GPUFrontFace

    'ccw', 'cw'

    GPUCullMode

    'none', 'front', 'back'

    GPUDepthStencilState

    • format: GPUTextureFormatrequired
    • depthWriteEnabled: booleanrequired
    • depthCompare: GPUCompareFunctionrequired
    • stencilFront: GPUStencilFaceState= {}
    • stencilBack: GPUStencilFaceState= {}
    • stencilReadMask: GPUStencilValue= 0xFFFFFFFF
    • stencilWriteMask: GPUStencilValue= 0xFFFFFFFF
    • depthBias: GPUDepthBias= 0
    • depthBiasSlopeScale: float= 0
    • depthBiasClamp: float= 0

    GPUTextureFormat

    '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', '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'

    GPUCompareFunction

    'never', 'less', 'equal', 'less-equal', 'greater', 'not-equal', 'greater-equal', 'always'

    GPUStencilFaceState

    • compare: GPUCompareFunction= 'always'
    • failOp: GPUStencilOperation= 'keep'
    • depthFailOp: GPUStencilOperation= 'keep'
    • passOp: GPUStencilOperation= 'keep'

    GPUStencilOperation

    'keep', 'zero', 'replace', 'invert', 'increment-clamp', 'decrement-clamp', 'increment-wrap', 'decrement-wrap'

    GPUStencilValue

    typedef GPUStencilValue = unsigned long

    GPUDepthBias

    typedef GPUDepthBias = long

    GPUMultisampleState

    • count: GPUSize32= 1
    • mask: GPUSampleMask= 0xFFFFFFFF
    • alphaToCoverageEnabled: boolean= 'false'

    GPUSize32

    typedef GPUSize32 = unsigned long

    GPUSampleMask

    typedef GPUSampleMask = unsigned long

    GPUFragmentState

    • module: GPUShaderModulerequired
    • entryPoint: USVStringrequired
    • constants: record<USVString, GPUPipelineConstantValue>
    • targets: sequence<GPUColorTargetState>required

    GPUColorTargetState

    • format: GPUTextureFormatrequired
    • blend: GPUBlendState
    • writeMask: GPUColorWriteFlags= 0xF

    GPUBlendState

    • color: GPUBlendComponentrequired
    • alpha: GPUBlendComponentrequired

    GPUBlendComponent

    • operation: GPUBlendOperation= 'add'
    • srcFactor: GPUBlendFactor= 'one'
    • dstFactor: GPUBlendFactor= 'zero'

    GPUBlendOperation

    'add', 'subtract', 'reverse-subtract', 'min', 'max'

    GPUBlendFactor

    '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'

    GPUColorWriteFlags

    typedef GPUColorWriteFlags = unsigned long
    • GPUColorWrite.RED = 0x1
    • GPUColorWrite.GREEN = 0x2
    • GPUColorWrite.BLUE = 0x4
    • GPUColorWrite.ALPHA = 0x8
    • GPUColorWrite.ALL = 0xF
  • createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Promise<GPUComputePipeline>

    GPUComputePipelineDescriptor

    • label: USVString
    • layout: GPUPipelineLayout | GPUAutoLayoutModerequired
    • compute: GPUProgrammableStagerequired

    GPUPipelineLayout

    • label: USVString

    GPUAutoLayoutMode

    'auto'

    GPUProgrammableStage

    • module: GPUShaderModulerequired
    • entryPoint: USVStringrequired
    • constants: record<USVString, GPUPipelineConstantValue>

    GPUPipelineConstantValue

    typedef GPUPipelineConstantValue = double
  • createRenderPipelineAsync(descriptor: GPURenderPipelineDescriptor): Promise<GPURenderPipeline>

    GPURenderPipelineDescriptor

    • label: USVString
    • layout: GPUPipelineLayout | GPUAutoLayoutModerequired
    • vertex: GPUVertexStaterequired
    • primitive: GPUPrimitiveState= {}
    • depthStencil: GPUDepthStencilState
    • multisample: GPUMultisampleState= {}
    • fragment: GPUFragmentState

    GPUPipelineLayout

    • label: USVString

    GPUAutoLayoutMode

    'auto'

    GPUVertexState

    • module: GPUShaderModulerequired
    • entryPoint: USVStringrequired
    • constants: record<USVString, GPUPipelineConstantValue>
    • buffers: sequence<GPUVertexBufferLayout>= []

    GPUPipelineConstantValue

    typedef GPUPipelineConstantValue = double

    GPUVertexBufferLayout

    • arrayStride: GPUSize64required
    • stepMode: GPUVertexStepMode= 'vertex'
    • attributes: sequence<GPUVertexAttribute>required

    GPUSize64

    typedef GPUSize64 = unsigned long long

    GPUVertexStepMode

    'vertex', 'instance'

    GPUVertexAttribute

    • format: GPUVertexFormatrequired
    • offset: GPUSize64required
    • shaderLocation: GPUIndex32required

    GPUVertexFormat

    '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'

    GPUIndex32

    typedef GPUIndex32 = unsigned long

    GPUPrimitiveState

    • topology: GPUPrimitiveTopology= 'triangle-list'
    • stripIndexFormat: GPUIndexFormat
    • frontFace: GPUFrontFace= 'ccw'
    • cullMode: GPUCullMode= 'none'
    • unclippedDepth: boolean= 'false'

    GPUPrimitiveTopology

    'point-list', 'line-list', 'line-strip', 'triangle-list', 'triangle-strip'

    GPUIndexFormat

    'uint16', 'uint32'

    GPUFrontFace

    'ccw', 'cw'

    GPUCullMode

    'none', 'front', 'back'

    GPUDepthStencilState

    • format: GPUTextureFormatrequired
    • depthWriteEnabled: booleanrequired
    • depthCompare: GPUCompareFunctionrequired
    • stencilFront: GPUStencilFaceState= {}
    • stencilBack: GPUStencilFaceState= {}
    • stencilReadMask: GPUStencilValue= 0xFFFFFFFF
    • stencilWriteMask: GPUStencilValue= 0xFFFFFFFF
    • depthBias: GPUDepthBias= 0
    • depthBiasSlopeScale: float= 0
    • depthBiasClamp: float= 0

    GPUTextureFormat

    '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', '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'

    GPUCompareFunction

    'never', 'less', 'equal', 'less-equal', 'greater', 'not-equal', 'greater-equal', 'always'

    GPUStencilFaceState

    • compare: GPUCompareFunction= 'always'
    • failOp: GPUStencilOperation= 'keep'
    • depthFailOp: GPUStencilOperation= 'keep'
    • passOp: GPUStencilOperation= 'keep'

    GPUStencilOperation

    'keep', 'zero', 'replace', 'invert', 'increment-clamp', 'decrement-clamp', 'increment-wrap', 'decrement-wrap'

    GPUStencilValue

    typedef GPUStencilValue = unsigned long

    GPUDepthBias

    typedef GPUDepthBias = long

    GPUMultisampleState

    • count: GPUSize32= 1
    • mask: GPUSampleMask= 0xFFFFFFFF
    • alphaToCoverageEnabled: boolean= 'false'

    GPUSize32

    typedef GPUSize32 = unsigned long

    GPUSampleMask

    typedef GPUSampleMask = unsigned long

    GPUFragmentState

    • module: GPUShaderModulerequired
    • entryPoint: USVStringrequired
    • constants: record<USVString, GPUPipelineConstantValue>
    • targets: sequence<GPUColorTargetState>required

    GPUColorTargetState

    • format: GPUTextureFormatrequired
    • blend: GPUBlendState
    • writeMask: GPUColorWriteFlags= 0xF

    GPUBlendState

    • color: GPUBlendComponentrequired
    • alpha: GPUBlendComponentrequired

    GPUBlendComponent

    • operation: GPUBlendOperation= 'add'
    • srcFactor: GPUBlendFactor= 'one'
    • dstFactor: GPUBlendFactor= 'zero'

    GPUBlendOperation

    'add', 'subtract', 'reverse-subtract', 'min', 'max'

    GPUBlendFactor

    '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'

    GPUColorWriteFlags

    typedef GPUColorWriteFlags = unsigned long
    • GPUColorWrite.RED = 0x1
    • GPUColorWrite.GREEN = 0x2
    • GPUColorWrite.BLUE = 0x4
    • GPUColorWrite.ALPHA = 0x8
    • GPUColorWrite.ALL = 0xF
  • createCommandEncoder(descriptor: GPUCommandEncoderDescriptor): GPUCommandEncoder

    GPUCommandEncoderDescriptor

    • label: USVString
  • createRenderBundleEncoder(descriptor: GPURenderBundleEncoderDescriptor): GPURenderBundleEncoder

    GPURenderBundleEncoderDescriptor

    • label: USVString
    • colorFormats: sequence<GPUTextureFormat>required
    • depthStencilFormat: GPUTextureFormat
    • sampleCount: GPUSize32= 1
    • depthReadOnly: boolean= 'false'
    • stencilReadOnly: boolean= 'false'

    GPUTextureFormat

    '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', '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'

    GPUSize32

    typedef GPUSize32 = unsigned long
  • createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet

    GPUQuerySetDescriptor

    • label: USVString
    • type: GPUQueryTyperequired
    • count: GPUSize32required

    GPUQueryType

    'occlusion', 'timestamp'

    GPUSize32

    typedef GPUSize32 = unsigned long
  • pushErrorScope(filter: GPUErrorFilter): void

    GPUErrorFilter

    'validation', 'out-of-memory', 'internal'
  • popErrorScope(): Promise<GPUError>