s&box docs

public class Sandbox.GpuBuffer

A GPU data buffer intended for use with a `Sandbox.ComputeShader`. You can read and write arbitrary data to and from the CPU and GPU. This allows for efficient parallel data processing on the GPU. Different GPU buffer types can be used depending on the provided `Sandbox.GpuBuffer.UsageFlags`. Using the default `Sandbox.GpuBuffer.UsageFlags.Structured` type buffers map to StructuredBuffer and RWStructuredBuffer in HLSL.

Broader workflow and conceptual references connected to this API.

Constructors

Showing 2 constructors

Methods

Showing 12 methods

public void Clear(uint value = 0)

Fills the entire buffer with a repeated uint32 value. Uses the native GPU fill command (vkCmdFillBuffer) — no CPU-side allocation needed.

Parameters

  • value: The uint32 value to fill with. Defaults to zero. Default: 0

public void CopyStructureCount(Sandbox.GpuBuffer destBuffer, int destBufferOffset = 0)

For `Sandbox.GpuBuffer.UsageFlags.Append` buffers there is a hidden uint 32-bit atomic counter in the buffer that contains the number of writes to the buffer after invocation of the compute shader. In order to get the value of the counter, the data needs to be copied to another GPU buffer that can be used.

Parameters

  • destBufferOffset: Default: 0

public virtual sealed void Dispose()

Destroys the GPU buffer, don't use it no more

protected virtual override void Finalize()

protected void Initialize(int elementCount, int elementSize, Sandbox.GpuBuffer.UsageFlags usageFlags = 32, string debugName = null)

Parameters

  • usageFlags: Default: 32
  • debugName: Default: null

public void SetCounterValue(uint counterValue)

Sets the counter value for `Sandbox.GpuBuffer.UsageFlags.Append` or `Sandbox.GpuBuffer.UsageFlags.Counter` structured buffers.

Properties

Showing 4 properties

public int Sandbox.GpuBuffer.ElementCount { get; set; }

Number of elements in the buffer.

public int Sandbox.GpuBuffer.ElementSize { get; set; }

Size of a single element in the buffer.

public virtual sealed bool Sandbox.GpuBuffer.IsValid { get; set; }

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.GpuBuffer

On this page