| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 CC_OUTPUT_OUTPUT_SURFACE_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 public: | 37 public: |
| 38 struct Capabilities { | 38 struct Capabilities { |
| 39 Capabilities() = default; | 39 Capabilities() = default; |
| 40 | 40 |
| 41 int max_frames_pending = 1; | 41 int max_frames_pending = 1; |
| 42 // Whether this output surface renders to the default OpenGL zero | 42 // Whether this output surface renders to the default OpenGL zero |
| 43 // framebuffer or to an offscreen framebuffer. | 43 // framebuffer or to an offscreen framebuffer. |
| 44 bool uses_default_gl_framebuffer = true; | 44 bool uses_default_gl_framebuffer = true; |
| 45 // Whether this OutputSurface is flipped or not. | 45 // Whether this OutputSurface is flipped or not. |
| 46 bool flipped_output_surface = false; | 46 bool flipped_output_surface = false; |
| 47 // Whether this OutputSurface supports stencil operations or not. |
| 48 // Note: HasExternalStencilTest() must return false when an output surface |
| 49 // has been configured for stencil usage. |
| 50 bool supports_stencil = false; |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 // Constructor for GL-based compositing. | 53 // Constructor for GL-based compositing. |
| 50 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider); | 54 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider); |
| 51 // Constructor for software compositing. | 55 // Constructor for software compositing. |
| 52 explicit OutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device); | 56 explicit OutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device); |
| 53 // Constructor for Vulkan-based compositing. | 57 // Constructor for Vulkan-based compositing. |
| 54 explicit OutputSurface( | 58 explicit OutputSurface( |
| 55 scoped_refptr<VulkanContextProvider> vulkan_context_provider); | 59 scoped_refptr<VulkanContextProvider> vulkan_context_provider); |
| 56 | 60 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 87 | 91 |
| 88 // Get the texture for the main image's overlay. | 92 // Get the texture for the main image's overlay. |
| 89 virtual unsigned GetOverlayTextureId() const = 0; | 93 virtual unsigned GetOverlayTextureId() const = 0; |
| 90 | 94 |
| 91 // If this returns true, then the surface will not attempt to draw. | 95 // If this returns true, then the surface will not attempt to draw. |
| 92 virtual bool SurfaceIsSuspendForRecycle() const = 0; | 96 virtual bool SurfaceIsSuspendForRecycle() const = 0; |
| 93 | 97 |
| 94 virtual void Reshape(const gfx::Size& size, | 98 virtual void Reshape(const gfx::Size& size, |
| 95 float device_scale_factor, | 99 float device_scale_factor, |
| 96 const gfx::ColorSpace& color_space, | 100 const gfx::ColorSpace& color_space, |
| 97 bool has_alpha) = 0; | 101 bool has_alpha, |
| 102 bool use_stencil) = 0; |
| 98 | 103 |
| 99 virtual bool HasExternalStencilTest() const = 0; | 104 virtual bool HasExternalStencilTest() const = 0; |
| 100 virtual void ApplyExternalStencil() = 0; | 105 virtual void ApplyExternalStencil() = 0; |
| 101 | 106 |
| 102 // Gives the GL internal format that should be used for calling CopyTexImage2D | 107 // Gives the GL internal format that should be used for calling CopyTexImage2D |
| 103 // when the framebuffer is bound via BindFramebuffer(). | 108 // when the framebuffer is bound via BindFramebuffer(). |
| 104 virtual uint32_t GetFramebufferCopyTextureFormat() = 0; | 109 virtual uint32_t GetFramebufferCopyTextureFormat() = 0; |
| 105 | 110 |
| 106 // Swaps the current backbuffer to the screen. For successful swaps, the | 111 // Swaps the current backbuffer to the screen. For successful swaps, the |
| 107 // implementation must call OutputSurfaceClient::DidReceiveSwapBuffersAck() | 112 // implementation must call OutputSurfaceClient::DidReceiveSwapBuffersAck() |
| 108 // after returning from this method in order to unblock the next frame. | 113 // after returning from this method in order to unblock the next frame. |
| 109 virtual void SwapBuffers(OutputSurfaceFrame frame) = 0; | 114 virtual void SwapBuffers(OutputSurfaceFrame frame) = 0; |
| 110 | 115 |
| 111 protected: | 116 protected: |
| 112 struct OutputSurface::Capabilities capabilities_; | 117 struct OutputSurface::Capabilities capabilities_; |
| 113 scoped_refptr<ContextProvider> context_provider_; | 118 scoped_refptr<ContextProvider> context_provider_; |
| 114 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; | 119 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; |
| 115 std::unique_ptr<SoftwareOutputDevice> software_device_; | 120 std::unique_ptr<SoftwareOutputDevice> software_device_; |
| 116 | 121 |
| 117 private: | 122 private: |
| 118 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 123 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 119 }; | 124 }; |
| 120 | 125 |
| 121 } // namespace cc | 126 } // namespace cc |
| 122 | 127 |
| 123 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 128 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |