See it http://forums.amd.com/devforum/messageview.cfm?catid=390&threadid=128467&enterthread=y
Hi I have coded some example trying to see how d3d interop works..
I see up to three APIs one is
KB91 - Additional Header File Required For Preview Feature: ATI Stream SDK v2.01 Support for OpenCL™ / Microsoft® DirectX® 9 & 10 Interoperability
wich shows in cl_amd.hpp clEnqueueReleaseExternalObjects similar to clEnqueueReleaseGLObjects for gl interop..
this seems to be the correct way according to KB but I can't find clEnqueueReleaseExternalObjects with clGetExtensionFunctionAddress so I also
in cl_d3d9.h I see
clEnqueueAcquireD3D9ObjectsKHR which is another way..
this is found by clGetExtensionFunctionAddress
then for buffer interop similarly we found two functions:
clCreateFromD3D9BufferKHR
and then below is
"//
// Legacy AMD CL-D3D9 interop extension
//"
with
clCreateFromD3D9Buffer
function.
With clGetExtensionFunctionAddress I found clCreateFromD3D9BufferKHR which is the correct I think.
also I'm asking for correct texture interop(yeah I know is image support required but I'm talking having correct/stable source code here not testing)
I must use this clCreateFromD3D9TextureKHR?
For testing I create context with
cl_context_properties cps[6] =
{
CL_CONTEXT_PLATFORM,
(cl_context_properties)platform,
CL_CONTEXT_D3D9_DEVICE,
(cl_context_properties)g_pd3dDevice,
0
};
with a D3d device created and then use
CL_API_ENTRY cl_mem (CL_API_CALL
*myclCreateFromD3D9TextureKHR)(
cl_context /* context */,
cl_mem_flags /* flags */,
IDirect3DTexture9 * /* texture */,
HANDLE /* shared_handle */,
UINT /* miplevel */,
cl_int * /* errcode_ret */);
myclCreateFromD3D9TextureKHR=(P2)clGetExtensionFunctionAddress("clCreateFromD3D9TextureKHR")
as clCreateFromD3D9TextureKHR is defined already in header.
then calling
myclCreateFromD3D9TextureKHR(context,CL_MEM_READ_WRITE,g_inputTex,g_handle,0,&status);
where g_inputTex is created and g_handle is the last parameter returned by CreateTexture. Is this correct?
In this way I get runtime error after enabling images with "set GPU_IMAGES_SUPPORT=1"
setting the Handle shader parameter to NULL
myclCreateFromD3D9TextureKHR(context,CL_MEM_READ_WRITE,g_inputTex,NULL,0,&status);
returns an CL_INVALID_D3D_OBJECT
What's the correct API? Is that stable?
Is there any sample showing interop?
is d3d11 interop coming? as nvidia has one d3d11 extension published in khronos registry?..
0 comments:
Post a Comment