The OpenD Programming Language

1 // DerelictCL - a Derelict based dynamic binding for OpenCL
2 // written in the D programming language
3 //
4 // Copyright: MeinMein 2013-2014.
5 // License:   Boost License 1.0
6 //            (See accompanying file LICENSE_1_0.txt or copy at
7 //             http://www.boost.org/LICENSE_1_0.txt)
8 // Authors:   Gerbrand Kamphuis (meinmein.com),
9 //            Marvin Meeng (meinmein.com).
10 module derelict.opencl.cl_gl_ext;
11 
12 import derelict.opencl.loader;
13 import derelict.opencl.types;
14 
15 extern (System)
16 {
17     // OpenCL 1.1
18     alias nothrow cl_event function(cl_context, cl_GLsync, cl_int*) da_clCreateEventFromGLsyncKHR;
19 }
20 
21 __gshared
22 {
23     // OpenCL 1.1
24     da_clCreateEventFromGLsyncKHR clCreateEventFromGLsyncKHR;
25 }
26 
27 package
28 {
29     void loadSymbols(void delegate(void**, string, bool doThrow) bindFunc)
30     {
31 
32     }
33 
34     CLVersion reload(void delegate(void**, string, bool doThrow) bindFunc, CLVersion clVer)
35     {
36         return clVer;
37     }
38 
39     private __gshared bool _EXT_cl_khr_gl_event;
40     public bool EXT_cl_khr_gl_event() @property { return _EXT_cl_khr_gl_event; }
41     private void load_cl_khr_gl_event(CLVersion clVer, cl_platform_id platform)
42     {
43         try
44         {
45             loadExtensionFunction(cast(void**)&clCreateEventFromGLsyncKHR, "clCreateEventFromGLsyncKHR", clVer, platform);
46 
47             _EXT_cl_khr_gl_event = clCreateEventFromGLsyncKHR !is null;
48         }
49         catch(Exception e)
50         {
51             _EXT_cl_khr_gl_event = false;
52         }
53     }
54 
55     void loadEXT(CLVersion clVer, cl_platform_id platform)
56     {
57         if(clVer >= CLVersion.CL11)
58         {
59             // OpenCL 1.1
60             load_cl_khr_gl_event(clVer, platform);
61         }
62     }
63 }