Newton Dynamics  4.00
cl_d3d11.h
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_D3D11_H
18 #define __OPENCL_CL_D3D11_H
19 
20 #if defined(_MSC_VER)
21 #if _MSC_VER >=1500
22 #pragma warning( push )
23 #pragma warning( disable : 4201 )
24 #endif
25 #endif
26 #include <d3d11.h>
27 #if defined(_MSC_VER)
28 #if _MSC_VER >=1500
29 #pragma warning( pop )
30 #endif
31 #endif
32 #include <CL/cl.h>
33 #include <CL/cl_platform.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /******************************************************************************
40  * cl_khr_d3d11_sharing */
41 #define cl_khr_d3d11_sharing 1
42 
43 typedef cl_uint cl_d3d11_device_source_khr;
44 typedef cl_uint cl_d3d11_device_set_khr;
45 
46 /******************************************************************************/
47 
48 /* Error Codes */
49 #define CL_INVALID_D3D11_DEVICE_KHR -1006
50 #define CL_INVALID_D3D11_RESOURCE_KHR -1007
51 #define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008
52 #define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009
53 
54 /* cl_d3d11_device_source */
55 #define CL_D3D11_DEVICE_KHR 0x4019
56 #define CL_D3D11_DXGI_ADAPTER_KHR 0x401A
57 
58 /* cl_d3d11_device_set */
59 #define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B
60 #define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C
61 
62 /* cl_context_info */
63 #define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D
64 #define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
65 
66 /* cl_mem_info */
67 #define CL_MEM_D3D11_RESOURCE_KHR 0x401E
68 
69 /* cl_image_info */
70 #define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F
71 
72 /* cl_command_type */
73 #define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020
74 #define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
75 
76 /******************************************************************************/
77 
78 typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
79  cl_platform_id platform,
80  cl_d3d11_device_source_khr d3d_device_source,
81  void * d3d_object,
82  cl_d3d11_device_set_khr d3d_device_set,
83  cl_uint num_entries,
84  cl_device_id * devices,
85  cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
86 
87 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
88  cl_context context,
89  cl_mem_flags flags,
90  ID3D11Buffer * resource,
91  cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
92 
93 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
94  cl_context context,
95  cl_mem_flags flags,
96  ID3D11Texture2D * resource,
97  UINT subresource,
98  cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
99 
100 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
101  cl_context context,
102  cl_mem_flags flags,
103  ID3D11Texture3D * resource,
104  UINT subresource,
105  cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
106 
107 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)(
108  cl_command_queue command_queue,
109  cl_uint num_objects,
110  const cl_mem * mem_objects,
111  cl_uint num_events_in_wait_list,
112  const cl_event * event_wait_list,
113  cl_event * event) CL_API_SUFFIX__VERSION_1_2;
114 
115 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)(
116  cl_command_queue command_queue,
117  cl_uint num_objects,
118  const cl_mem * mem_objects,
119  cl_uint num_events_in_wait_list,
120  const cl_event * event_wait_list,
121  cl_event * event) CL_API_SUFFIX__VERSION_1_2;
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* __OPENCL_CL_D3D11_H */
128