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 "impeller/entity/entity_pass_target.h"
8#include "impeller/renderer/context.h"
9#include "impeller/renderer/render_pass.h"
10#include "impeller/renderer/render_target.h"
11
12namespace impeller {
13
14class InlinePassContext {
15 public:
16 struct RenderPassResult {
17 std::shared_ptr<RenderPass> pass;
18 std::shared_ptr<Texture> backdrop_texture;
19 };
20
21 InlinePassContext(
22 std::shared_ptr<Context> context,
23 EntityPassTarget& pass_target,
24 uint32_t pass_texture_reads,
25 std::optional<RenderPassResult> collapsed_parent_pass = std::nullopt);
26 ~InlinePassContext();
27
28 bool IsValid() const;
29 bool IsActive() const;
30 std::shared_ptr<Texture> GetTexture();
31 bool EndPass();
32 EntityPassTarget& GetPassTarget() const;
33 uint32_t GetPassCount() const;
34
35 RenderPassResult GetRenderPass(uint32_t pass_depth);
36
37 private:
38 std::shared_ptr<Context> context_;
39 EntityPassTarget& pass_target_;
40 std::shared_ptr<CommandBuffer> command_buffer_;
41 std::shared_ptr<RenderPass> pass_;
42 uint32_t pass_count_ = 0;
43 uint32_t total_pass_reads_ = 0;
44 // Whether this context is collapsed into a parent entity pass.
45 bool is_collapsed_ = false;
46
47 FML_DISALLOW_COPY_AND_ASSIGN(InlinePassContext);
48};
49
50} // namespace impeller
51

source code of flutter_engine/flutter/impeller/entity/inline_pass_context.h