| 1 | // Copyright 2013 The Flutter 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 | #pragma once |
| 6 | |
| 7 | #include "fml/macros.h" |
| 8 | #include "impeller/renderer/render_target.h" |
| 9 | |
| 10 | namespace impeller { |
| 11 | |
| 12 | class InlinePassContext; |
| 13 | |
| 14 | class EntityPassTarget { |
| 15 | public: |
| 16 | explicit EntityPassTarget(const RenderTarget& render_target, |
| 17 | bool supports_read_from_resolve); |
| 18 | |
| 19 | /// @brief Flips the backdrop and returns a readable texture that can be |
| 20 | /// bound/sampled to restore the previous pass. |
| 21 | /// |
| 22 | /// After this method is called, a new `RenderPass` that attaches the |
| 23 | /// result of `GetRenderTarget` is guaranteed to be able to read the |
| 24 | /// previous pass's backdrop texture (which is returned by this |
| 25 | /// method). |
| 26 | std::shared_ptr<Texture> Flip(Allocator& allocator); |
| 27 | |
| 28 | const RenderTarget& GetRenderTarget() const; |
| 29 | |
| 30 | bool IsValid() const; |
| 31 | |
| 32 | private: |
| 33 | RenderTarget target_; |
| 34 | std::shared_ptr<Texture> secondary_color_texture_; |
| 35 | |
| 36 | bool supports_read_from_resolve_; |
| 37 | |
| 38 | friend InlinePassContext; |
| 39 | |
| 40 | FML_DISALLOW_ASSIGN(EntityPassTarget); |
| 41 | }; |
| 42 | |
| 43 | } // namespace impeller |
| 44 | |