HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cl_dx9_media_sharing.h
Go to the documentation of this file.
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_DX9_MEDIA_SHARING_H
18 #define __OPENCL_CL_DX9_MEDIA_SHARING_H
19 
20 #include <CL/cl.h>
21 #include <CL/cl_platform.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /******************************************************************************/
28 /* cl_khr_dx9_media_sharing */
29 #define cl_khr_dx9_media_sharing 1
30 
33 
34 #if defined(_WIN32)
35 #if defined(_MSC_VER)
36 #if _MSC_VER >=1500
37 #pragma warning( push )
38 #pragma warning( disable : 4201 )
39 #pragma warning( disable : 5105 )
40 #endif
41 #endif
42 #include <d3d9.h>
43 #if defined(_MSC_VER)
44 #if _MSC_VER >=1500
45 #pragma warning( pop )
46 #endif
47 #endif
48 typedef struct _cl_dx9_surface_info_khr
49 {
50  IDirect3DSurface9 *resource;
51  HANDLE shared_handle;
52 } cl_dx9_surface_info_khr;
53 #endif
54 
55 
56 /******************************************************************************/
57 
58 /* Error Codes */
59 #define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
60 #define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
61 #define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
62 #define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
63 
64 /* cl_media_adapter_type_khr */
65 #define CL_ADAPTER_D3D9_KHR 0x2020
66 #define CL_ADAPTER_D3D9EX_KHR 0x2021
67 #define CL_ADAPTER_DXVA_KHR 0x2022
68 
69 /* cl_media_adapter_set_khr */
70 #define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
71 #define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
72 
73 /* cl_context_info */
74 #define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
75 #define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
76 #define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
77 
78 /* cl_mem_info */
79 #define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
80 #define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
81 
82 /* cl_image_info */
83 #define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
84 
85 /* cl_command_type */
86 #define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
87 #define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
88 
89 /******************************************************************************/
90 
92  cl_platform_id platform,
93  cl_uint num_media_adapters,
94  cl_dx9_media_adapter_type_khr * media_adapter_type,
95  void * media_adapters,
96  cl_dx9_media_adapter_set_khr media_adapter_set,
97  cl_uint num_entries,
98  cl_device_id * devices,
99  cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
100 
102  cl_context context,
104  cl_dx9_media_adapter_type_khr adapter_type,
105  void * surface_info,
106  cl_uint plane,
107  cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
108 
110  cl_command_queue command_queue,
111  cl_uint num_objects,
112  const cl_mem * mem_objects,
113  cl_uint num_events_in_wait_list,
114  const cl_event * event_wait_list,
116 
118  cl_command_queue command_queue,
119  cl_uint num_objects,
120  const cl_mem * mem_objects,
121  cl_uint num_events_in_wait_list,
122  const cl_event * event_wait_list,
124 
125 /***************************************
126 * cl_intel_dx9_media_sharing extension *
127 ****************************************/
128 
129 #define cl_intel_dx9_media_sharing 1
130 
133 
134 /* error codes */
135 #define CL_INVALID_DX9_DEVICE_INTEL -1010
136 #define CL_INVALID_DX9_RESOURCE_INTEL -1011
137 #define CL_DX9_RESOURCE_ALREADY_ACQUIRED_INTEL -1012
138 #define CL_DX9_RESOURCE_NOT_ACQUIRED_INTEL -1013
139 
140 /* cl_dx9_device_source_intel */
141 #define CL_D3D9_DEVICE_INTEL 0x4022
142 #define CL_D3D9EX_DEVICE_INTEL 0x4070
143 #define CL_DXVA_DEVICE_INTEL 0x4071
144 
145 /* cl_dx9_device_set_intel */
146 #define CL_PREFERRED_DEVICES_FOR_DX9_INTEL 0x4024
147 #define CL_ALL_DEVICES_FOR_DX9_INTEL 0x4025
148 
149 /* cl_context_info */
150 #define CL_CONTEXT_D3D9_DEVICE_INTEL 0x4026
151 #define CL_CONTEXT_D3D9EX_DEVICE_INTEL 0x4072
152 #define CL_CONTEXT_DXVA_DEVICE_INTEL 0x4073
153 
154 /* cl_mem_info */
155 #define CL_MEM_DX9_RESOURCE_INTEL 0x4027
156 #define CL_MEM_DX9_SHARED_HANDLE_INTEL 0x4074
157 
158 /* cl_image_info */
159 #define CL_IMAGE_DX9_PLANE_INTEL 0x4075
160 
161 /* cl_command_type */
162 #define CL_COMMAND_ACQUIRE_DX9_OBJECTS_INTEL 0x402A
163 #define CL_COMMAND_RELEASE_DX9_OBJECTS_INTEL 0x402B
164 /******************************************************************************/
165 
168  cl_platform_id platform,
169  cl_dx9_device_source_intel dx9_device_source,
170  void* dx9_object,
171  cl_dx9_device_set_intel dx9_device_set,
172  cl_uint num_entries,
173  cl_device_id* devices,
174  cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1;
175 
177  cl_platform_id platform,
178  cl_dx9_device_source_intel dx9_device_source,
179  void* dx9_object,
180  cl_dx9_device_set_intel dx9_device_set,
181  cl_uint num_entries,
182  cl_device_id* devices,
183  cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1;
184 
187  cl_context context,
188  cl_mem_flags flags,
189  IDirect3DSurface9* resource,
190  HANDLE sharedHandle,
191  UINT plane,
192  cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1;
193 
195  cl_context context,
197  IDirect3DSurface9* resource,
198  HANDLE sharedHandle,
199  UINT plane,
200  cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1;
201 
204  cl_command_queue command_queue,
205  cl_uint num_objects,
206  const cl_mem* mem_objects,
207  cl_uint num_events_in_wait_list,
208  const cl_event* event_wait_list,
210 
212  cl_command_queue command_queue,
213  cl_uint num_objects,
214  const cl_mem* mem_objects,
215  cl_uint num_events_in_wait_list,
216  const cl_event* event_wait_list,
217  cl_event* event) CL_API_SUFFIX__VERSION_1_1;
218 
221  cl_command_queue command_queue,
222  cl_uint num_objects,
223  cl_mem* mem_objects,
224  cl_uint num_events_in_wait_list,
225  const cl_event* event_wait_list,
227 
229  cl_command_queue command_queue,
230  cl_uint num_objects,
231  cl_mem* mem_objects,
232  cl_uint num_events_in_wait_list,
233  const cl_event* event_wait_list,
234  cl_event* event) CL_API_SUFFIX__VERSION_1_1;
235 
236 /***************************************************************
237 * cl_intel_sharing_format_query_dx9
238 ***************************************************************/
239 #define cl_intel_sharing_format_query_dx9 1
240 
241 /* when cl_khr_dx9_media_sharing or cl_intel_dx9_media_sharing is supported */
242 
245  cl_context context,
246  cl_mem_flags flags,
247  cl_mem_object_type image_type,
248  cl_uint plane,
249  cl_uint num_entries,
250  D3DFORMAT* dx9_formats,
251  cl_uint* num_surface_formats) ;
252 
253 typedef cl_int (CL_API_CALL *
255  cl_context context,
257  cl_mem_object_type image_type,
258  cl_uint plane,
259  cl_uint num_entries,
260  D3DFORMAT* dx9_formats,
261  cl_uint* num_surface_formats) ;
262 
263 #ifdef __cplusplus
264 }
265 #endif
266 
267 #endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */
268 
struct _cl_device_id * cl_device_id
Definition: cl.h:30
uint32_t cl_uint
Definition: cl_platform.h:261
cl_mem(CL_API_CALL * clCreateFromDX9MediaSurfaceINTEL_fn)(cl_context context, cl_mem_flags flags, IDirect3DSurface9 *resource, HANDLE sharedHandle, UINT plane, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1
GLbitfield flags
Definition: glcorearb.h:1596
struct _cl_context * cl_context
Definition: cl.h:31
cl_int(CL_API_CALL * clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(cl_platform_id platform, cl_uint num_media_adapters, cl_dx9_media_adapter_type_khr *media_adapter_type, void *media_adapters, cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2
cl_uint cl_mem_object_type
Definition: cl.h:70
cl_int(CL_API_CALL * clEnqueueAcquireDX9MediaSurfacesKHR_fn)(cl_command_queue command_queue, cl_uint num_objects, const cl_mem *mem_objects, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event) CL_API_SUFFIX__VERSION_1_2
int32_t cl_int
Definition: cl_platform.h:260
#define CL_API_SUFFIX__VERSION_1_2
Definition: cl_platform.h:69
struct _cl_platform_id * cl_platform_id
Definition: cl.h:29
struct _cl_event * event
Definition: glcorearb.h:2961
#define CL_API_ENTRY
Definition: cl_platform.h:38
cl_mem(CL_API_CALL * clCreateFromDX9MediaSurfaceKHR_fn)(cl_context context, cl_mem_flags flags, cl_dx9_media_adapter_type_khr adapter_type, void *surface_info, cl_uint plane, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2
cl_int(CL_API_CALL * clGetDeviceIDsFromDX9INTEL_fn)(cl_platform_id platform, cl_dx9_device_source_intel dx9_device_source, void *dx9_object, cl_dx9_device_set_intel dx9_device_set, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_1
cl_int(CL_API_CALL * clEnqueueReleaseDX9ObjectsINTEL_fn)(cl_command_queue command_queue, cl_uint num_objects, cl_mem *mem_objects, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event) CL_API_SUFFIX__VERSION_1_1
cl_uint cl_dx9_device_source_intel
cl_int(CL_API_CALL * clGetSupportedDX9MediaSurfaceFormatsINTEL_fn)(cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint plane, cl_uint num_entries, D3DFORMAT *dx9_formats, cl_uint *num_surface_formats)
cl_int(CL_API_CALL * clEnqueueAcquireDX9ObjectsINTEL_fn)(cl_command_queue command_queue, cl_uint num_objects, const cl_mem *mem_objects, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event) CL_API_SUFFIX__VERSION_1_1
struct _cl_mem * cl_mem
Definition: cl.h:33
cl_uint cl_dx9_device_set_intel
cl_uint cl_dx9_media_adapter_type_khr
CL_API_ENTRY cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceINTEL(cl_context context, cl_mem_flags flags, IDirect3DSurface9 *resource, HANDLE sharedHandle, UINT plane, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1
CL_API_ENTRY cl_int CL_API_CALL clGetSupportedDX9MediaSurfaceFormatsINTEL(cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint plane, cl_uint num_entries, D3DFORMAT *dx9_formats, cl_uint *num_surface_formats)
CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireDX9ObjectsINTEL(cl_command_queue command_queue, cl_uint num_objects, const cl_mem *mem_objects, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event) CL_API_SUFFIX__VERSION_1_1
struct _cl_event * cl_event
Definition: cl.h:36
struct _cl_command_queue * cl_command_queue
Definition: cl.h:32
CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseDX9ObjectsINTEL(cl_command_queue command_queue, cl_uint num_objects, cl_mem *mem_objects, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event) CL_API_SUFFIX__VERSION_1_1
CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromDX9INTEL(cl_platform_id platform, cl_dx9_device_source_intel dx9_device_source, void *dx9_object, cl_dx9_device_set_intel dx9_device_set, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_1
#define CL_API_SUFFIX__VERSION_1_1
Definition: cl_platform.h:68
cl_uint cl_dx9_media_adapter_set_khr
#define CL_API_CALL
Definition: cl_platform.h:41
cl_int(CL_API_CALL * clEnqueueReleaseDX9MediaSurfacesKHR_fn)(cl_command_queue command_queue, cl_uint num_objects, const cl_mem *mem_objects, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event) CL_API_SUFFIX__VERSION_1_2
cl_bitfield cl_mem_flags
Definition: cl.h:66
UINT
Definition: ImfPixelType.h:24