1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef WIN8_METRO_DRIVER_DIRECT3D_HELPER_
6 #define WIN8_METRO_DRIVER_DIRECT3D_HELPER_
8 #include "base/basictypes.h"
10 #include <windows.ui.core.h>
11 #include <windows.foundation.h>
14 namespace metro_driver
{
16 // We need to initalize a Direct3D device and swapchain so that the browser
17 // can Present to our HWND. This class takes care of creating and keeping the
18 // swapchain up to date.
19 class Direct3DHelper
{
24 void Initialize(winui::Core::ICoreWindow
* window
);
27 void CreateDeviceResources();
28 void CreateWindowSizeDependentResources();
30 winui::Core::ICoreWindow
* window_
;
32 mswr::ComPtr
<ID3D11Device1
> d3d_device_
;
33 mswr::ComPtr
<ID3D11DeviceContext1
> d3d_context_
;
34 mswr::ComPtr
<IDXGISwapChain1
> swap_chain_
;
35 D3D_FEATURE_LEVEL feature_level_
;
37 ABI::Windows::Foundation::Rect window_bounds_
;
39 DISALLOW_COPY_AND_ASSIGN(Direct3DHelper
);
42 } // namespace metro_driver
44 #endif // WIN8_METRO_DRIVER_DIRECT3D_HELPER_