Version: 2022.3
言語: 日本語

GraphicsBuffer

class in UnityEngine

マニュアルに切り替える

説明

GPU graphics data buffer, for working with geometry or compute shader data.

ComputeShader programs often need to read or write arbitrary data from or to memory buffers, and some rendering algorithms need a lower level access or control over geometry data than what is provided by the Mesh class. You can use GraphicsBuffer for these cases. You create the buffers from C# scripts, and then fill them with data using either C# scripts or compute shader programs.

A graphics buffer is similar to an array in C#, in that it has a number of elements (count) of the same size (stride). You must supply the intended buffer usage (target) when you create a GraphicsBuffer; for example, you must pass GraphicsBuffer.Target.Index for the buffer to be usable as a geometry index buffer.

When you have finished working with the buffer, you must manually release the GPU memory should be released. You can do this using C# dispose pattern, or by calling Release.

See Also: Graphics.RenderPrimitivesIndexed, Graphics.RenderPrimitivesIndexedIndirect, Graphics.CopyBuffer, ComputeShader, Shader.SetGlobalBuffer, Material.SetBuffer.

変数

bufferHandleThe internal handle of this GraphicsBuffer. Only valid until the buffer is disposed of. (Read Only)
countバッファ要素の数(読み取り専用) .
nameThe debug label for the graphics buffer (setter only).
strideSize of one element in the buffer. For index buffers, this must be either 2 or 4 bytes (Read Only).
targetTarget, which specifies the intended target(s) of this GraphicsBuffer (Read Only).
usageFlagsThe flags that specify how this GraphicsBuffer can be used or updated (Read Only).

コンストラクタ

GraphicsBufferCreate a Graphics Buffer.

Public 関数

GetDataRead data values from the buffer into an array. The array can only use blittable types.
GetNativeBufferPtrRetrieve a native (underlying graphics API) pointer to the buffer.
IsValidReturns true if this graphics buffer is valid, or false otherwise.
LockBufferForWriteBegins a write operation to the buffer
ReleaseRelease a Graphics Buffer.
SetCounterValueappend/consume バッファのカウンターの値を設定します。
SetData配列から値をバッファへと設定します
UnlockBufferAfterWriteEnds a write operation to the buffer

Static 関数

CopyCountCopy the counter value of a GraphicsBuffer into another buffer.