Home -> ITexelArray -> SetInitialData
Description
The SetInitialData method supplies texel array contents to upload during allocation. Typed overloads are provided for supported vector and scalar source formats, and the raw overload allows the source image and data formats to be specified explicitly.
Initial data is associated with the resource description and consumed when AllocateMemory is called. This is useful for immutable or mostly static arrays because no separate transfer batch needs to be scheduled after allocation.
Warning
The source memory must remain valid and unmodified until AllocateMemory is called. Use QueueDataUpdate for data that can be released immediately after the call returns.
Usage
template<class T> SuccessToken SetInitialData(const std::vector<T>& sourceBuffer);
SuccessToken SetInitialData(const void* sourceBuffer, size_t sourceBufferSizeInBytes, SourceImageFormat imageFormat, SourceDataFormat dataFormat);
Argument list
- sourceBuffer [const std::vector<T> or const void*]
- The source data to use when the texel array is allocated.
- sourceBufferSizeInBytes [size_t]
- The size, in bytes, of the source data.
- imageFormat [SourceImageFormat]
- The image channel layout of the source data.
- dataFormat [SourceDataFormat]
- The data encoding of the source data.
Return value
- [SuccessToken]
- True if the operation succeeded, false otherwise. An assertion will be raised in debug builds if the result is not tested.