blob: 048937005353a8fb8c4fee624d3f36b9c894fe3e [file] [log] [blame]
Sheri Zhang79cb9452021-09-07 14:51:49 +01001/*******************************************************************************
2 * Copyright (c) 2008-2020 The Khronos Group Inc.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
Sheri Zhang79cb9452021-09-07 14:51:49 +01004 * 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
Anthony Barbier6ff3b192017-09-04 18:44:23 +01007 *
Sheri Zhang79cb9452021-09-07 14:51:49 +01008 * http://www.apache.org/licenses/LICENSE-2.0
Anthony Barbier6ff3b192017-09-04 18:44:23 +01009 *
Sheri Zhang79cb9452021-09-07 14:51:49 +010010 * 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 ******************************************************************************/
Anthony Barbier6ff3b192017-09-04 18:44:23 +010016
17#ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H
18#define __OPENCL_CL_DX9_MEDIA_SHARING_H
19
20#include <CL/cl.h>
21#include <CL/cl_platform.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
Pablo Telloe86a09f2018-01-11 15:44:48 +000027/******************************************************************************/
Anthony Barbier6ff3b192017-09-04 18:44:23 +010028/* cl_khr_dx9_media_sharing */
29#define cl_khr_dx9_media_sharing 1
30
31typedef cl_uint cl_dx9_media_adapter_type_khr;
32typedef cl_uint cl_dx9_media_adapter_set_khr;
33
34#if defined(_WIN32)
35#include <d3d9.h>
36typedef struct _cl_dx9_surface_info_khr
37{
38 IDirect3DSurface9 *resource;
39 HANDLE shared_handle;
40} cl_dx9_surface_info_khr;
41#endif
42
43
44/******************************************************************************/
45
Pablo Telloe86a09f2018-01-11 15:44:48 +000046/* Error Codes */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010047#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
48#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
49#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
50#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
51
Pablo Telloe86a09f2018-01-11 15:44:48 +000052/* cl_media_adapter_type_khr */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010053#define CL_ADAPTER_D3D9_KHR 0x2020
54#define CL_ADAPTER_D3D9EX_KHR 0x2021
55#define CL_ADAPTER_DXVA_KHR 0x2022
56
Pablo Telloe86a09f2018-01-11 15:44:48 +000057/* cl_media_adapter_set_khr */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010058#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
59#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
60
Pablo Telloe86a09f2018-01-11 15:44:48 +000061/* cl_context_info */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010062#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
63#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
64#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
65
Pablo Telloe86a09f2018-01-11 15:44:48 +000066/* cl_mem_info */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010067#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
68#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
69
Pablo Telloe86a09f2018-01-11 15:44:48 +000070/* cl_image_info */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010071#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
72
Pablo Telloe86a09f2018-01-11 15:44:48 +000073/* cl_command_type */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010074#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
75#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
76
77/******************************************************************************/
78
79typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
80 cl_platform_id platform,
81 cl_uint num_media_adapters,
82 cl_dx9_media_adapter_type_khr * media_adapter_type,
83 void * media_adapters,
84 cl_dx9_media_adapter_set_khr media_adapter_set,
85 cl_uint num_entries,
86 cl_device_id * devices,
87 cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
88
89typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
90 cl_context context,
91 cl_mem_flags flags,
92 cl_dx9_media_adapter_type_khr adapter_type,
93 void * surface_info,
94 cl_uint plane,
95 cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
96
97typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
98 cl_command_queue command_queue,
99 cl_uint num_objects,
100 const cl_mem * mem_objects,
101 cl_uint num_events_in_wait_list,
102 const cl_event * event_wait_list,
103 cl_event * event) CL_API_SUFFIX__VERSION_1_2;
104
105typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
106 cl_command_queue command_queue,
107 cl_uint num_objects,
108 const cl_mem * mem_objects,
109 cl_uint num_events_in_wait_list,
110 const cl_event * event_wait_list,
111 cl_event * event) CL_API_SUFFIX__VERSION_1_2;
112
113#ifdef __cplusplus
114}
115#endif
116
Pablo Telloe86a09f2018-01-11 15:44:48 +0000117#endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100118