In the Stream SDK v2.01 there was a "cl_d3d9.h". This header seems to be gone in the latest Stream SDK version. Why is that? Is AMD dropping d3d9 interop support?
DXVA is based on d3d9. DXVA does not support d3d10/11, not even in Windows 7. So if AMD does not support dxd9 interop then OpenCL can't be used for DirectShow/MediaFoundation purposes. That would be a major problem.
As far as I can tell support for d3d9 has been dropped in favor of interop with d3d10 (which is an official Khronos extension). I have tried to use OpenCL with DirectShow. I set up DirectShow as normal with d3d9 and shared the rendering resources with d3d10. The d3d10 surfaces were then shared with OpenCL. This did not work very reliably. Eventually I gave up because the code grew just too complicated.
I'm currently looking for an alternative to the DirectShow/D3D9 approach. Curious what others have to say.
Sharing resources between Direct3D9 and Direct3D10 and CoreCL sounds like a synchronization nightmare.
My main problem is that DXVA decodes to an NV12 surface. Such decoding surfaces can't be shared with Direct3D10, as far as I can tell, so the whole concept of Direct3D9 -> Direct3D10 -> CoreCL won't work with DXVA decoding. Of course a workaround would be to StretchRect the surface to an RGB texture first, then share this with Direct3D10, then access it via OpenCL, but this is exactly what I do *not* want. I want to use CoreCL to do the NV12 -> RGB conversion myself. Besides, the whole concept would be painfully complicated.
IMHO Direct3D9 interop is a must have, because the whole DXVA concept + Media Foundation is based on Direct3D9.
@AMD, if you don't want to add Direct3D9 interop, then please let us know how we're supposed to access DXVA surfaces via OpenCL. Thanks.
Originally posted by: madshi Sharing resources between Direct3D9 and Direct3D10 and CoreCL sounds like a synchronization nightmare.
I know. That's why my little project ultimately failed. For what it's worth the OpenCL SDK supplied with the CUDA toolkit (nVidia) provide sharing between OpenCL and d3d9, d3d10, and d3d11.
The Media Foundation works nicely but involves a CPU-based copy from the video frame into an D3D10 or OpenCL buffer of course. Unpacking from NV12/YUY2/etc. can still be done afterwards using OpenCL kernels.
Originally posted by: landmann The Media Foundation works nicely but involves a CPU-based copy from the video frame into an D3D10 or OpenCL buffer of course. Unpacking from NV12/YUY2/etc. can still be done afterwards using OpenCL kernels.
CPU-based copy? You mean transfering every video frame from GPU RAM -> CPU RAM and then back to GPU RAM? That would be possible, of course, but it would be awfully slow. Reading data from GPU RAM via CPU is much slower than writing data to GPU RAM.
Originally posted by: nou IMHO AMD wait for official extension from khronos.
Is khronos working on an official D3D9 interop extension? I couldn't find any indication for that.