Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
recording_render_pass.cc
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
6
7#include <utility>
8
9namespace impeller {
10
12 std::shared_ptr<RenderPass> delegate,
13 const std::shared_ptr<const Context>& context,
14 const RenderTarget& render_target)
15 : RenderPass(context, render_target), delegate_(std::move(delegate)) {}
16
17// |RenderPass|
19 const std::shared_ptr<Pipeline<PipelineDescriptor>>& pipeline) {
20 pending_.pipeline = pipeline;
21 if (delegate_) {
22 delegate_->SetPipeline(pipeline);
23 }
24}
25
26void RecordingRenderPass::SetCommandLabel(std::string_view label) {
27#ifdef IMPELLER_DEBUG
28 pending_.label = std::string(label);
29#endif // IMPELLER_DEBUG
30 if (delegate_) {
31 delegate_->SetCommandLabel(label);
32 }
33}
34
35// |RenderPass|
37 pending_.stencil_reference = value;
38 if (delegate_) {
39 delegate_->SetStencilReference(value);
40 }
41}
42
43// |RenderPass|
45 pending_.base_vertex = value;
46 if (delegate_) {
47 delegate_->SetBaseVertex(value);
48 }
49}
50
51// |RenderPass|
53 pending_.viewport = viewport;
54 if (delegate_) {
55 delegate_->SetViewport(viewport);
56 }
57}
58
59// |RenderPass|
61 pending_.scissor = scissor;
62 if (delegate_) {
63 delegate_->SetScissor(scissor);
64 }
65}
66
67// |RenderPass|
69 pending_.instance_count = count;
70 if (delegate_) {
71 delegate_->SetInstanceCount(count);
72 }
73}
74
75// |RenderPass|
77 pending_.vertex_buffer = buffer;
78 if (delegate_) {
79 return delegate_->SetVertexBuffer(buffer);
80 }
81 return true;
82}
83
84// |RenderPass|
86 commands_.emplace_back(std::move(pending_));
87 pending_ = {};
88 if (delegate_) {
89 return delegate_->Draw();
90 }
91 return fml::Status();
92}
93
94// |RenderPass|
95void RecordingRenderPass::OnSetLabel(std::string label) {
96 return;
97}
98
99// |RenderPass|
101 if (delegate_) {
102 return delegate_->EncodeCommands();
103 }
104 return true;
105}
106
107// |RenderPass|
110 const ShaderUniformSlot& slot,
111 const ShaderMetadata& metadata,
112 BufferView view) {
113 pending_.BindResource(stage, type, slot, metadata, view);
114 if (delegate_) {
115 return delegate_->BindResource(stage, type, slot, metadata, view);
116 }
117 return true;
118}
119
120// |RenderPass|
122 ShaderStage stage,
124 const ShaderUniformSlot& slot,
125 const std::shared_ptr<const ShaderMetadata>& metadata,
126 BufferView view) {
127 pending_.BindResource(stage, type, slot, metadata, view);
128 if (delegate_) {
129 return delegate_->BindResource(stage, type, slot, metadata, view);
130 }
131 return true;
132}
133
134// |RenderPass|
136 ShaderStage stage,
138 const SampledImageSlot& slot,
139 const ShaderMetadata& metadata,
140 std::shared_ptr<const Texture> texture,
141 const std::unique_ptr<const Sampler>& sampler) {
142 pending_.BindResource(stage, type, slot, metadata, texture, sampler);
143 if (delegate_) {
144 return delegate_->BindResource(stage, type, slot, metadata, texture,
145 sampler);
146 }
147 return true;
148}
149
150} // namespace impeller
int count
To do anything rendering related with Impeller, you need a context.
Definition context.h:46
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
Definition pipeline.h:49
void SetStencilReference(uint32_t value) override
RecordingRenderPass(std::shared_ptr< RenderPass > delegate, const std::shared_ptr< const Context > &context, const RenderTarget &render_target)
void SetCommandLabel(std::string_view label) override
The debugging label to use for the command.
bool SetVertexBuffer(VertexBuffer buffer) override
Specify the vertex and index buffer to use for this command.
fml::Status Draw() override
Record the currently pending command.
void SetBaseVertex(uint64_t value) override
bool OnEncodeCommands(const Context &context) const override
void SetInstanceCount(size_t count) override
void SetViewport(Viewport viewport) override
void OnSetLabel(std::string label) override
bool BindResource(ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata &metadata, BufferView view) override
void SetPipeline(const std::shared_ptr< Pipeline< PipelineDescriptor > > &pipeline) override
The pipeline to use for this command.
void SetScissor(IRect scissor) override
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:33
MockDelegate delegate_
static const uint8_t buffer[]
uint8_t value
FlTexture * texture
Definition ref_ptr.h:256
std::shared_ptr< Pipeline< PipelineDescriptor > > pipeline
Definition command.h:96
uint64_t base_vertex
Definition command.h:126
uint32_t stencil_reference
Definition command.h:122
std::optional< Viewport > viewport
Definition command.h:133
VertexBuffer vertex_buffer
The bound per-vertex data and optional index buffer.
Definition command.h:151
std::optional< IRect > scissor
Definition command.h:139
bool BindResource(ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata &metadata, BufferView view) override
Definition command.cc:25
size_t instance_count
Definition command.h:147
Metadata required to bind a combined texture and sampler.
Metadata required to bind a buffer.