| Flutter Impeller |

runtime_effect_contents.h
Go to the documentation of this file.
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 #ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_RUNTIME_EFFECT_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_RUNTIME_EFFECT_CONTENTS_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "impeller/core/sampler_descriptor.h"
12 #include "impeller/entity/contents/color_source_contents.h"
13 #include "impeller/runtime_stage/runtime_stage.h"
14
15 namespace impeller {
16
17 class RuntimeEffectContents final : public ColorSourceContents {
18 public:
19 struct TextureInput {
20 SamplerDescriptor sampler_descriptor;
21 std::shared_ptr<Texture> texture;
22 };
23
24 void SetRuntimeStage(std::shared_ptr<RuntimeStage> runtime_stage);
25
26 void SetUniformData(std::shared_ptr<std::vector<uint8_t>> uniform_data);
27
28 void SetTextureInputs(std::vector<TextureInput> texture_inputs);
29
30 // | Contents|
31 bool CanInheritOpacity(const Entity& entity) const override;
32
33 // |Contents|
34 bool Render(const ContentContext& renderer,
35 const Entity& entity,
36 RenderPass& pass) const override;
37
38 /// Load the runtime effect and ensure a default PSO is initialized.
39 bool BootstrapShader(const ContentContext& renderer) const;
40
41 private:
42 bool RegisterShader(const ContentContext& renderer) const;
43
44 // If async is true, this will always return nullptr as pipeline creation
45 // is not blocked on.
46 std::shared_ptr<Pipeline<PipelineDescriptor>> CreatePipeline(
47 const ContentContext& renderer,
48 ContentContextOptions options,
49 bool async) const;
50
51 std::shared_ptr<RuntimeStage> runtime_stage_;
52 std::shared_ptr<std::vector<uint8_t>> uniform_data_;
53 std::vector<TextureInput> texture_inputs_;
54 };
55
56 } // namespace impeller
57
58 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_RUNTIME_EFFECT_CONTENTS_H_
impeller::RuntimeEffectContents::SetTextureInputs
void SetTextureInputs(std::vector< TextureInput > texture_inputs)
Definition: runtime_effect_contents.cc:37
impeller::RuntimeEffectContents::SetRuntimeStage
void SetRuntimeStage(std::shared_ptr< RuntimeStage > runtime_stage)
Definition: runtime_effect_contents.cc:27
impeller::RuntimeEffectContents::CanInheritOpacity
bool CanInheritOpacity(const Entity &entity) const override
Whether or not this contents can accept the opacity peephole optimization.
Definition: runtime_effect_contents.cc:42
impeller::RuntimeEffectContents::SetUniformData
void SetUniformData(std::shared_ptr< std::vector< uint8_t >> uniform_data)
Definition: runtime_effect_contents.cc:32
impeller::RuntimeEffectContents
Definition: runtime_effect_contents.h:17
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
impeller::Entity
Definition: entity.h:20
impeller::RuntimeEffectContents::TextureInput::sampler_descriptor
SamplerDescriptor sampler_descriptor
Definition: runtime_effect_contents.h:20
runtime_stage.h
color_source_contents.h
impeller::RuntimeEffectContents::TextureInput
Definition: runtime_effect_contents.h:19
impeller::RuntimeEffectContents::TextureInput::texture
std::shared_ptr< Texture > texture
Definition: runtime_effect_contents.h:21
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
sampler_descriptor.h
impeller::RuntimeEffectContents::BootstrapShader
bool BootstrapShader(const ContentContext &renderer) const
Load the runtime effect and ensure a default PSO is initialized.
Definition: runtime_effect_contents.cc:70
impeller::RuntimeEffectContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: runtime_effect_contents.cc:188
impeller::ColorSourceContents
Definition: color_source_contents.h:37
impeller::ContentContextOptions
Definition: content_context.h:254
impeller
Definition: aiks_blend_unittests.cc:18
impeller::ContentContext
Definition: content_context.h:366