|
| 1 | +/********************************************************************************** |
| 2 | + * Copyright (c) 2008-2009 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 | +#ifndef __OPENCL_CL_D3D11_EXT_H |
| 25 | +#define __OPENCL_CL_D3D11_EXT_H |
| 26 | + |
| 27 | +#include <d3d11.h> |
| 28 | +#include <CL/cl.h> |
| 29 | +#include <CL/cl_platform.h> |
| 30 | + |
| 31 | +#ifdef __cplusplus |
| 32 | +extern "C" { |
| 33 | +#endif |
| 34 | + |
| 35 | +/****************************************************************************** |
| 36 | + * cl_nv_d3d11_sharing */ |
| 37 | + |
| 38 | +typedef cl_uint cl_d3d11_device_source_nv; |
| 39 | +typedef cl_uint cl_d3d11_device_set_nv; |
| 40 | + |
| 41 | +/******************************************************************************/ |
| 42 | + |
| 43 | +// Error Codes |
| 44 | +#define CL_INVALID_D3D11_DEVICE_NV -1006 |
| 45 | +#define CL_INVALID_D3D11_RESOURCE_NV -1007 |
| 46 | +#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_NV -1008 |
| 47 | +#define CL_D3D11_RESOURCE_NOT_ACQUIRED_NV -1009 |
| 48 | + |
| 49 | +// cl_d3d11_device_source_nv |
| 50 | +#define CL_D3D11_DEVICE_NV 0x4019 |
| 51 | +#define CL_D3D11_DXGI_ADAPTER_NV 0x401A |
| 52 | + |
| 53 | +// cl_d3d11_device_set_nv |
| 54 | +#define CL_PREFERRED_DEVICES_FOR_D3D11_NV 0x401B |
| 55 | +#define CL_ALL_DEVICES_FOR_D3D11_NV 0x401C |
| 56 | + |
| 57 | +// cl_context_info |
| 58 | +#define CL_CONTEXT_D3D11_DEVICE_NV 0x401D |
| 59 | + |
| 60 | +// cl_mem_info |
| 61 | +#define CL_MEM_D3D11_RESOURCE_NV 0x401E |
| 62 | + |
| 63 | +// cl_image_info |
| 64 | +#define CL_IMAGE_D3D11_SUBRESOURCE_NV 0x401F |
| 65 | + |
| 66 | +// cl_command_type |
| 67 | +#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_NV 0x4020 |
| 68 | +#define CL_COMMAND_RELEASE_D3D11_OBJECTS_NV 0x4021 |
| 69 | + |
| 70 | +/******************************************************************************/ |
| 71 | + |
| 72 | +typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11NV_fn)( |
| 73 | + cl_platform_id platform, |
| 74 | + cl_d3d11_device_source_nv d3d_device_source, |
| 75 | + void * d3d_object, |
| 76 | + cl_d3d11_device_set_nv d3d_device_set, |
| 77 | + cl_uint num_entries, |
| 78 | + cl_device_id * devices, |
| 79 | + cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0; |
| 80 | + |
| 81 | +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferNV_fn)( |
| 82 | + cl_context context, |
| 83 | + cl_mem_flags flags, |
| 84 | + ID3D11Buffer * resource, |
| 85 | + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; |
| 86 | + |
| 87 | +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DNV_fn)( |
| 88 | + cl_context context, |
| 89 | + cl_mem_flags flags, |
| 90 | + ID3D11Texture2D * resource, |
| 91 | + UINT subresource, |
| 92 | + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; |
| 93 | + |
| 94 | +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DNV_fn)( |
| 95 | + cl_context context, |
| 96 | + cl_mem_flags flags, |
| 97 | + ID3D11Texture3D * resource, |
| 98 | + UINT subresource, |
| 99 | + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; |
| 100 | + |
| 101 | +typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsNV_fn)( |
| 102 | + cl_command_queue command_queue, |
| 103 | + cl_uint num_objects, |
| 104 | + const cl_mem * mem_objects, |
| 105 | + cl_uint num_events_in_wait_list, |
| 106 | + const cl_event * event_wait_list, |
| 107 | + cl_event * event) CL_API_SUFFIX__VERSION_1_0; |
| 108 | + |
| 109 | +typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsNV_fn)( |
| 110 | + cl_command_queue command_queue, |
| 111 | + cl_uint num_objects, |
| 112 | + cl_mem * mem_objects, |
| 113 | + cl_uint num_events_in_wait_list, |
| 114 | + const cl_event * event_wait_list, |
| 115 | + cl_event * event) CL_API_SUFFIX__VERSION_1_0; |
| 116 | + |
| 117 | +#ifdef __cplusplus |
| 118 | +} |
| 119 | +#endif |
| 120 | + |
| 121 | +#endif // __OPENCL_CL_D3D11_H |
| 122 | + |
0 commit comments