xref: /aosp_15_r20/external/angle/include/CL/cl_d3d11.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 /*******************************************************************************
2  * Copyright (c) 2008-2023 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 /*
21 ** This header is generated from the Khronos OpenCL XML API Registry.
22 */
23 
24 #if defined(_MSC_VER)
25 #if _MSC_VER >=1500
26 #pragma warning( push )
27 #pragma warning( disable : 4201 )
28 #pragma warning( disable : 5105 )
29 #endif
30 #endif
31 #include <d3d11.h>
32 #if defined(_MSC_VER)
33 #if _MSC_VER >=1500
34 #pragma warning( pop )
35 #endif
36 #endif
37 
38 #include <CL/cl.h>
39 
40 /* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
41 #if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
42 #define CL_NO_EXTENSION_PROTOTYPES
43 #endif
44 
45 /* CL_NO_EXTENSION_PROTOTYPES implies
46    CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
47    CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
48 #if defined(CL_NO_EXTENSION_PROTOTYPES) && \
49     !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
50 #define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
51 #endif
52 #if defined(CL_NO_EXTENSION_PROTOTYPES) && \
53     !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
54 #define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
55 #endif
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /***************************************************************
62 * cl_khr_d3d11_sharing
63 ***************************************************************/
64 #define cl_khr_d3d11_sharing 1
65 #define CL_KHR_D3D11_SHARING_EXTENSION_NAME \
66     "cl_khr_d3d11_sharing"
67 
68 typedef cl_uint             cl_d3d11_device_source_khr;
69 typedef cl_uint             cl_d3d11_device_set_khr;
70 
71 /* Error codes */
72 #define CL_INVALID_D3D11_DEVICE_KHR                         -1006
73 #define CL_INVALID_D3D11_RESOURCE_KHR                       -1007
74 #define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR              -1008
75 #define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR                  -1009
76 
77 /* cl_d3d11_device_source_khr */
78 #define CL_D3D11_DEVICE_KHR                                 0x4019
79 #define CL_D3D11_DXGI_ADAPTER_KHR                           0x401A
80 
81 /* cl_d3d11_device_set_khr */
82 #define CL_PREFERRED_DEVICES_FOR_D3D11_KHR                  0x401B
83 #define CL_ALL_DEVICES_FOR_D3D11_KHR                        0x401C
84 
85 /* cl_context_info */
86 #define CL_CONTEXT_D3D11_DEVICE_KHR                         0x401D
87 #define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR        0x402D
88 
89 /* cl_mem_info */
90 #define CL_MEM_D3D11_RESOURCE_KHR                           0x401E
91 
92 /* cl_image_info */
93 #define CL_IMAGE_D3D11_SUBRESOURCE_KHR                      0x401F
94 
95 /* cl_command_type */
96 #define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR                0x4020
97 #define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR                0x4021
98 
99 
100 typedef cl_int CL_API_CALL
101 clGetDeviceIDsFromD3D11KHR_t(
102     cl_platform_id platform,
103     cl_d3d11_device_source_khr d3d_device_source,
104     void* d3d_object,
105     cl_d3d11_device_set_khr d3d_device_set,
106     cl_uint num_entries,
107     cl_device_id* devices,
108     cl_uint* num_devices);
109 
110 typedef clGetDeviceIDsFromD3D11KHR_t *
111 clGetDeviceIDsFromD3D11KHR_fn CL_API_SUFFIX__VERSION_1_2;
112 
113 typedef cl_mem CL_API_CALL
114 clCreateFromD3D11BufferKHR_t(
115     cl_context context,
116     cl_mem_flags flags,
117     ID3D11Buffer* resource,
118     cl_int* errcode_ret);
119 
120 typedef clCreateFromD3D11BufferKHR_t *
121 clCreateFromD3D11BufferKHR_fn CL_API_SUFFIX__VERSION_1_2;
122 
123 typedef cl_mem CL_API_CALL
124 clCreateFromD3D11Texture2DKHR_t(
125     cl_context context,
126     cl_mem_flags flags,
127     ID3D11Texture2D* resource,
128     UINT subresource,
129     cl_int* errcode_ret);
130 
131 typedef clCreateFromD3D11Texture2DKHR_t *
132 clCreateFromD3D11Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_2;
133 
134 typedef cl_mem CL_API_CALL
135 clCreateFromD3D11Texture3DKHR_t(
136     cl_context context,
137     cl_mem_flags flags,
138     ID3D11Texture3D* resource,
139     UINT subresource,
140     cl_int* errcode_ret);
141 
142 typedef clCreateFromD3D11Texture3DKHR_t *
143 clCreateFromD3D11Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_2;
144 
145 typedef cl_int CL_API_CALL
146 clEnqueueAcquireD3D11ObjectsKHR_t(
147     cl_command_queue command_queue,
148     cl_uint num_objects,
149     const cl_mem* mem_objects,
150     cl_uint num_events_in_wait_list,
151     const cl_event* event_wait_list,
152     cl_event* event);
153 
154 typedef clEnqueueAcquireD3D11ObjectsKHR_t *
155 clEnqueueAcquireD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2;
156 
157 typedef cl_int CL_API_CALL
158 clEnqueueReleaseD3D11ObjectsKHR_t(
159     cl_command_queue command_queue,
160     cl_uint num_objects,
161     const cl_mem* mem_objects,
162     cl_uint num_events_in_wait_list,
163     const cl_event* event_wait_list,
164     cl_event* event);
165 
166 typedef clEnqueueReleaseD3D11ObjectsKHR_t *
167 clEnqueueReleaseD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2;
168 
169 #if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
170 
171 extern CL_API_ENTRY cl_int CL_API_CALL
172 clGetDeviceIDsFromD3D11KHR(
173     cl_platform_id platform,
174     cl_d3d11_device_source_khr d3d_device_source,
175     void* d3d_object,
176     cl_d3d11_device_set_khr d3d_device_set,
177     cl_uint num_entries,
178     cl_device_id* devices,
179     cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
180 
181 extern CL_API_ENTRY cl_mem CL_API_CALL
182 clCreateFromD3D11BufferKHR(
183     cl_context context,
184     cl_mem_flags flags,
185     ID3D11Buffer* resource,
186     cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
187 
188 extern CL_API_ENTRY cl_mem CL_API_CALL
189 clCreateFromD3D11Texture2DKHR(
190     cl_context context,
191     cl_mem_flags flags,
192     ID3D11Texture2D* resource,
193     UINT subresource,
194     cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
195 
196 extern CL_API_ENTRY cl_mem CL_API_CALL
197 clCreateFromD3D11Texture3DKHR(
198     cl_context context,
199     cl_mem_flags flags,
200     ID3D11Texture3D* resource,
201     UINT subresource,
202     cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
203 
204 extern CL_API_ENTRY cl_int CL_API_CALL
205 clEnqueueAcquireD3D11ObjectsKHR(
206     cl_command_queue command_queue,
207     cl_uint num_objects,
208     const cl_mem* mem_objects,
209     cl_uint num_events_in_wait_list,
210     const cl_event* event_wait_list,
211     cl_event* event) CL_API_SUFFIX__VERSION_1_2;
212 
213 extern CL_API_ENTRY cl_int CL_API_CALL
214 clEnqueueReleaseD3D11ObjectsKHR(
215     cl_command_queue command_queue,
216     cl_uint num_objects,
217     const cl_mem* mem_objects,
218     cl_uint num_events_in_wait_list,
219     const cl_event* event_wait_list,
220     cl_event* event) CL_API_SUFFIX__VERSION_1_2;
221 
222 #endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
223 
224 /***************************************************************
225 * cl_intel_sharing_format_query_d3d11
226 ***************************************************************/
227 #define cl_intel_sharing_format_query_d3d11 1
228 #define CL_INTEL_SHARING_FORMAT_QUERY_D3D11_EXTENSION_NAME \
229     "cl_intel_sharing_format_query_d3d11"
230 
231 /* when cl_khr_d3d11_sharing is supported */
232 
233 typedef cl_int CL_API_CALL
234 clGetSupportedD3D11TextureFormatsINTEL_t(
235     cl_context context,
236     cl_mem_flags flags,
237     cl_mem_object_type image_type,
238     cl_uint plane,
239     cl_uint num_entries,
240     DXGI_FORMAT* d3d11_formats,
241     cl_uint* num_texture_formats);
242 
243 typedef clGetSupportedD3D11TextureFormatsINTEL_t *
244 clGetSupportedD3D11TextureFormatsINTEL_fn ;
245 
246 #if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
247 
248 extern CL_API_ENTRY cl_int CL_API_CALL
249 clGetSupportedD3D11TextureFormatsINTEL(
250     cl_context context,
251     cl_mem_flags flags,
252     cl_mem_object_type image_type,
253     cl_uint plane,
254     cl_uint num_entries,
255     DXGI_FORMAT* d3d11_formats,
256     cl_uint* num_texture_formats) ;
257 
258 #endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
259 
260 #ifdef __cplusplus
261 }
262 #endif
263 
264 #endif /* OPENCL_CL_D3D11_H_ */
265