Method CopyFrom
CopyFrom<T>(ComputeBuffer, Rect, Rect)
Creates a destination buffer by remapping sample positions from source bounds into destination bounds.
public static ComputeBuffer CopyFrom<T>(ComputeBuffer srcBuffer, Rect inBounds, Rect outBounds)
Parameters
srcBufferComputeBufferSource compute buffer storing packed float data for one supported sample type. The buffer length must be an exact multiple of that sample type's float count.
inBoundsRectSource rectangle in normalized sample space. Samples are interpreted relative to this region before being remapped.
outBoundsRectDestination rectangle in normalized sample space. Output sample positions are written relative to this region.
Returns
- ComputeBuffer
A newly allocated compute buffer with the same packed layout as
srcBuffer, cleared to zero before remapped samples are appended.
Type Parameters
TSample layout stored in the buffer. Supported values are InstanceSample and PositionSample.
Remarks
The runtime allocates one float-based destination buffer sized for the full source sample count, then lets the compute shader append remapped samples into it. Callers own the returned buffer and are responsible for releasing it.
Exceptions
- ArgumentException
Thrown when
Tis not a supported packed sample type, or when the source buffer size does not match that packed layout.