ドキュメント

Unity Engine

Unity Engine

ComputeBuffer

Create a Compute Buffer.
読み終わるまでの所要時間 2 分最終更新 1ヶ月前

Definition

  • Type: Constructor
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

ComputeBuffer(int, int)

Create a Compute Buffer.
public ComputeBuffer(int count, int stride)

Parameters

count

Number of elements in the buffer.

stride

Size of one element in the buffer, in bytes. Must be a multiple of 4 and less than 2048, and match the size of the buffer type in the shader. See Compute Shaders for cross-platform compatibility information.

Remarks

Use ComputeBuffer.Release to release the buffer when no longer needed.

ComputeBuffer(int, int, ComputeBufferType)

Create a Compute Buffer.
public ComputeBuffer(int count, int stride, ComputeBufferType type)

Parameters

count

Number of elements in the buffer.

stride

Size of one element in the buffer, in bytes. Must be a multiple of 4 and less than 2048, and match the size of the buffer type in the shader. See Compute Shaders for cross-platform compatibility information.

Type of the buffer, default is ComputeBufferType.Default (structured buffer).

Remarks

Use ComputeBuffer.Release to release the buffer when no longer needed.

ComputeBuffer(int, int, ComputeBufferType, ComputeBufferMode)

Create a Compute Buffer.
public ComputeBuffer(int count, int stride, ComputeBufferType type, ComputeBufferMode usage)

Parameters

count

Number of elements in the buffer.

stride

Size of one element in the buffer, in bytes. Must be a multiple of 4 and less than 2048, and match the size of the buffer type in the shader. See Compute Shaders for cross-platform compatibility information.

Type of the buffer, default is ComputeBufferType.Default (structured buffer).

Usage mode of the buffer, default is ComputeBufferModeImmutable.

Remarks

Use ComputeBuffer.Release to release the buffer when no longer needed.