Home | History | Annotate | Download | only in CL
      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_D3D11_H
     27 #define __OPENCL_CL_D3D11_H
     28 
     29 #include <d3d11.h>
     30 #include <CL/cl.h>
     31 #include <CL/cl_platform.h>
     32 
     33 #ifdef __cplusplus
     34 extern "C" {
     35 #endif
     36 
     37 /******************************************************************************
     38  * cl_khr_d3d11_sharing                                                       */
     39 #define cl_khr_d3d11_sharing 1
     40 
     41 typedef cl_uint cl_d3d11_device_source_khr;
     42 typedef cl_uint cl_d3d11_device_set_khr;
     43 
     44 /******************************************************************************/
     45 
     46 // Error Codes
     47 #define CL_INVALID_D3D11_DEVICE_KHR                  -1006
     48 #define CL_INVALID_D3D11_RESOURCE_KHR                -1007
     49 #define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR       -1008
     50 #define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR           -1009
     51 
     52 // cl_d3d11_device_source
     53 #define CL_D3D11_DEVICE_KHR                          0x4019
     54 #define CL_D3D11_DXGI_ADAPTER_KHR                    0x401A
     55 
     56 // cl_d3d11_device_set
     57 #define CL_PREFERRED_DEVICES_FOR_D3D11_KHR           0x401B
     58 #define CL_ALL_DEVICES_FOR_D3D11_KHR                 0x401C
     59 
     60 // cl_context_info
     61 #define CL_CONTEXT_D3D11_DEVICE_KHR                  0x401D
     62 #define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
     63 
     64 // cl_mem_info
     65 #define CL_MEM_D3D11_RESOURCE_KHR                    0x401E
     66 
     67 // cl_image_info
     68 #define CL_IMAGE_D3D11_SUBRESOURCE_KHR               0x401F
     69 
     70 // cl_command_type
     71 #define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR         0x4020
     72 #define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR         0x4021
     73 
     74 /******************************************************************************/
     75 
     76 typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
     77     cl_platform_id             platform,
     78     cl_d3d11_device_source_khr d3d_device_source,
     79     void *                     d3d_object,
     80     cl_d3d11_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_2;
     84 
     85 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
     86     cl_context     context,
     87     cl_mem_flags   flags,
     88     ID3D11Buffer * resource,
     89     cl_int *       errcode_ret) CL_API_SUFFIX__VERSION_1_2;
     90 
     91 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
     92     cl_context        context,
     93     cl_mem_flags      flags,
     94     ID3D11Texture2D * resource,
     95     UINT              subresource,
     96     cl_int *          errcode_ret) CL_API_SUFFIX__VERSION_1_2;
     97 
     98 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
     99     cl_context        context,
    100     cl_mem_flags      flags,
    101     ID3D11Texture3D * resource,
    102     UINT              subresource,
    103     cl_int *          errcode_ret) CL_API_SUFFIX__VERSION_1_2;
    104 
    105 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_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 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_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_2;
    120 
    121 #ifdef __cplusplus
    122 }
    123 #endif
    124 
    125 #endif  // __OPENCL_CL_D3D11_H
    126 
    127