Sandbox.GpuBuffer/UsageFlags Usage { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Usage property of the GpuBuffer class specifies the type of buffer being used. This property is of type GpuBuffer.UsageFlags, which determines how the buffer is intended to be used within the GPU. Different usage flags can optimize the buffer for specific operations, such as reading, writing, or both.

Usage

To use the Usage property, you typically set it when creating a new GpuBuffer instance. The usage flag helps the system understand how the buffer will be utilized, which can affect performance and compatibility with certain GPU operations.

Example

// Example of setting the Usage property when creating a GpuBuffer
GpuBuffer buffer = new GpuBuffer<MyData>(10)
{
    Usage = GpuBuffer.UsageFlags.Structured
};

// Example of checking the Usage property
if (buffer.Usage == GpuBuffer.UsageFlags.Structured)
{
    // Perform operations specific to structured buffers
}