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