1 /*******************************************************************************
2  * Copyright (c) 2008-2020 The Khronos Group Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 #ifndef __OPENCL_CL_D3D10_H
18 #define __OPENCL_CL_D3D10_H
19 
20 #include <d3d10.h>
21 #include <CL/cl.h>
22 #include <CL/cl_platform.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /******************************************************************************
29  * cl_khr_d3d10_sharing                                                       */
30 #define cl_khr_d3d10_sharing 1
31 
32 typedef cl_uint cl_d3d10_device_source_khr;
33 typedef cl_uint cl_d3d10_device_set_khr;
34 
35 /******************************************************************************/
36 
37 /* Error Codes */
38 #define CL_INVALID_D3D10_DEVICE_KHR                  -1002
39 #define CL_INVALID_D3D10_RESOURCE_KHR                -1003
40 #define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR       -1004
41 #define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR           -1005
42 
43 /* cl_d3d10_device_source_nv */
44 #define CL_D3D10_DEVICE_KHR                          0x4010
45 #define CL_D3D10_DXGI_ADAPTER_KHR                    0x4011
46 
47 /* cl_d3d10_device_set_nv */
48 #define CL_PREFERRED_DEVICES_FOR_D3D10_KHR           0x4012
49 #define CL_ALL_DEVICES_FOR_D3D10_KHR                 0x4013
50 
51 /* cl_context_info */
52 #define CL_CONTEXT_D3D10_DEVICE_KHR                  0x4014
53 #define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
54 
55 /* cl_mem_info */
56 #define CL_MEM_D3D10_RESOURCE_KHR                    0x4015
57 
58 /* cl_image_info */
59 #define CL_IMAGE_D3D10_SUBRESOURCE_KHR               0x4016
60 
61 /* cl_command_type */
62 #define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR         0x4017
63 #define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR         0x4018
64 
65 /******************************************************************************/
66 
67 typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
68     cl_platform_id             platform,
69     cl_d3d10_device_source_khr d3d_device_source,
70     void *                     d3d_object,
71     cl_d3d10_device_set_khr    d3d_device_set,
72     cl_uint                    num_entries,
73     cl_device_id *             devices,
74     cl_uint *                  num_devices) CL_API_SUFFIX__VERSION_1_0;
75 
76 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)(
77     cl_context     context,
78     cl_mem_flags   flags,
79     ID3D10Buffer * resource,
80     cl_int *       errcode_ret) CL_API_SUFFIX__VERSION_1_0;
81 
82 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)(
83     cl_context        context,
84     cl_mem_flags      flags,
85     ID3D10Texture2D * resource,
86     UINT              subresource,
87     cl_int *          errcode_ret) CL_API_SUFFIX__VERSION_1_0;
88 
89 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)(
90     cl_context        context,
91     cl_mem_flags      flags,
92     ID3D10Texture3D * resource,
93     UINT              subresource,
94     cl_int *          errcode_ret) CL_API_SUFFIX__VERSION_1_0;
95 
96 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)(
97     cl_command_queue command_queue,
98     cl_uint          num_objects,
99     const cl_mem *   mem_objects,
100     cl_uint          num_events_in_wait_list,
101     const cl_event * event_wait_list,
102     cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
103 
104 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)(
105     cl_command_queue command_queue,
106     cl_uint          num_objects,
107     const cl_mem *   mem_objects,
108     cl_uint          num_events_in_wait_list,
109     const cl_event * event_wait_list,
110     cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif  /* __OPENCL_CL_D3D10_H */
117 
118