I can get frames from EGLFrame by cuGraphicsResourceGetMappedEglFrame() function . And then I want to bind the TexObject by use cuTexObjectCreate function , but it did not work. I have seen the demo in the histogram with using surface like below :
// Create a surface from the luminance plane
CUDA_RESOURCE_DESC cudaResourceDesc;
memset(&cudaResourceDesc, 0, sizeof(cudaResourceDesc));
cudaResourceDesc.resType = CU_RESOURCE_TYPE_ARRAY;
cudaResourceDesc.res.array.hArray = cudaEGLFrame.frame.pArray[0];
CUsurfObject cudaSurfObj = 0;
cuResult = cuSurfObjectCreate(&cudaSurfObj, &cudaResourceDesc);
is there any demo or tutorial to tell me how to use it?
I have use cudaMemcpy2DArrayToArray() function to copy EGLframe.frame.pArray[0] to another cuArray, and then use TexRef, it did work, but it took long time to copy data by cudaMemcpyDeviceToDevice.
Thanks for your response, I have try again with texObject, and it did work. But I have two question to ask you .
First, I declared an array CUtexObject texObj[8] pass to the function, and fetch like this: yuv = tex2D(texObj[i], x, y)
it occured error. if it cann’t pass pointer ?
Second, would it take long time to create an Object and destroy per frame ? I have seen histogram demo, it do every frame to create object and destroy…
Thanks for your answer. I have sloved the first problem.
For the second question : One frame has three surface(YUV), so I have to declare three Object, and I have 8 cameras parallel, so I have to declare 24 texObject . if I allocate 10 frames, I have to create 240 Object ? If so, is there any example I can learn ? Or is there another way I can do with it convenient?
We don’t have a sample to demonstrate this use-case.
This issue is related to general object management and doesn’t have particular limitation to take care.