CPlusPlus TOP Upgrades For 2022.20000 Builds
Jump to navigation
Jump to search
CPlusPlus TOPs compiled against headers from builds before and including 2021.30000 won't work in builds 2022.20000 and onwards, due to the changeover to Vulkan. This page contains information for the essential changes to be made to compile your code against the newer headers.
Changes[edit]
getOutputFormat()
is gone. You need to specify the output format from withinexecute()
viaTOP_CUDAOutputInfo
for CUDA, andTOP_UploadInfo
for CPU workflow. More flexibility offered this way.- Pixel format is set in
OP_TOPInputDownloadOptions::pixelFormat
, replacingOP_TOPInputDownloadOptions::cpuMemPixelType
- The
TOP_Context
pointer isn't passed throughexecute()
anymore. To get access to it, it is still passed inCreateTOPInstance()
where you can store it in your TOP class during instantiation. This context can be used to create and work with aTOP_Buffer
, to do CUDA operations, or work with python callbacks. - For CPU workflow specifics:
OP_Inputs::getTOPDataInCPUMemory()
is gone. To download texture from the input TOPs, UseOP_TOPInput::downloadTexture()
, and specify the download options viaOP_TOPInputDownloadOptions
.OP_TOPInputDownloadType
is gone, and the option of either delaying downloading the frame, or instantly downloading the frame has to be done manually. Store the downloaded resultOP_TOPDownloadResult
as a member in your TOP class, then when you want to stall the thread to wait for the result, callgetData()
on it.TOP_OutputFormatSpecs
is gone. UseTOP_Output
andTOP_UploadInfo
.TOP_UploadInfo
stores the format of the texture to be outputted.TOP_Output
contains the methods for creating buffer viaTOP_Context::createOutputBuffer()
and uploading the texture to the GPU viaTOP_Output::uploadBuffer()
, offering lot more functionality.
- To use the CUDA workflow:
- Store a CUDA stream object
cudaStream_t
in the operator class. Instantiate it viacudaStreamCreate()
, and destroy viacudaStreamDestroy()
- To access the input data, populate an object of
OP_CUDAAcquireInfo
, then get the input intoOP_CUDAArrayInfo* inputArray
viaOP_TOPInput::getCUDAArray()
. Note that the acquiredinputArray->cudaArray
will be a nullptr untilbeginCUDAOperations()
has been called, more on this later. - To give the CUDA output back, populate an object of
TOP_CUDAOutputInfo
, then callTOP_Output::createCUDAArray()
to createOP_CUDAArrayInfo* outputInfo
that will store the outputcudaArray
. Again,outputInfo->cudaArray
will remain null untilbeginCUDAOperations()
is called. - CUDA operations can only begin once
TOP_Context::beginCUDAOperations()
has been called. The relevant input and outputOP_CUDAArrayInfo::cudaArray
objects will get valid addresses after this method has been called. Once you're done with the operations, callTOP_Context::endCUDAOperations()
. - Further, between
beginCUDAOperations()
andendCUDAOperations()
, yourOP_Inputs
inputs object cannot be accessed, so call theOP_Inputs
methods beforehand to get the values.
- Store a CUDA stream object
For a better understanding of all of these changes, refer to the examples in Samples\CPlusPlus\