1 /********************************************************************************** 2 * Copyright (c) 2008-2012 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 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 22 **********************************************************************************/ 23 24 /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 26 #ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H 27 #define __OPENCL_CL_DX9_MEDIA_SHARING_H 28 29 #include <CL/cl.h> 30 #include <CL/cl_platform.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /****************************************************************************** 37 /* cl_khr_dx9_media_sharing */ 38 #define cl_khr_dx9_media_sharing 1 39 40 typedef cl_uint cl_dx9_media_adapter_type_khr; 41 typedef cl_uint cl_dx9_media_adapter_set_khr; 42 43 #if defined(_WIN32) 44 #include <d3d9.h> 45 typedef struct _cl_dx9_surface_info_khr 46 { 47 IDirect3DSurface9 *resource; 48 HANDLE shared_handle; 49 } cl_dx9_surface_info_khr; 50 #endif 51 52 53 /******************************************************************************/ 54 55 // Error Codes 56 #define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010 57 #define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011 58 #define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012 59 #define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013 60 61 // cl_media_adapter_type_khr 62 #define CL_ADAPTER_D3D9_KHR 0x2020 63 #define CL_ADAPTER_D3D9EX_KHR 0x2021 64 #define CL_ADAPTER_DXVA_KHR 0x2022 65 66 // cl_media_adapter_set_khr 67 #define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023 68 #define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024 69 70 // cl_context_info 71 #define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025 72 #define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026 73 #define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027 74 75 // cl_mem_info 76 #define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028 77 #define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029 78 79 // cl_image_info 80 #define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A 81 82 // cl_command_type 83 #define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B 84 #define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C 85 86 /******************************************************************************/ 87 88 typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)( 89 cl_platform_id platform, 90 cl_uint num_media_adapters, 91 cl_dx9_media_adapter_type_khr * media_adapter_type, 92 void * media_adapters, 93 cl_dx9_media_adapter_set_khr media_adapter_set, 94 cl_uint num_entries, 95 cl_device_id * devices, 96 cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2; 97 98 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)( 99 cl_context context, 100 cl_mem_flags flags, 101 cl_dx9_media_adapter_type_khr adapter_type, 102 void * surface_info, 103 cl_uint plane, 104 cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; 105 106 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)( 107 cl_command_queue command_queue, 108 cl_uint num_objects, 109 const cl_mem * mem_objects, 110 cl_uint num_events_in_wait_list, 111 const cl_event * event_wait_list, 112 cl_event * event) CL_API_SUFFIX__VERSION_1_2; 113 114 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)( 115 cl_command_queue command_queue, 116 cl_uint num_objects, 117 const cl_mem * mem_objects, 118 cl_uint num_events_in_wait_list, 119 const cl_event * event_wait_list, 120 cl_event * event) CL_API_SUFFIX__VERSION_1_2; 121 122 #ifdef __cplusplus 123 } 124 #endif 125 126 #endif // __OPENCL_CL_DX9_MEDIA_SHARING_H 127 128