PDA

View Full Version : wglDXRegisterObjectNV fails



henniman2
08-19-2015, 08:29 AM
Hi all,

the wglDXRegisterObjectNV call always fails:


hr = pD3D->CreateDeviceEx(
lAdapter,
D3DDEVTYPE_HAL,
GetShellWindow(),
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE,
&d3dpp,
NULL,
&pD3DDev);
gl_handleD3D = get_gl_device_handle(pD3DDev); // works, gl_handleD3D is valid

m_NumSurfaces = 22;
LPDIRECT3DSURFACE9 pSurfaces[m_NumSurfaces] = {0};
hr = pDXVADecoderService->CreateSurface(
1280,
640,
m_NumSurfaces - 1,
output,
D3DPOOL_DEFAULT,
0,
DXVA2_VideoProcessorRenderTarget,
pSurfaces,
NULL
); // works, surfaces are created


glGenTextures( 1, &gl_buffer );
HANDLE h = wglDXRegisterObjectNV( d3ddev, pSurfaces[0], gl_buffer, GL_TEXTURE_RECTANGLE, WGL_ACCESS_READ_ONLY_NV ); // fails with ERROR_OPEN_FAILED


Can anyone point me to a direction how to solve this?



Best regards,
Henniman

henniman2
08-19-2015, 04:26 PM
hr = pDXVADecoderService->CreateSurface(
1280,
640,
m_NumSurfaces - 1,
output,
D3DPOOL_DEFAULT,
0,
DXVA2_VideoProcessorRenderTarget,
pSurfaces,
NULL
);



The 'output' format was wrong - NV12 does not work with DX_INTEROP, but a regular D3DFMT_A8R8G8B8 works.

All the best,
Henniman