CPlusPlus TOP Upgrades For 2022.20000 Builds
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
getOutputFormat()is gone. You need to specify the output format from withinexecute()viaTOP_CUDAOutputInfofor CUDA, andTOP_UploadInfofor CPU workflow. More flexibility offered this way.- Pixel format is set in
OP_TOPInputDownloadOptions::pixelFormat, replacingOP_TOPInputDownloadOptions::cpuMemPixelType - The
TOP_Contextpointer 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_TOPInputDownloadTypeis gone, and the option of either delaying downloading the frame, or instantly downloading the frame has to be done manually. Store the downloaded resultOP_TOPDownloadResultas a member in your TOP class, then when you want to stall the thread to wait for the result, callgetData()on it.TOP_OutputFormatSpecsis gone. UseTOP_OutputandTOP_UploadInfo.TOP_UploadInfostores the format of the texture to be outputted.TOP_Outputcontains 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_tin 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* inputArrayviaOP_TOPInput::getCUDAArray(). Note that the acquiredinputArray->cudaArraywill 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* outputInfothat will store the outputcudaArray. Again,outputInfo->cudaArraywill remain null untilbeginCUDAOperations()is called. - CUDA operations can only begin once
TOP_Context::beginCUDAOperations()has been called. The relevant input and outputOP_CUDAArrayInfo::cudaArrayobjects 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_Inputsinputs object cannot be accessed, so call theOP_Inputsmethods 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\