Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WgCompGridAssignShader

Assigns elements/atoms to a bin/cell in a grid Additionally, it counts how many elements/atoms each bin/cell contains

It may also apply a transform operation to a set of atoms through the function setTransform. To deactivate this, see the function removeTransform

See constructor for more details

Hierarchy

Index

Constructors

constructor

  • Parameters

    • context: WgContext

      The WebGPU contet

    • uniforms: WgCompGridAssignShaderUniforms

      A buffer describing the grid: - gridMin: The min-point of the grid - gridMax: The max-point of the grid - gridBinSize: The xyz sizes of a grid bin/cell Together, these values describe an axis-aligned box, subdivided uniformly into bins/cells

    • in_buffers: WgCompGridAssignShaderBuffers

      The input buffers: - in_perElem_elemData: A buffer describing each element/atom Each element/atom occupies 4x float32 places in the buffer The first 3 places describe the element/atom's 3D coordinates (XYZ) The 4th places describes some other data (not used in this shader) - out_perBin_elemCount: An output buffer (per grid bin/cell) that will contain the number of atoms assigned to this grid bin/cell - out_perElem_binId: An output buffer that will contain (per element/atom) the index of the cell that this element/atom lies in

    • Optional out_buffers: WgCompGridAssignShaderOutputBuffers

      The output buffers and offsets (useful for debugging)

    Returns WgCompGridAssignShader

Properties

Private Readonly compUniforms

compUniforms: WgBuffer<Float32Array>

Private Readonly gridUniforms

gridUniforms: WgBuffer<Float32Array>

Private Readonly inputBuffers

Private Optional Readonly outputBuffers

Accessors

bindGroups

  • get bindGroups(): { bindGroup: GPUBindGroup; index: number }[]

dispatchSize

  • get dispatchSize(): [number, number, number]

outputs

  • get outputs(): { byteSize: number; dst: WgBuffer<Uint32Array>; dstOffset: number; src: WgBuffer<Uint32Array>; srcOffset: number }[]

pipeline

  • get pipeline(): GPUComputePipeline

workgroupSize

  • get workgroupSize(): [number, number, number]

Methods

dispose

  • dispose(): void

removeTransform

  • removeTransform(): Promise<void>

setTransform

  • setTransform(transform: Matrix4, elemIdStart: number, elemIdEnd: number): Promise<void>
  • Makes it so that, in future executions of this shader, a set of elements/atoms will be transformed by a matrix The function removeTransform() deactivates this feature

    Parameters

    • transform: Matrix4

      The matrix that will be used to transform the set of elements/atoms

    • elemIdStart: number

      The index of the first element/atom that will be transformed by the 'transform' matrix

    • elemIdEnd: number

      The index PLUS ONE of the last element/atom to be transformed by the 'transform' matrix i.e.: The index of the first element/atom AFTER 'elemIdStart' that will NOT be transformed by the 'transform' matrix

    Returns Promise<void>

Generated using TypeDoc