Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

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

ComputeBuffer.CopyCount

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public static function CopyCount(src: ComputeBuffer, dst: ComputeBuffer, dstOffset: int): void;
public static void CopyCount(ComputeBuffer src, ComputeBuffer dst, int dstOffset);

Parameters

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.