void CopyStructureCount( GpuBuffer destBuffer, int destBufferOffset )

book_4_sparkGenerated
code_blocksInput

Description

The CopyStructureCount method is used to copy the structure count from one GPU buffer to another. This is particularly useful when working with append or consume buffers in compute shaders, where the number of elements in the buffer can change dynamically.

Usage

To use the CopyStructureCount method, you need to have two GpuBuffer instances: the source buffer from which the structure count will be copied, and the destination buffer where the count will be stored. You also need to specify the offset in the destination buffer where the count should be written.

Ensure that the destination buffer is large enough to accommodate the structure count at the specified offset.

Example

// Assume sourceBuffer and destBuffer are valid GpuBuffer instances
// and destBuffer is large enough to hold the structure count at the specified offset.

int destBufferOffset = 0; // Offset in the destination buffer

// Copy the structure count from sourceBuffer to destBuffer
sourceBuffer.CopyStructureCount(destBuffer, destBufferOffset);