| 1 | /* Copyright (C) 2010-2020 The RetroArch team |
| 2 | * |
| 3 | * --------------------------------------------------------------------------------------------- |
| 4 | * The following license statement only applies to this libretro API header (libretro_d3d.h) |
| 5 | * --------------------------------------------------------------------------------------------- |
| 6 | * |
| 7 | * Permission is hereby granted, free of charge, |
| 8 | * to any person obtaining a copy of this software and associated documentation files (the |
| 9 | * "Software"), |
| 10 | * to deal in the Software without restriction, including without limitation the rights to |
| 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, |
| 12 | * and to permit persons to whom the Software is furnished to do so, subject to the following |
| 13 | * conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be included in all copies or |
| 16 | * substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
| 19 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 21 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | * LIABILITY, |
| 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | */ |
| 26 | |
| 27 | #ifndef LIBRETRO_DIRECT3D_H__ |
| 28 | #define LIBRETRO_DIRECT3D_H__ |
| 29 | |
| 30 | #include "libretro.h" |
| 31 | |
| 32 | #ifdef HAVE_D3D11 |
| 33 | |
| 34 | #include <d3d11.h> |
| 35 | #include <d3dcompiler.h> |
| 36 | |
| 37 | #define RETRO_HW_RENDER_INTERFACE_D3D11_VERSION 1 |
| 38 | |
| 39 | struct retro_hw_render_interface_d3d11 |
| 40 | { |
| 41 | /* Must be set to RETRO_HW_RENDER_INTERFACE_D3D11. */ |
| 42 | enum retro_hw_render_interface_type interface_type; |
| 43 | /* Must be set to RETRO_HW_RENDER_INTERFACE_D3D11_VERSION. */ |
| 44 | unsigned interface_version; |
| 45 | |
| 46 | /* Opaque handle to the d3d11 backend in the frontend |
| 47 | * which must be passed along to all function pointers |
| 48 | * in this interface. |
| 49 | */ |
| 50 | void* handle; |
| 51 | ID3D11Device *device; |
| 52 | ID3D11DeviceContext *context; |
| 53 | D3D_FEATURE_LEVEL featureLevel; |
| 54 | pD3DCompile D3DCompile; |
| 55 | }; |
| 56 | |
| 57 | #endif |
| 58 | |
| 59 | #ifdef HAVE_D3D12 |
| 60 | |
| 61 | #include <d3d12.h> |
| 62 | #include <d3dcompiler.h> |
| 63 | |
| 64 | #define RETRO_HW_RENDER_INTERFACE_D3D12_VERSION 1 |
| 65 | |
| 66 | struct retro_hw_render_interface_d3d12 |
| 67 | { |
| 68 | /* Must be set to RETRO_HW_RENDER_INTERFACE_D3D12. */ |
| 69 | enum retro_hw_render_interface_type interface_type; |
| 70 | /* Must be set to RETRO_HW_RENDER_INTERFACE_D3D12_VERSION. */ |
| 71 | unsigned interface_version; |
| 72 | |
| 73 | /* Opaque handle to the d3d12 backend in the frontend |
| 74 | * which must be passed along to all function pointers |
| 75 | * in this interface. |
| 76 | */ |
| 77 | void* handle; |
| 78 | ID3D12Device *device; |
| 79 | ID3D12CommandQueue *queue; |
| 80 | pD3DCompile D3DCompile; |
| 81 | D3D12_RESOURCE_STATES required_state; |
| 82 | void (*set_texture)(void* handle, ID3D12Resource* texture, DXGI_FORMAT format); |
| 83 | }; |
| 84 | |
| 85 | #endif |
| 86 | |
| 87 | #endif /* LIBRETRO_DIRECT3D_H__ */ |