Kiwano Engine v1.3.x
D3D10DeviceResources.h
1// Copyright (c) 2016-2018 Kiwano - Nomango
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19// THE SOFTWARE.
20
21#pragma once
22#include <kiwano/macros.h>
23#include <kiwano/render/DirectX/helper.h>
24#include <kiwano/render/DirectX/D3DDeviceResourcesBase.h>
25#include <d3d10_1.h>
26
27namespace kiwano
28{
29namespace graphics
30{
31namespace directx
32{
33
34MIDL_INTERFACE("3a150b9d-cc23-4022-a463-7e95452a54c4")
35KGE_API ID3D10DeviceResources : public ID3DDeviceResourcesBase
36{
37public:
38 inline ID3D10Device* GetDevice()
39 {
40 KGE_ASSERT(device_);
41 return device_.Get();
42 }
43
44 inline ID3D10RenderTargetView* GetRenderTargetView()
45 {
46 KGE_ASSERT(rt_view_);
47 return rt_view_.Get();
48 }
49
50 inline ID3D10DepthStencilView* GetDepthStencilView()
51 {
52 KGE_ASSERT(ds_view_);
53 return ds_view_.Get();
54 }
55
56 inline IDXGIFactory* GetDXGIFactory()
57 {
58 KGE_ASSERT(dxgi_factory_);
59 return dxgi_factory_.Get();
60 }
61
62 inline IDXGIDevice* GetDXGIDevice()
63 {
64 KGE_ASSERT(dxgi_device_);
65 return dxgi_device_.Get();
66 }
67
68 inline IDXGISwapChain* GetDXGISwapChain()
69 {
70 KGE_ASSERT(dxgi_swap_chain_);
71 return dxgi_swap_chain_.Get();
72 }
73
74protected:
75 ComPtr<ID3D10Device> device_;
76 ComPtr<ID3D10RenderTargetView> rt_view_;
77 ComPtr<ID3D10DepthStencilView> ds_view_;
78 ComPtr<IDXGIFactory> dxgi_factory_;
79 ComPtr<IDXGIDevice> dxgi_device_;
80 ComPtr<IDXGISwapChain> dxgi_swap_chain_;
81};
82
83extern ComPtr<ID3D10DeviceResources> GetD3D11DeviceResources();
84
85} // namespace directx
86} // namespace graphics
87} // namespace kiwano