GpuBufferclass
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.
Constructors2
Showing 2 constructors
No results match this filter.
Methods12
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.
| Parameter | Type | Description |
|---|---|---|
| value = 0 | uint | The uint32 value to fill with. Defaults to zero. |
void—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.
| Parameter | Type | Description |
|---|---|---|
| destBuffer | GpuBuffer | — |
| destBufferOffset = 0 | int | — |
void—public virtual sealed void Dispose()
Destroys the GPU buffer, don't use it no more
void—protected virtual override void Finalize()
void—protected void Initialize(int elementCount, int elementSize, Sandbox.GpuBuffer.UsageFlags usageFlags = 32, string debugName = null)
| Parameter | Type | Description |
|---|---|---|
| elementCount | int | — |
| elementSize | int | — |
| usageFlags = 32 | UsageFlags | — |
| debugName = null | string | — |
void—public void SetCounterValue(uint counterValue)
Sets the counter value for `Sandbox.GpuBuffer.UsageFlags.Append` or `Sandbox.GpuBuffer.UsageFlags.Counter` structured buffers.
| Parameter | Type | Description |
|---|---|---|
| counterValue | uint | — |
void—No results match this filter.
Properties4
Showing 4 properties
public int Sandbox.GpuBuffer.ElementCount { get; set; }
Number of elements in the buffer.
int—public int Sandbox.GpuBuffer.ElementSize { get; set; }
Size of a single element in the buffer.
int—public virtual sealed bool Sandbox.GpuBuffer.IsValid { get; set; }
bool—public Sandbox.GpuBuffer.UsageFlags Sandbox.GpuBuffer.Usage { get; set; }
What sort of buffer this is
No results match this filter.