| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ | 5 #ifndef GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ |
| 6 #define GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ | 6 #define GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ |
| 7 | 7 |
| 8 #include <d3d11.h> | 8 #include <d3d11.h> |
| 9 #include <dcomp.h> | 9 #include <dcomp.h> |
| 10 #include <windows.h> | 10 #include <windows.h> |
| 11 | 11 |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/win/scoped_comptr.h" | 13 #include "base/win/scoped_comptr.h" |
| 14 #include "gpu/config/gpu_driver_bug_workarounds.h" |
| 14 #include "gpu/gpu_export.h" | 15 #include "gpu/gpu_export.h" |
| 15 #include "gpu/ipc/service/child_window_win.h" | 16 #include "gpu/ipc/service/child_window_win.h" |
| 16 #include "gpu/ipc/service/image_transport_surface_delegate.h" | 17 #include "gpu/ipc/service/image_transport_surface_delegate.h" |
| 17 #include "ui/gl/gl_image.h" | 18 #include "ui/gl/gl_image.h" |
| 18 #include "ui/gl/gl_surface_egl.h" | 19 #include "ui/gl/gl_surface_egl.h" |
| 19 | 20 |
| 20 namespace gpu { | 21 namespace gpu { |
| 21 | 22 |
| 22 class DCLayerTree; | 23 class DCLayerTree; |
| 23 | 24 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 68 } |
| 68 | 69 |
| 69 scoped_refptr<base::TaskRunner> GetWindowTaskRunnerForTesting(); | 70 scoped_refptr<base::TaskRunner> GetWindowTaskRunnerForTesting(); |
| 70 const base::win::ScopedComPtr<IDXGISwapChain1>& swap_chain() const { | 71 const base::win::ScopedComPtr<IDXGISwapChain1>& swap_chain() const { |
| 71 return swap_chain_; | 72 return swap_chain_; |
| 72 } | 73 } |
| 73 | 74 |
| 74 base::win::ScopedComPtr<IDXGISwapChain1> GetLayerSwapChainForTesting( | 75 base::win::ScopedComPtr<IDXGISwapChain1> GetLayerSwapChainForTesting( |
| 75 size_t index) const; | 76 size_t index) const; |
| 76 | 77 |
| 78 const GpuDriverBugWorkarounds& workarounds() const { return workarounds_; } |
| 79 |
| 77 protected: | 80 protected: |
| 78 ~DirectCompositionSurfaceWin() override; | 81 ~DirectCompositionSurfaceWin() override; |
| 79 | 82 |
| 80 private: | 83 private: |
| 81 void ReleaseCurrentSurface(); | 84 void ReleaseCurrentSurface(); |
| 82 void InitializeSurface(); | 85 void InitializeSurface(); |
| 83 // Release the texture that's currently being drawn to. If will_discard is | 86 // Release the texture that's currently being drawn to. If will_discard is |
| 84 // true then the surface should be discarded without swapping any contents | 87 // true then the surface should be discarded without swapping any contents |
| 85 // to it. | 88 // to it. |
| 86 void ReleaseDrawTexture(bool will_discard); | 89 void ReleaseDrawTexture(bool will_discard); |
| 87 | 90 |
| 88 ChildWindowWin child_window_; | 91 ChildWindowWin child_window_; |
| 89 | 92 |
| 93 GpuDriverBugWorkarounds workarounds_; |
| 94 |
| 90 HWND window_ = nullptr; | 95 HWND window_ = nullptr; |
| 91 // This is a placeholder surface used when not rendering to the | 96 // This is a placeholder surface used when not rendering to the |
| 92 // DirectComposition surface. | 97 // DirectComposition surface. |
| 93 EGLSurface default_surface_ = 0; | 98 EGLSurface default_surface_ = 0; |
| 94 | 99 |
| 95 // This is the real surface representing the backbuffer. It may be null | 100 // This is the real surface representing the backbuffer. It may be null |
| 96 // outside of a BeginDraw/EndDraw pair. | 101 // outside of a BeginDraw/EndDraw pair. |
| 97 EGLSurface real_surface_ = 0; | 102 EGLSurface real_surface_ = 0; |
| 98 gfx::Size size_ = gfx::Size(1, 1); | 103 gfx::Size size_ = gfx::Size(1, 1); |
| 99 bool first_swap_ = true; | 104 bool first_swap_ = true; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 113 // Keep track of whether the texture has been rendered to, as the first draw | 118 // Keep track of whether the texture has been rendered to, as the first draw |
| 114 // to it must overwrite the entire thing. | 119 // to it must overwrite the entire thing. |
| 115 bool has_been_rendered_to_ = false; | 120 bool has_been_rendered_to_ = false; |
| 116 | 121 |
| 117 DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin); | 122 DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin); |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 } // namespace gpu | 125 } // namespace gpu |
| 121 | 126 |
| 122 #endif // GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ | 127 #endif // GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_ |
| OLD | NEW |