OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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. |
| 4 |
| 5 // Helper functions that Direct3D 9Ex code a little easier to work with for |
| 6 // the ui/surface code. |
| 7 |
| 8 #ifndef UI_SURFACE_D3D9_UTILS_WIN_H_ |
| 9 #define UI_SURFACE_D3D9_UTILS_WIN_H_ |
| 10 |
| 11 #include <d3d9.h> |
| 12 |
| 13 #include "base/basictypes.h" |
| 14 |
| 15 namespace base { |
| 16 class ScopedNativeLibrary; |
| 17 } |
| 18 |
| 19 namespace gfx { |
| 20 class Size; |
| 21 } |
| 22 |
| 23 namespace ui_surface_d3d9_utils { |
| 24 |
| 25 // Visible for testing. Loads the Direct3D9 library. Returns true on success. |
| 26 bool LoadD3D9(base::ScopedNativeLibrary* storage); |
| 27 |
| 28 // Visible for testing. Creates a Direct3D9 device suitable for use with the |
| 29 // accelerated surface code. Returns true on success. |
| 30 bool CreateDevice(const base::ScopedNativeLibrary& d3d_module, |
| 31 D3DDEVTYPE device_type, |
| 32 uint32 presentation_interval, |
| 33 IDirect3DDevice9Ex** device); |
| 34 |
| 35 // Calls the Vista+ (WDDM1.0) variant of CreateTexture that semantically |
| 36 // opens a texture allocated (possibly in another process) as shared. The |
| 37 // shared texture is identified by its surface handle. The resulting texture |
| 38 // is written into |opened_texture|. |
| 39 // |
| 40 // Returns true on success. |
| 41 bool OpenSharedTexture(IDirect3DDevice9* device, |
| 42 int64 surface_handle, |
| 43 const gfx::Size& size, |
| 44 IDirect3DTexture9** opened_texture); |
| 45 |
| 46 // Create a one-off lockable surface of a specified size. |
| 47 // |
| 48 // Returns true on success. |
| 49 bool CreateTemporaryLockableSurface(IDirect3DDevice9* device, |
| 50 const gfx::Size& size, |
| 51 IDirect3DSurface9** surface); |
| 52 |
| 53 // Create a one-off renderable texture of a specified size. The texture object |
| 54 // as well as the surface object for the texture's level 0 is returned (callers |
| 55 // almost always need to use both). |
| 56 // |
| 57 // Returns true on success. |
| 58 bool CreateTemporaryRenderTargetTexture(IDirect3DDevice9* device, |
| 59 const gfx::Size& size, |
| 60 IDirect3DTexture9** texture, |
| 61 IDirect3DSurface9** render_target); |
| 62 |
| 63 } // namespace ui_surface_d3d9_utils |
| 64 |
| 65 #endif // UI_SURFACE_D3D9_UTILS_WIN_H_ |
OLD | NEW |