blob: 50ed906b3bb23d49ba288a9510b3b4860bbd8f78 [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_D3D11_H
18#define __OPENCL_CL_D3D11_H
19
Sheri Zhang79cb9452021-09-07 14:51:49 +010020#if defined(_MSC_VER)
21#if _MSC_VER >=1500
22#pragma warning( push )
23#pragma warning( disable : 4201 )
24#endif
25#endif
Anthony Barbier6ff3b192017-09-04 18:44:23 +010026#include <d3d11.h>
Sheri Zhang79cb9452021-09-07 14:51:49 +010027#if defined(_MSC_VER)
28#if _MSC_VER >=1500
29#pragma warning( pop )
30#endif
31#endif
Anthony Barbier6ff3b192017-09-04 18:44:23 +010032#include <CL/cl.h>
33#include <CL/cl_platform.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/******************************************************************************
40 * cl_khr_d3d11_sharing */
41#define cl_khr_d3d11_sharing 1
42
43typedef cl_uint cl_d3d11_device_source_khr;
44typedef cl_uint cl_d3d11_device_set_khr;
45
46/******************************************************************************/
47
Pablo Telloe86a09f2018-01-11 15:44:48 +000048/* Error Codes */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010049#define CL_INVALID_D3D11_DEVICE_KHR -1006
50#define CL_INVALID_D3D11_RESOURCE_KHR -1007
51#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008
52#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009
53
Pablo Telloe86a09f2018-01-11 15:44:48 +000054/* cl_d3d11_device_source */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010055#define CL_D3D11_DEVICE_KHR 0x4019
56#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A
57
Pablo Telloe86a09f2018-01-11 15:44:48 +000058/* cl_d3d11_device_set */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010059#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B
60#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C
61
Pablo Telloe86a09f2018-01-11 15:44:48 +000062/* cl_context_info */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010063#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D
64#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
65
Pablo Telloe86a09f2018-01-11 15:44:48 +000066/* cl_mem_info */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010067#define CL_MEM_D3D11_RESOURCE_KHR 0x401E
68
Pablo Telloe86a09f2018-01-11 15:44:48 +000069/* cl_image_info */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010070#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F
71
Pablo Telloe86a09f2018-01-11 15:44:48 +000072/* cl_command_type */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010073#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020
74#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
75
76/******************************************************************************/
77
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000078typedef cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
Anthony Barbier6ff3b192017-09-04 18:44:23 +010079 cl_platform_id platform,
80 cl_d3d11_device_source_khr d3d_device_source,
81 void * d3d_object,
82 cl_d3d11_device_set_khr d3d_device_set,
83 cl_uint num_entries,
84 cl_device_id * devices,
85 cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
86
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000087typedef cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
Anthony Barbier6ff3b192017-09-04 18:44:23 +010088 cl_context context,
89 cl_mem_flags flags,
90 ID3D11Buffer * resource,
91 cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
92
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000093typedef cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
Anthony Barbier6ff3b192017-09-04 18:44:23 +010094 cl_context context,
95 cl_mem_flags flags,
96 ID3D11Texture2D * resource,
97 UINT subresource,
98 cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
99
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000100typedef cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100101 cl_context context,
102 cl_mem_flags flags,
103 ID3D11Texture3D * resource,
104 UINT subresource,
105 cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
106
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000107typedef cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)(
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100108 cl_command_queue command_queue,
109 cl_uint num_objects,
110 const cl_mem * mem_objects,
111 cl_uint num_events_in_wait_list,
112 const cl_event * event_wait_list,
113 cl_event * event) CL_API_SUFFIX__VERSION_1_2;
114
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000115typedef cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)(
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100116 cl_command_queue command_queue,
117 cl_uint num_objects,
118 const cl_mem * mem_objects,
119 cl_uint num_events_in_wait_list,
120 const cl_event * event_wait_list,
121 cl_event * event) CL_API_SUFFIX__VERSION_1_2;
122
123#ifdef __cplusplus
124}
125#endif
126
Pablo Telloe86a09f2018-01-11 15:44:48 +0000127#endif /* __OPENCL_CL_D3D11_H */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100128