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_D3D10_H
27#define __OPENCL_CL_D3D10_H
28
29#include <d3d10.h>
30#include <CL/cl.h>
31#include <CL/cl_platform.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/******************************************************************************
38 * cl_khr_d3d10_sharing                                                       */
39#define cl_khr_d3d10_sharing 1
40
41typedef cl_uint cl_d3d10_device_source_khr;
42typedef cl_uint cl_d3d10_device_set_khr;
43
44/******************************************************************************/
45
46// Error Codes
47#define CL_INVALID_D3D10_DEVICE_KHR                  -1002
48#define CL_INVALID_D3D10_RESOURCE_KHR                -1003
49#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR       -1004
50#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR           -1005
51
52// cl_d3d10_device_source_nv
53#define CL_D3D10_DEVICE_KHR                          0x4010
54#define CL_D3D10_DXGI_ADAPTER_KHR                    0x4011
55
56// cl_d3d10_device_set_nv
57#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR           0x4012
58#define CL_ALL_DEVICES_FOR_D3D10_KHR                 0x4013
59
60// cl_context_info
61#define CL_CONTEXT_D3D10_DEVICE_KHR                  0x4014
62#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
63
64// cl_mem_info
65#define CL_MEM_D3D10_RESOURCE_KHR                    0x4015
66
67// cl_image_info
68#define CL_IMAGE_D3D10_SUBRESOURCE_KHR               0x4016
69
70// cl_command_type
71#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR         0x4017
72#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR         0x4018
73
74/******************************************************************************/
75
76typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
77    cl_platform_id             platform,
78    cl_d3d10_device_source_khr d3d_device_source,
79    void *                     d3d_object,
80    cl_d3d10_device_set_khr    d3d_device_set,
81    cl_uint                    num_entries,
82    cl_device_id *             devices,
83    cl_uint *                  num_devices) CL_API_SUFFIX__VERSION_1_0;
84
85typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)(
86    cl_context     context,
87    cl_mem_flags   flags,
88    ID3D10Buffer * resource,
89    cl_int *       errcode_ret) CL_API_SUFFIX__VERSION_1_0;
90
91typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)(
92    cl_context        context,
93    cl_mem_flags      flags,
94    ID3D10Texture2D * resource,
95    UINT              subresource,
96    cl_int *          errcode_ret) CL_API_SUFFIX__VERSION_1_0;
97
98typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)(
99    cl_context        context,
100    cl_mem_flags      flags,
101    ID3D10Texture3D * resource,
102    UINT              subresource,
103    cl_int *          errcode_ret) CL_API_SUFFIX__VERSION_1_0;
104
105typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_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_0;
112
113typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)(
114    cl_command_queue command_queue,
115    cl_uint          num_objects,
116    const cl_mem *   mem_objects,
117    cl_uint          num_events_in_wait_list,
118    const cl_event * event_wait_list,
119    cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif  // __OPENCL_CL_D3D10_H
126
127