• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**********************************************************************************
2  * Copyright (c) 2008-2015 The Khronos Group Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and/or associated documentation files (the
6  * "Materials"), to deal in the Materials without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Materials, and to
9  * permit persons to whom the Materials are furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Materials.
14  *
15  * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16  * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17  * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18  *    https://www.khronos.org/registry/
19  *
20  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27  **********************************************************************************/
28 
29 /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
30 
31 #ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H
32 #define __OPENCL_CL_DX9_MEDIA_SHARING_H
33 
34 #include <CL/cl.h>
35 #include <CL/cl_platform.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /******************************************************************************/
42 /* cl_khr_dx9_media_sharing                                                   */
43 #define cl_khr_dx9_media_sharing 1
44 
45 typedef cl_uint             cl_dx9_media_adapter_type_khr;
46 typedef cl_uint             cl_dx9_media_adapter_set_khr;
47 
48 #if defined(_WIN32)
49 #include <d3d9.h>
50 typedef struct _cl_dx9_surface_info_khr
51 {
52     IDirect3DSurface9 *resource;
53     HANDLE shared_handle;
54 } cl_dx9_surface_info_khr;
55 #endif
56 
57 
58 /******************************************************************************/
59 
60 /* Error Codes */
61 #define CL_INVALID_DX9_MEDIA_ADAPTER_KHR                -1010
62 #define CL_INVALID_DX9_MEDIA_SURFACE_KHR                -1011
63 #define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR       -1012
64 #define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR           -1013
65 
66 /* cl_media_adapter_type_khr */
67 #define CL_ADAPTER_D3D9_KHR                              0x2020
68 #define CL_ADAPTER_D3D9EX_KHR                            0x2021
69 #define CL_ADAPTER_DXVA_KHR                              0x2022
70 
71 /* cl_media_adapter_set_khr */
72 #define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR   0x2023
73 #define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR         0x2024
74 
75 /* cl_context_info */
76 #define CL_CONTEXT_ADAPTER_D3D9_KHR                      0x2025
77 #define CL_CONTEXT_ADAPTER_D3D9EX_KHR                    0x2026
78 #define CL_CONTEXT_ADAPTER_DXVA_KHR                      0x2027
79 
80 /* cl_mem_info */
81 #define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR                0x2028
82 #define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR                0x2029
83 
84 /* cl_image_info */
85 #define CL_IMAGE_DX9_MEDIA_PLANE_KHR                     0x202A
86 
87 /* cl_command_type */
88 #define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR        0x202B
89 #define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR        0x202C
90 
91 /******************************************************************************/
92 
93 typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
94     cl_platform_id                   platform,
95     cl_uint                          num_media_adapters,
96     cl_dx9_media_adapter_type_khr *  media_adapter_type,
97     void *                           media_adapters,
98     cl_dx9_media_adapter_set_khr     media_adapter_set,
99     cl_uint                          num_entries,
100     cl_device_id *                   devices,
101     cl_uint *                        num_devices) CL_API_SUFFIX__VERSION_1_2;
102 
103 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
104     cl_context                    context,
105     cl_mem_flags                  flags,
106     cl_dx9_media_adapter_type_khr adapter_type,
107     void *                        surface_info,
108     cl_uint                       plane,
109     cl_int *                      errcode_ret) CL_API_SUFFIX__VERSION_1_2;
110 
111 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
112     cl_command_queue command_queue,
113     cl_uint          num_objects,
114     const cl_mem *   mem_objects,
115     cl_uint          num_events_in_wait_list,
116     const cl_event * event_wait_list,
117     cl_event *       event) CL_API_SUFFIX__VERSION_1_2;
118 
119 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
120     cl_command_queue command_queue,
121     cl_uint          num_objects,
122     const cl_mem *   mem_objects,
123     cl_uint          num_events_in_wait_list,
124     const cl_event * event_wait_list,
125     cl_event *       event) CL_API_SUFFIX__VERSION_1_2;
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif  /* __OPENCL_CL_DX9_MEDIA_SHARING_H */
132 
133