Hi,
I am trying to copy nvdecoder output to Direct3D9 surface, but when rendering the surface I get green screen.
I am creating the surfaces like this:
m_pDevice->CreateOffscreenPlainSurfaceEx(pCodecCtx->coded_width, pCodecCtx->coded_height,
D3DFMT_NV12, D3DPOOL_DEFAULT, &m_ppSurfaces[i], nullptr, 0);
CUgraphicsResource pcuResource;
CUresult res = cuGraphicsD3D9RegisterResource(&pcuResource, m_ppSurfaces[i], 0);
And then during rendering I do the following:
cuGraphicsMapResources(m_surfaceCount, pcuResources, nullptr);
cuGraphicsSubResourceGetMappedArray(&surfaceBuffer, pSurface->cuResource, 0, 0);
CUDA_MEMCPY2D memcpy2d = {};
memcpy2d.srcMemoryType = CU_MEMORYTYPE_DEVICE;
memcpy2d.dstMemoryType = CU_MEMORYTYPE_ARRAY;
memcpy2d.srcDevice = pDecodedFrame;
memcpy2d.dstArray = surfaceBuffer;
memcpy2d.srcPitch = decodedFramePitch;
memcpy2d.dstPitch = decodedFramePitch;
memcpy2d.WidthInBytes = nWidth;
memcpy2d.Height = nHeight;
cuMemcpy2D(&memcpy2d);
cuGraphicsUnmapResources(m_surfaceCount, pcuResources, nullptr);
All API calls return success, however no video is displayed and all I see is the background color of the surfaces.
Am I missing something ?
Thanks is advance