Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

Interoperability openCL DirectX11

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 smallGame   Members   -  Reputation: 211


Posted 31 May 2013 - 10:24 AM



My problem is at the compilation stage, or even before :


I don't have the functions : clGetDeviceIDsFromD3D11KHR, ...etc in my <CL/cl_d3d11.h>, instead I have this function pointer clGetDeviceIDsFromD3D11KHR_fn.


I have the "cl_khr_d3d11_sharing" strng in my platform extension information.


I tried to add #pragma OPENCL EXTENSION cl_khr_d3d11_sharing : enable, but doesn't work.


So if you have any idea, or if you already used it I am really interested.




#2 unbird   Crossbones+   -  Reputation: 7486


Posted 31 May 2013 - 02:10 PM

Have a look at the OpenCL Programming Guide book samples D3D10 interop (chapter 11) to get the picture. The clGetDeviceIDsFromD3D11KHR_fn is not a function pointer yet, but the type (signature) of your function pointer. Declare one like so
clGetDeviceIDsFromD3D11KHR_fn clGetDeviceIDsFromD3D11KHR = NULL;
To get the function you use clGetExtensionFunctionAddress. The sample uses some macro magic:
#define INITPFN(x) \
    x = (x ## _fn)clGetExtensionFunctionAddress(#x);\
    if(!x) { printf("failed getting %s", #x); }
... to ease the call, so in this case:

#3 smallGame   Members   -  Reputation: 211


Posted 02 June 2013 - 11:47 AM

Thanks a lot !!

This stuff is amazing, I was simulating 1 million force field particles at 30 FPS, now at more than 400 FPS :)

I was expecting a big gain because of all return tickets I was paying from CPU to GPU, now there is none !

Edited by smallGame, 02 June 2013 - 09:48 PM.

#4 unbird   Crossbones+   -  Reputation: 7486


Posted 03 June 2013 - 07:23 AM

Glad to hear. You got some nice screen shots ? 


Out of curiosity: Why not use compute shaders ? Limitations because of D3D10 hardware (cs_4_0) ?

#5 smallGame   Members   -  Reputation: 211


Posted 03 June 2013 - 06:32 PM

I don't know exactly why I used openCL, I wanted to use this tech like a aim. I was thinking to port my code from openCL to Direct Compute but then I thought it will be easier to integrate the interoperability. And I think there is something really good with openCL, it is scalable even on CPU, so I don't have to do some multi-threading , openCL will do it for me. The other good thing with openCL it is that is portable. I also wanted to integrate my stuff in a friend engine which is in OpenGL on i Platform.


So maybe now you d like to know why I used DirectX11 :) I wanted also used this tech because it was used in my job, and I knew some HLSL.


I don't have any screen shot but I created a Youtube channel : http://www.youtube.com/user/uuuq78/videos

Galaxy is the one I was talking about. In the video description I put the benchmarks in ms. I will update my videos and benchmarks with the interoperability when I will have integrated it correctly.

#6 unbird   Crossbones+   -  Reputation: 7486


Posted 04 June 2013 - 03:10 AM

Videos are even better. Quite some nice GPGPU samples you got there. Congrats.

I just wanted to hear if you had any troubles with compute shaders at all. Because I had half a year ago, so be warned: The compiler sometimes took minutes or crashed. If it compiled, the shader sometimes produced silly results. Then again, I probably did something blatantly wrong design-wise and also still used the June 2010 SDK compiler (which also has troubles with tesselation). If you go compute shader make sure to use the newest one (coming with the Windows 8 Kit).

I was so fed up to give OpenCL a shot. Played with Cloo (I'm using C#) and was positively surprised. Compilation took seconds at most (subsequent compilation even seems to be cached by the NVidia driver), and the results were fine.

Edit: That performance number of your particles is quite impressive. Smells like the interop isn't that bad a staller. Or do you have such a beefy hardware ? wink.png. If you do transliterate that sample to a compute shader, don't forget to post a comparison, please.

Edited by unbird, 04 June 2013 - 03:56 AM.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.