Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ComputeBuffer.CopyCount

static function CopyCount(src: ComputeBuffer, dst: ComputeBuffer, dstOffset: int): void;
static void CopyCount(ComputeBuffer src, ComputeBuffer dst, int dstOffset);
static def CopyCount(src as ComputeBuffer, dst as ComputeBuffer, dstOffset as int) as void

Description

Set buffer data.

Compute buffer data can be filled from an aribrary array of value types (simple types like ints or floats; or struct types like Vector3 or Color). Read buffer data.

Reads buffer data into an aribrary array of value types (simple types like ints or floats; or struct types like Vector3 or Color). Note that reading data back from the buffer can be quite slow, as the CPU will have to wait for GPU to finish any pending operations and read the data back to system memory. Copy counter value of append/consume buffer into another buffer.

CopyCount takes an append or consume buffer as src, and copies its "counter" value into dst buffer at given byte offset.

This is most commonly used in conjunction with Graphics.DrawProceduralIndirect, to render arbitrary number of primitives without reading their count back to the CPU.