cl_dx9_media_sharing.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
  24. #ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H
  25. #define __OPENCL_CL_DX9_MEDIA_SHARING_H
  26. #include <CL/cl.h>
  27. #include <CL/cl_platform.h>
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /******************************************************************************
  32. /* cl_khr_dx9_media_sharing */
  33. #define cl_khr_dx9_media_sharing 1
  34. typedef cl_uint cl_dx9_media_adapter_type_khr;
  35. typedef cl_uint cl_dx9_media_adapter_set_khr;
  36. #if defined(_WIN32)
  37. #include <d3d9.h>
  38. typedef struct _cl_dx9_surface_info_khr
  39. {
  40. IDirect3DSurface9 *resource;
  41. HANDLE shared_handle;
  42. } cl_dx9_surface_info_khr;
  43. #endif
  44. /******************************************************************************/
  45. // Error Codes
  46. #define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
  47. #define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
  48. #define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
  49. #define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
  50. // cl_media_adapter_type_khr
  51. #define CL_ADAPTER_D3D9_KHR 0x2020
  52. #define CL_ADAPTER_D3D9EX_KHR 0x2021
  53. #define CL_ADAPTER_DXVA_KHR 0x2022
  54. // cl_media_adapter_set_khr
  55. #define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
  56. #define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
  57. // cl_context_info
  58. #define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
  59. #define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
  60. #define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
  61. // cl_mem_info
  62. #define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
  63. #define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
  64. // cl_image_info
  65. #define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
  66. // cl_command_type
  67. #define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
  68. #define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
  69. /******************************************************************************/
  70. typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
  71. cl_platform_id platform,
  72. cl_uint num_media_adapters,
  73. cl_dx9_media_adapter_type_khr * media_adapter_type,
  74. void * media_adapters,
  75. cl_dx9_media_adapter_set_khr media_adapter_set,
  76. cl_uint num_entries,
  77. cl_device_id * devices,
  78. cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
  79. typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
  80. cl_context context,
  81. cl_mem_flags flags,
  82. cl_dx9_media_adapter_type_khr adapter_type,
  83. void * surface_info,
  84. cl_uint plane,
  85. cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
  86. typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
  87. cl_command_queue command_queue,
  88. cl_uint num_objects,
  89. const cl_mem * mem_objects,
  90. cl_uint num_events_in_wait_list,
  91. const cl_event * event_wait_list,
  92. cl_event * event) CL_API_SUFFIX__VERSION_1_2;
  93. typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
  94. cl_command_queue command_queue,
  95. cl_uint num_objects,
  96. const cl_mem * mem_objects,
  97. cl_uint num_events_in_wait_list,
  98. const cl_event * event_wait_list,
  99. cl_event * event) CL_API_SUFFIX__VERSION_1_2;
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103. #endif // __OPENCL_CL_DX9_MEDIA_SHARING_H