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_DX9_MEDIA_SHARING_H_ 18 #define OPENCL_CL_DX9_MEDIA_SHARING_H_ 19 20 /* 21 ** This header is generated from the Khronos OpenCL XML API Registry. 22 */ 23 24 #if defined(_WIN32) 25 #if defined(_MSC_VER) 26 #if _MSC_VER >=1500 27 #pragma warning( push ) 28 #pragma warning( disable : 4201 ) 29 #pragma warning( disable : 5105 ) 30 #endif 31 #endif 32 #include <d3d9.h> 33 #if defined(_MSC_VER) 34 #if _MSC_VER >=1500 35 #pragma warning( pop ) 36 #endif 37 #endif 38 #endif 39 40 #include <CL/cl.h> 41 42 /* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ 43 #if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) 44 #define CL_NO_EXTENSION_PROTOTYPES 45 #endif 46 47 /* CL_NO_EXTENSION_PROTOTYPES implies 48 CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and 49 CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ 50 #if defined(CL_NO_EXTENSION_PROTOTYPES) && \ 51 !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) 52 #define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES 53 #endif 54 #if defined(CL_NO_EXTENSION_PROTOTYPES) && \ 55 !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) 56 #define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES 57 #endif 58 59 #ifdef __cplusplus 60 extern "C" { 61 #endif 62 63 /*************************************************************** 64 * cl_khr_dx9_media_sharing 65 ***************************************************************/ 66 #define cl_khr_dx9_media_sharing 1 67 #define CL_KHR_DX9_MEDIA_SHARING_EXTENSION_NAME \ 68 "cl_khr_dx9_media_sharing" 69 70 typedef cl_uint cl_dx9_media_adapter_type_khr; 71 typedef cl_uint cl_dx9_media_adapter_set_khr; 72 73 #if defined(_WIN32) 74 typedef struct _cl_dx9_surface_info_khr { 75 IDirect3DSurface9* resource; 76 HANDLE shared_handle; 77 } cl_dx9_surface_info_khr; 78 79 #endif /* defined(_WIN32) */ 80 81 /* Error codes */ 82 #define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010 83 #define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011 84 #define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012 85 #define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013 86 87 /* cl_media_adapter_type_khr */ 88 #define CL_ADAPTER_D3D9_KHR 0x2020 89 #define CL_ADAPTER_D3D9EX_KHR 0x2021 90 #define CL_ADAPTER_DXVA_KHR 0x2022 91 92 /* cl_media_adapter_set_khr */ 93 #define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023 94 #define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024 95 96 /* cl_context_info */ 97 #define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025 98 #define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026 99 #define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027 100 101 /* cl_mem_info */ 102 #define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028 103 #define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029 104 105 /* cl_image_info */ 106 #define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A 107 108 /* cl_command_type */ 109 #define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B 110 #define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C 111 112 113 typedef cl_int CL_API_CALL 114 clGetDeviceIDsFromDX9MediaAdapterKHR_t( 115 cl_platform_id platform, 116 cl_uint num_media_adapters, 117 cl_dx9_media_adapter_type_khr* media_adapter_type, 118 void* media_adapters, 119 cl_dx9_media_adapter_set_khr media_adapter_set, 120 cl_uint num_entries, 121 cl_device_id* devices, 122 cl_uint* num_devices); 123 124 typedef clGetDeviceIDsFromDX9MediaAdapterKHR_t * 125 clGetDeviceIDsFromDX9MediaAdapterKHR_fn CL_API_SUFFIX__VERSION_1_2; 126 127 typedef cl_mem CL_API_CALL 128 clCreateFromDX9MediaSurfaceKHR_t( 129 cl_context context, 130 cl_mem_flags flags, 131 cl_dx9_media_adapter_type_khr adapter_type, 132 void* surface_info, 133 cl_uint plane, 134 cl_int* errcode_ret); 135 136 typedef clCreateFromDX9MediaSurfaceKHR_t * 137 clCreateFromDX9MediaSurfaceKHR_fn CL_API_SUFFIX__VERSION_1_2; 138 139 typedef cl_int CL_API_CALL 140 clEnqueueAcquireDX9MediaSurfacesKHR_t( 141 cl_command_queue command_queue, 142 cl_uint num_objects, 143 const cl_mem* mem_objects, 144 cl_uint num_events_in_wait_list, 145 const cl_event* event_wait_list, 146 cl_event* event); 147 148 typedef clEnqueueAcquireDX9MediaSurfacesKHR_t * 149 clEnqueueAcquireDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2; 150 151 typedef cl_int CL_API_CALL 152 clEnqueueReleaseDX9MediaSurfacesKHR_t( 153 cl_command_queue command_queue, 154 cl_uint num_objects, 155 const cl_mem* mem_objects, 156 cl_uint num_events_in_wait_list, 157 const cl_event* event_wait_list, 158 cl_event* event); 159 160 typedef clEnqueueReleaseDX9MediaSurfacesKHR_t * 161 clEnqueueReleaseDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2; 162 163 #if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) 164 165 extern CL_API_ENTRY cl_int CL_API_CALL 166 clGetDeviceIDsFromDX9MediaAdapterKHR( 167 cl_platform_id platform, 168 cl_uint num_media_adapters, 169 cl_dx9_media_adapter_type_khr* media_adapter_type, 170 void* media_adapters, 171 cl_dx9_media_adapter_set_khr media_adapter_set, 172 cl_uint num_entries, 173 cl_device_id* devices, 174 cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2; 175 176 extern CL_API_ENTRY cl_mem CL_API_CALL 177 clCreateFromDX9MediaSurfaceKHR( 178 cl_context context, 179 cl_mem_flags flags, 180 cl_dx9_media_adapter_type_khr adapter_type, 181 void* surface_info, 182 cl_uint plane, 183 cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; 184 185 extern CL_API_ENTRY cl_int CL_API_CALL 186 clEnqueueAcquireDX9MediaSurfacesKHR( 187 cl_command_queue command_queue, 188 cl_uint num_objects, 189 const cl_mem* mem_objects, 190 cl_uint num_events_in_wait_list, 191 const cl_event* event_wait_list, 192 cl_event* event) CL_API_SUFFIX__VERSION_1_2; 193 194 extern CL_API_ENTRY cl_int CL_API_CALL 195 clEnqueueReleaseDX9MediaSurfacesKHR( 196 cl_command_queue command_queue, 197 cl_uint num_objects, 198 const cl_mem* mem_objects, 199 cl_uint num_events_in_wait_list, 200 const cl_event* event_wait_list, 201 cl_event* event) CL_API_SUFFIX__VERSION_1_2; 202 203 #endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ 204 205 /*************************************************************** 206 * cl_intel_dx9_media_sharing 207 ***************************************************************/ 208 #define cl_intel_dx9_media_sharing 1 209 #define CL_INTEL_DX9_MEDIA_SHARING_EXTENSION_NAME \ 210 "cl_intel_dx9_media_sharing" 211 212 typedef cl_uint cl_dx9_device_source_intel; 213 typedef cl_uint cl_dx9_device_set_intel; 214 215 /* Error codes */ 216 #define CL_INVALID_DX9_DEVICE_INTEL -1010 217 #define CL_INVALID_DX9_RESOURCE_INTEL -1011 218 #define CL_DX9_RESOURCE_ALREADY_ACQUIRED_INTEL -1012 219 #define CL_DX9_RESOURCE_NOT_ACQUIRED_INTEL -1013 220 221 /* cl_dx9_device_source_intel */ 222 #define CL_D3D9_DEVICE_INTEL 0x4022 223 #define CL_D3D9EX_DEVICE_INTEL 0x4070 224 #define CL_DXVA_DEVICE_INTEL 0x4071 225 226 /* cl_dx9_device_set_intel */ 227 #define CL_PREFERRED_DEVICES_FOR_DX9_INTEL 0x4024 228 #define CL_ALL_DEVICES_FOR_DX9_INTEL 0x4025 229 230 /* cl_context_info */ 231 #define CL_CONTEXT_D3D9_DEVICE_INTEL 0x4026 232 #define CL_CONTEXT_D3D9EX_DEVICE_INTEL 0x4072 233 #define CL_CONTEXT_DXVA_DEVICE_INTEL 0x4073 234 235 /* cl_mem_info */ 236 #define CL_MEM_DX9_RESOURCE_INTEL 0x4027 237 #define CL_MEM_DX9_SHARED_HANDLE_INTEL 0x4074 238 239 /* cl_image_info */ 240 #define CL_IMAGE_DX9_PLANE_INTEL 0x4075 241 242 /* cl_command_type */ 243 #define CL_COMMAND_ACQUIRE_DX9_OBJECTS_INTEL 0x402A 244 #define CL_COMMAND_RELEASE_DX9_OBJECTS_INTEL 0x402B 245 246 247 typedef cl_int CL_API_CALL 248 clGetDeviceIDsFromDX9INTEL_t( 249 cl_platform_id platform, 250 cl_dx9_device_source_intel dx9_device_source, 251 void* dx9_object, 252 cl_dx9_device_set_intel dx9_device_set, 253 cl_uint num_entries, 254 cl_device_id* devices, 255 cl_uint* num_devices); 256 257 typedef clGetDeviceIDsFromDX9INTEL_t * 258 clGetDeviceIDsFromDX9INTEL_fn CL_API_SUFFIX__VERSION_1_1; 259 260 typedef cl_mem CL_API_CALL 261 clCreateFromDX9MediaSurfaceINTEL_t( 262 cl_context context, 263 cl_mem_flags flags, 264 IDirect3DSurface9* resource, 265 HANDLE sharedHandle, 266 UINT plane, 267 cl_int* errcode_ret); 268 269 typedef clCreateFromDX9MediaSurfaceINTEL_t * 270 clCreateFromDX9MediaSurfaceINTEL_fn CL_API_SUFFIX__VERSION_1_1; 271 272 typedef cl_int CL_API_CALL 273 clEnqueueAcquireDX9ObjectsINTEL_t( 274 cl_command_queue command_queue, 275 cl_uint num_objects, 276 const cl_mem* mem_objects, 277 cl_uint num_events_in_wait_list, 278 const cl_event* event_wait_list, 279 cl_event* event); 280 281 typedef clEnqueueAcquireDX9ObjectsINTEL_t * 282 clEnqueueAcquireDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1; 283 284 typedef cl_int CL_API_CALL 285 clEnqueueReleaseDX9ObjectsINTEL_t( 286 cl_command_queue command_queue, 287 cl_uint num_objects, 288 cl_mem* mem_objects, 289 cl_uint num_events_in_wait_list, 290 const cl_event* event_wait_list, 291 cl_event* event); 292 293 typedef clEnqueueReleaseDX9ObjectsINTEL_t * 294 clEnqueueReleaseDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1; 295 296 #if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) 297 298 extern CL_API_ENTRY cl_int CL_API_CALL 299 clGetDeviceIDsFromDX9INTEL( 300 cl_platform_id platform, 301 cl_dx9_device_source_intel dx9_device_source, 302 void* dx9_object, 303 cl_dx9_device_set_intel dx9_device_set, 304 cl_uint num_entries, 305 cl_device_id* devices, 306 cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1; 307 308 extern CL_API_ENTRY cl_mem CL_API_CALL 309 clCreateFromDX9MediaSurfaceINTEL( 310 cl_context context, 311 cl_mem_flags flags, 312 IDirect3DSurface9* resource, 313 HANDLE sharedHandle, 314 UINT plane, 315 cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1; 316 317 extern CL_API_ENTRY cl_int CL_API_CALL 318 clEnqueueAcquireDX9ObjectsINTEL( 319 cl_command_queue command_queue, 320 cl_uint num_objects, 321 const cl_mem* mem_objects, 322 cl_uint num_events_in_wait_list, 323 const cl_event* event_wait_list, 324 cl_event* event) CL_API_SUFFIX__VERSION_1_1; 325 326 extern CL_API_ENTRY cl_int CL_API_CALL 327 clEnqueueReleaseDX9ObjectsINTEL( 328 cl_command_queue command_queue, 329 cl_uint num_objects, 330 cl_mem* mem_objects, 331 cl_uint num_events_in_wait_list, 332 const cl_event* event_wait_list, 333 cl_event* event) CL_API_SUFFIX__VERSION_1_1; 334 335 #endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ 336 337 /*************************************************************** 338 * cl_intel_sharing_format_query_dx9 339 ***************************************************************/ 340 #define cl_intel_sharing_format_query_dx9 1 341 #define CL_INTEL_SHARING_FORMAT_QUERY_DX9_EXTENSION_NAME \ 342 "cl_intel_sharing_format_query_dx9" 343 344 /* when cl_khr_dx9_media_sharing or cl_intel_dx9_media_sharing is supported */ 345 346 typedef cl_int CL_API_CALL 347 clGetSupportedDX9MediaSurfaceFormatsINTEL_t( 348 cl_context context, 349 cl_mem_flags flags, 350 cl_mem_object_type image_type, 351 cl_uint plane, 352 cl_uint num_entries, 353 D3DFORMAT* dx9_formats, 354 cl_uint* num_surface_formats); 355 356 typedef clGetSupportedDX9MediaSurfaceFormatsINTEL_t * 357 clGetSupportedDX9MediaSurfaceFormatsINTEL_fn ; 358 359 #if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) 360 361 extern CL_API_ENTRY cl_int CL_API_CALL 362 clGetSupportedDX9MediaSurfaceFormatsINTEL( 363 cl_context context, 364 cl_mem_flags flags, 365 cl_mem_object_type image_type, 366 cl_uint plane, 367 cl_uint num_entries, 368 D3DFORMAT* dx9_formats, 369 cl_uint* num_surface_formats) ; 370 371 #endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ 372 373 #ifdef __cplusplus 374 } 375 #endif 376 377 #endif /* OPENCL_CL_DX9_MEDIA_SHARING_H_ */ 378