180d59932Sopenharmony_ci/*******************************************************************************
280d59932Sopenharmony_ci * Copyright (c) 2008-2020 The Khronos Group Inc.
380d59932Sopenharmony_ci *
480d59932Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
580d59932Sopenharmony_ci * you may not use this file except in compliance with the License.
680d59932Sopenharmony_ci * You may obtain a copy of the License at
780d59932Sopenharmony_ci *
880d59932Sopenharmony_ci *    http://www.apache.org/licenses/LICENSE-2.0
980d59932Sopenharmony_ci *
1080d59932Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1180d59932Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1280d59932Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1380d59932Sopenharmony_ci * See the License for the specific language governing permissions and
1480d59932Sopenharmony_ci * limitations under the License.
1580d59932Sopenharmony_ci ******************************************************************************/
1680d59932Sopenharmony_ci
1780d59932Sopenharmony_ci#ifndef __OPENCL_CL_D3D11_H
1880d59932Sopenharmony_ci#define __OPENCL_CL_D3D11_H
1980d59932Sopenharmony_ci
2080d59932Sopenharmony_ci#if defined(_MSC_VER)
2180d59932Sopenharmony_ci#if _MSC_VER >=1500
2280d59932Sopenharmony_ci#pragma warning( push )
2380d59932Sopenharmony_ci#pragma warning( disable : 4201 )
2480d59932Sopenharmony_ci#pragma warning( disable : 5105 )
2580d59932Sopenharmony_ci#endif
2680d59932Sopenharmony_ci#endif
2780d59932Sopenharmony_ci#include <d3d11.h>
2880d59932Sopenharmony_ci#if defined(_MSC_VER)
2980d59932Sopenharmony_ci#if _MSC_VER >=1500
3080d59932Sopenharmony_ci#pragma warning( pop )
3180d59932Sopenharmony_ci#endif
3280d59932Sopenharmony_ci#endif
3380d59932Sopenharmony_ci#include <CL/cl.h>
3480d59932Sopenharmony_ci#include <CL/cl_platform.h>
3580d59932Sopenharmony_ci
3680d59932Sopenharmony_ci#ifdef __cplusplus
3780d59932Sopenharmony_ciextern "C" {
3880d59932Sopenharmony_ci#endif
3980d59932Sopenharmony_ci
4080d59932Sopenharmony_ci/******************************************************************************
4180d59932Sopenharmony_ci * cl_khr_d3d11_sharing                                                       */
4280d59932Sopenharmony_ci#define cl_khr_d3d11_sharing 1
4380d59932Sopenharmony_ci
4480d59932Sopenharmony_citypedef cl_uint cl_d3d11_device_source_khr;
4580d59932Sopenharmony_citypedef cl_uint cl_d3d11_device_set_khr;
4680d59932Sopenharmony_ci
4780d59932Sopenharmony_ci/******************************************************************************/
4880d59932Sopenharmony_ci
4980d59932Sopenharmony_ci/* Error Codes */
5080d59932Sopenharmony_ci#define CL_INVALID_D3D11_DEVICE_KHR                  -1006
5180d59932Sopenharmony_ci#define CL_INVALID_D3D11_RESOURCE_KHR                -1007
5280d59932Sopenharmony_ci#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR       -1008
5380d59932Sopenharmony_ci#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR           -1009
5480d59932Sopenharmony_ci
5580d59932Sopenharmony_ci/* cl_d3d11_device_source */
5680d59932Sopenharmony_ci#define CL_D3D11_DEVICE_KHR                          0x4019
5780d59932Sopenharmony_ci#define CL_D3D11_DXGI_ADAPTER_KHR                    0x401A
5880d59932Sopenharmony_ci
5980d59932Sopenharmony_ci/* cl_d3d11_device_set */
6080d59932Sopenharmony_ci#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR           0x401B
6180d59932Sopenharmony_ci#define CL_ALL_DEVICES_FOR_D3D11_KHR                 0x401C
6280d59932Sopenharmony_ci
6380d59932Sopenharmony_ci/* cl_context_info */
6480d59932Sopenharmony_ci#define CL_CONTEXT_D3D11_DEVICE_KHR                  0x401D
6580d59932Sopenharmony_ci#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
6680d59932Sopenharmony_ci
6780d59932Sopenharmony_ci/* cl_mem_info */
6880d59932Sopenharmony_ci#define CL_MEM_D3D11_RESOURCE_KHR                    0x401E
6980d59932Sopenharmony_ci
7080d59932Sopenharmony_ci/* cl_image_info */
7180d59932Sopenharmony_ci#define CL_IMAGE_D3D11_SUBRESOURCE_KHR               0x401F
7280d59932Sopenharmony_ci
7380d59932Sopenharmony_ci/* cl_command_type */
7480d59932Sopenharmony_ci#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR         0x4020
7580d59932Sopenharmony_ci#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR         0x4021
7680d59932Sopenharmony_ci
7780d59932Sopenharmony_ci/******************************************************************************/
7880d59932Sopenharmony_ci
7980d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
8080d59932Sopenharmony_ci    cl_platform_id             platform,
8180d59932Sopenharmony_ci    cl_d3d11_device_source_khr d3d_device_source,
8280d59932Sopenharmony_ci    void *                     d3d_object,
8380d59932Sopenharmony_ci    cl_d3d11_device_set_khr    d3d_device_set,
8480d59932Sopenharmony_ci    cl_uint                    num_entries,
8580d59932Sopenharmony_ci    cl_device_id *             devices,
8680d59932Sopenharmony_ci    cl_uint *                  num_devices) CL_API_SUFFIX__VERSION_1_2;
8780d59932Sopenharmony_ci
8880d59932Sopenharmony_citypedef cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
8980d59932Sopenharmony_ci    cl_context     context,
9080d59932Sopenharmony_ci    cl_mem_flags   flags,
9180d59932Sopenharmony_ci    ID3D11Buffer * resource,
9280d59932Sopenharmony_ci    cl_int *       errcode_ret) CL_API_SUFFIX__VERSION_1_2;
9380d59932Sopenharmony_ci
9480d59932Sopenharmony_citypedef cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
9580d59932Sopenharmony_ci    cl_context        context,
9680d59932Sopenharmony_ci    cl_mem_flags      flags,
9780d59932Sopenharmony_ci    ID3D11Texture2D * resource,
9880d59932Sopenharmony_ci    UINT              subresource,
9980d59932Sopenharmony_ci    cl_int *          errcode_ret) CL_API_SUFFIX__VERSION_1_2;
10080d59932Sopenharmony_ci
10180d59932Sopenharmony_citypedef cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
10280d59932Sopenharmony_ci    cl_context        context,
10380d59932Sopenharmony_ci    cl_mem_flags      flags,
10480d59932Sopenharmony_ci    ID3D11Texture3D * resource,
10580d59932Sopenharmony_ci    UINT              subresource,
10680d59932Sopenharmony_ci    cl_int *          errcode_ret) CL_API_SUFFIX__VERSION_1_2;
10780d59932Sopenharmony_ci
10880d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)(
10980d59932Sopenharmony_ci    cl_command_queue command_queue,
11080d59932Sopenharmony_ci    cl_uint          num_objects,
11180d59932Sopenharmony_ci    const cl_mem *   mem_objects,
11280d59932Sopenharmony_ci    cl_uint          num_events_in_wait_list,
11380d59932Sopenharmony_ci    const cl_event * event_wait_list,
11480d59932Sopenharmony_ci    cl_event *       event) CL_API_SUFFIX__VERSION_1_2;
11580d59932Sopenharmony_ci
11680d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)(
11780d59932Sopenharmony_ci    cl_command_queue command_queue,
11880d59932Sopenharmony_ci    cl_uint          num_objects,
11980d59932Sopenharmony_ci    const cl_mem *   mem_objects,
12080d59932Sopenharmony_ci    cl_uint          num_events_in_wait_list,
12180d59932Sopenharmony_ci    const cl_event * event_wait_list,
12280d59932Sopenharmony_ci    cl_event *       event) CL_API_SUFFIX__VERSION_1_2;
12380d59932Sopenharmony_ci
12480d59932Sopenharmony_ci/***************************************************************
12580d59932Sopenharmony_ci* cl_intel_sharing_format_query_d3d11
12680d59932Sopenharmony_ci***************************************************************/
12780d59932Sopenharmony_ci#define cl_intel_sharing_format_query_d3d11 1
12880d59932Sopenharmony_ci
12980d59932Sopenharmony_ci/* when cl_khr_d3d11_sharing is supported */
13080d59932Sopenharmony_ci
13180d59932Sopenharmony_ciextern CL_API_ENTRY cl_int CL_API_CALL
13280d59932Sopenharmony_ciclGetSupportedD3D11TextureFormatsINTEL(
13380d59932Sopenharmony_ci    cl_context context,
13480d59932Sopenharmony_ci    cl_mem_flags flags,
13580d59932Sopenharmony_ci    cl_mem_object_type image_type,
13680d59932Sopenharmony_ci    cl_uint plane,
13780d59932Sopenharmony_ci    cl_uint num_entries,
13880d59932Sopenharmony_ci    DXGI_FORMAT* d3d11_formats,
13980d59932Sopenharmony_ci    cl_uint* num_texture_formats) ;
14080d59932Sopenharmony_ci
14180d59932Sopenharmony_citypedef cl_int (CL_API_CALL *
14280d59932Sopenharmony_ciclGetSupportedD3D11TextureFormatsINTEL_fn)(
14380d59932Sopenharmony_ci    cl_context context,
14480d59932Sopenharmony_ci    cl_mem_flags flags,
14580d59932Sopenharmony_ci    cl_mem_object_type image_type,
14680d59932Sopenharmony_ci    cl_uint plane,
14780d59932Sopenharmony_ci    cl_uint num_entries,
14880d59932Sopenharmony_ci    DXGI_FORMAT* d3d11_formats,
14980d59932Sopenharmony_ci    cl_uint* num_texture_formats) ;
15080d59932Sopenharmony_ci
15180d59932Sopenharmony_ci#ifdef __cplusplus
15280d59932Sopenharmony_ci}
15380d59932Sopenharmony_ci#endif
15480d59932Sopenharmony_ci
15580d59932Sopenharmony_ci#endif  /* __OPENCL_CL_D3D11_H */
15680d59932Sopenharmony_ci
157