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