1848b8605Smrg/********************************************************************************** 2b8e80941Smrg * Copyright (c) 2008-2015 The Khronos Group Inc. 3848b8605Smrg * 4848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5848b8605Smrg * copy of this software and/or associated documentation files (the 6848b8605Smrg * "Materials"), to deal in the Materials without restriction, including 7848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 8848b8605Smrg * distribute, sublicense, and/or sell copies of the Materials, and to 9848b8605Smrg * permit persons to whom the Materials are furnished to do so, subject to 10848b8605Smrg * the following conditions: 11848b8605Smrg * 12848b8605Smrg * The above copyright notice and this permission notice shall be included 13848b8605Smrg * in all copies or substantial portions of the Materials. 14848b8605Smrg * 15b8e80941Smrg * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS 16b8e80941Smrg * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS 17b8e80941Smrg * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT 18b8e80941Smrg * https://www.khronos.org/registry/ 19b8e80941Smrg * 20848b8605Smrg * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21848b8605Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23848b8605Smrg * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24848b8605Smrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26848b8605Smrg * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 27848b8605Smrg **********************************************************************************/ 28848b8605Smrg 29b8e80941Smrg/* $Revision: 1.1.1.2 $ on $Date: 2021/07/11 20:36:21 $ */ 30848b8605Smrg 31848b8605Smrg#ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H 32848b8605Smrg#define __OPENCL_CL_DX9_MEDIA_SHARING_H 33848b8605Smrg 34848b8605Smrg#include <CL/cl.h> 35848b8605Smrg#include <CL/cl_platform.h> 36848b8605Smrg 37848b8605Smrg#ifdef __cplusplus 38848b8605Smrgextern "C" { 39848b8605Smrg#endif 40848b8605Smrg 41b8e80941Smrg/******************************************************************************/ 42848b8605Smrg/* cl_khr_dx9_media_sharing */ 43848b8605Smrg#define cl_khr_dx9_media_sharing 1 44848b8605Smrg 45848b8605Smrgtypedef cl_uint cl_dx9_media_adapter_type_khr; 46848b8605Smrgtypedef cl_uint cl_dx9_media_adapter_set_khr; 47848b8605Smrg 48848b8605Smrg#if defined(_WIN32) 49848b8605Smrg#include <d3d9.h> 50848b8605Smrgtypedef struct _cl_dx9_surface_info_khr 51848b8605Smrg{ 52848b8605Smrg IDirect3DSurface9 *resource; 53848b8605Smrg HANDLE shared_handle; 54848b8605Smrg} cl_dx9_surface_info_khr; 55848b8605Smrg#endif 56848b8605Smrg 57848b8605Smrg 58848b8605Smrg/******************************************************************************/ 59848b8605Smrg 60848b8605Smrg/* Error Codes */ 61848b8605Smrg#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010 62848b8605Smrg#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011 63848b8605Smrg#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012 64848b8605Smrg#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013 65848b8605Smrg 66848b8605Smrg/* cl_media_adapter_type_khr */ 67848b8605Smrg#define CL_ADAPTER_D3D9_KHR 0x2020 68848b8605Smrg#define CL_ADAPTER_D3D9EX_KHR 0x2021 69848b8605Smrg#define CL_ADAPTER_DXVA_KHR 0x2022 70848b8605Smrg 71848b8605Smrg/* cl_media_adapter_set_khr */ 72848b8605Smrg#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023 73848b8605Smrg#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024 74848b8605Smrg 75848b8605Smrg/* cl_context_info */ 76848b8605Smrg#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025 77848b8605Smrg#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026 78848b8605Smrg#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027 79848b8605Smrg 80848b8605Smrg/* cl_mem_info */ 81848b8605Smrg#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028 82848b8605Smrg#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029 83848b8605Smrg 84848b8605Smrg/* cl_image_info */ 85848b8605Smrg#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A 86848b8605Smrg 87848b8605Smrg/* cl_command_type */ 88848b8605Smrg#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B 89848b8605Smrg#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C 90848b8605Smrg 91848b8605Smrg/******************************************************************************/ 92848b8605Smrg 93848b8605Smrgtypedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)( 94848b8605Smrg cl_platform_id platform, 95848b8605Smrg cl_uint num_media_adapters, 96848b8605Smrg cl_dx9_media_adapter_type_khr * media_adapter_type, 97848b8605Smrg void * media_adapters, 98848b8605Smrg cl_dx9_media_adapter_set_khr media_adapter_set, 99848b8605Smrg cl_uint num_entries, 100848b8605Smrg cl_device_id * devices, 101848b8605Smrg cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2; 102848b8605Smrg 103848b8605Smrgtypedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)( 104848b8605Smrg cl_context context, 105848b8605Smrg cl_mem_flags flags, 106848b8605Smrg cl_dx9_media_adapter_type_khr adapter_type, 107848b8605Smrg void * surface_info, 108848b8605Smrg cl_uint plane, 109848b8605Smrg cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; 110848b8605Smrg 111848b8605Smrgtypedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)( 112848b8605Smrg cl_command_queue command_queue, 113848b8605Smrg cl_uint num_objects, 114848b8605Smrg const cl_mem * mem_objects, 115848b8605Smrg cl_uint num_events_in_wait_list, 116848b8605Smrg const cl_event * event_wait_list, 117848b8605Smrg cl_event * event) CL_API_SUFFIX__VERSION_1_2; 118848b8605Smrg 119848b8605Smrgtypedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)( 120848b8605Smrg cl_command_queue command_queue, 121848b8605Smrg cl_uint num_objects, 122848b8605Smrg const cl_mem * mem_objects, 123848b8605Smrg cl_uint num_events_in_wait_list, 124848b8605Smrg const cl_event * event_wait_list, 125848b8605Smrg cl_event * event) CL_API_SUFFIX__VERSION_1_2; 126848b8605Smrg 127848b8605Smrg#ifdef __cplusplus 128848b8605Smrg} 129848b8605Smrg#endif 130848b8605Smrg 131848b8605Smrg#endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */ 132848b8605Smrg 133