| Flutter Impeller |

content_context.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
5 #include "impeller/entity/contents/content_context.h"
6
7 #include <memory>
8 #include <sstream>
9
10 #include "impeller/base/strings.h"
11 #include "impeller/core/formats.h"
12 #include "impeller/entity/entity.h"
13 #include "impeller/entity/render_target_cache.h"
14 #include "impeller/renderer/command_buffer.h"
15 #include "impeller/renderer/pipeline_library.h"
16 #include "impeller/renderer/render_pass.h"
17 #include "impeller/renderer/render_target.h"
18 #include "impeller/tessellator/tessellator.h"
19 #include "impeller/typographer/typographer_context.h"
20
21 namespace impeller {
22
23 void ContentContextOptions::ApplyToPipelineDescriptor(
24 PipelineDescriptor& desc) const {
25 auto pipeline_blend = blend_mode;
26 if (blend_mode > Entity::kLastPipelineBlendMode) {
27 VALIDATION_LOG << "Cannot use blend mode " << static_cast<int>(blend_mode)
28 << " as a pipeline blend.";
29 pipeline_blend = BlendMode::kSourceOver;
30 }
31
32 desc.SetSampleCount(sample_count);
33
34 ColorAttachmentDescriptor color0 = *desc.GetColorAttachmentDescriptor(0u);
35 color0.format = color_attachment_pixel_format;
36 color0.alpha_blend_op = BlendOperation::kAdd;
37 color0.color_blend_op = BlendOperation::kAdd;
38
39 switch (pipeline_blend) {
40 case BlendMode::kClear:
41 if (is_for_rrect_blur_clear) {
42 color0.alpha_blend_op = BlendOperation::kReverseSubtract;
43 color0.color_blend_op = BlendOperation::kReverseSubtract;
44 color0.dst_alpha_blend_factor = BlendFactor::kOne;
45 color0.dst_color_blend_factor = BlendFactor::kOne;
46 color0.src_alpha_blend_factor = BlendFactor::kDestinationColor;
47 color0.src_color_blend_factor = BlendFactor::kDestinationColor;
48 } else {
49 color0.dst_alpha_blend_factor = BlendFactor::kZero;
50 color0.dst_color_blend_factor = BlendFactor::kZero;
51 color0.src_alpha_blend_factor = BlendFactor::kZero;
52 color0.src_color_blend_factor = BlendFactor::kZero;
53 }
54 break;
55 case BlendMode::kSource:
56 color0.blending_enabled = false;
57 color0.dst_alpha_blend_factor = BlendFactor::kZero;
58 color0.dst_color_blend_factor = BlendFactor::kZero;
59 color0.src_alpha_blend_factor = BlendFactor::kOne;
60 color0.src_color_blend_factor = BlendFactor::kOne;
61 break;
62 case BlendMode::kDestination:
63 color0.dst_alpha_blend_factor = BlendFactor::kOne;
64 color0.dst_color_blend_factor = BlendFactor::kOne;
65 color0.src_alpha_blend_factor = BlendFactor::kZero;
66 color0.src_color_blend_factor = BlendFactor::kZero;
67 break;
68 case BlendMode::kSourceOver:
69 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
70 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
71 color0.src_alpha_blend_factor = BlendFactor::kOne;
72 color0.src_color_blend_factor = BlendFactor::kOne;
73 break;
74 case BlendMode::kDestinationOver:
75 color0.dst_alpha_blend_factor = BlendFactor::kOne;
76 color0.dst_color_blend_factor = BlendFactor::kOne;
77 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
78 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
79 break;
80 case BlendMode::kSourceIn:
81 color0.dst_alpha_blend_factor = BlendFactor::kZero;
82 color0.dst_color_blend_factor = BlendFactor::kZero;
83 color0.src_alpha_blend_factor = BlendFactor::kDestinationAlpha;
84 color0.src_color_blend_factor = BlendFactor::kDestinationAlpha;
85 break;
86 case BlendMode::kDestinationIn:
87 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
88 color0.dst_color_blend_factor = BlendFactor::kSourceAlpha;
89 color0.src_alpha_blend_factor = BlendFactor::kZero;
90 color0.src_color_blend_factor = BlendFactor::kZero;
91 break;
92 case BlendMode::kSourceOut:
93 color0.dst_alpha_blend_factor = BlendFactor::kZero;
94 color0.dst_color_blend_factor = BlendFactor::kZero;
95 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
96 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
97 break;
98 case BlendMode::kDestinationOut:
99 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
100 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
101 color0.src_alpha_blend_factor = BlendFactor::kZero;
102 color0.src_color_blend_factor = BlendFactor::kZero;
103 break;
104 case BlendMode::kSourceATop:
105 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
106 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
107 color0.src_alpha_blend_factor = BlendFactor::kDestinationAlpha;
108 color0.src_color_blend_factor = BlendFactor::kDestinationAlpha;
109 break;
110 case BlendMode::kDestinationATop:
111 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
112 color0.dst_color_blend_factor = BlendFactor::kSourceAlpha;
113 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
114 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
115 break;
116 case BlendMode::kXor:
117 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
118 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
119 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
120 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
121 break;
122 case BlendMode::kPlus:
123 color0.dst_alpha_blend_factor = BlendFactor::kOne;
124 color0.dst_color_blend_factor = BlendFactor::kOne;
125 color0.src_alpha_blend_factor = BlendFactor::kOne;
126 color0.src_color_blend_factor = BlendFactor::kOne;
127 break;
128 case BlendMode::kModulate:
129 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
130 color0.dst_color_blend_factor = BlendFactor::kSourceColor;
131 color0.src_alpha_blend_factor = BlendFactor::kZero;
132 color0.src_color_blend_factor = BlendFactor::kZero;
133 break;
134 default:
135 FML_UNREACHABLE();
136 }
137 desc.SetColorAttachmentDescriptor(0u, color0);
138
139 if (!has_stencil_attachment) {
140 desc.ClearStencilAttachments();
141 }
142
143 auto maybe_stencil = desc.GetFrontStencilAttachmentDescriptor();
144 if (maybe_stencil.has_value()) {
145 StencilAttachmentDescriptor stencil = maybe_stencil.value();
146 stencil.stencil_compare = stencil_compare;
147 stencil.depth_stencil_pass = stencil_operation;
148 desc.SetStencilAttachmentDescriptors(stencil);
149 }
150
151 desc.SetPrimitiveType(primitive_type);
152
153 desc.SetPolygonMode(wireframe ? PolygonMode::kLine : PolygonMode::kFill);
154 }
155
156 template <typename PipelineT>
157 static std::unique_ptr<PipelineT> CreateDefaultPipeline(
158 const Context& context) {
159 auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
160 if (!desc.has_value()) {
161 return nullptr;
162 }
163 // Apply default ContentContextOptions to the descriptor.
164 const auto default_color_format =
165 context.GetCapabilities()->GetDefaultColorFormat();
166 ContentContextOptions{.sample_count = SampleCount::kCount4,
167 .color_attachment_pixel_format = default_color_format}
168 .ApplyToPipelineDescriptor(*desc);
169 return std::make_unique<PipelineT>(context, desc);
170 }
171
172 ContentContext::ContentContext(
173 std::shared_ptr<Context> context,
174 std::shared_ptr<TypographerContext> typographer_context,
175 std::shared_ptr<RenderTargetAllocator> render_target_allocator)
176 : context_(std::move(context)),
177 lazy_glyph_atlas_(
178 std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
179 tessellator_(std::make_shared<Tessellator>()),
180 #if IMPELLER_ENABLE_3D
181 scene_context_(std::make_shared<scene::SceneContext>(context_)),
182 #endif // IMPELLER_ENABLE_3D
183 render_target_cache_(render_target_allocator == nullptr
184 ? std::make_shared<RenderTargetCache>(
185 context_->GetResourceAllocator())
186 : std::move(render_target_allocator)) {
187 if (!context_ || !context_->IsValid()) {
188 return;
189 }
190 default_options_ = ContentContextOptions{
191 .sample_count = SampleCount::kCount4,
192 .color_attachment_pixel_format =
193 context_->GetCapabilities()->GetDefaultColorFormat()};
194
195 #ifdef IMPELLER_DEBUG
196 checkerboard_pipelines_[default_options_] =
197 CreateDefaultPipeline<CheckerboardPipeline>(*context_);
198 #endif // IMPELLER_DEBUG
199
200 solid_fill_pipelines_[default_options_] =
201 CreateDefaultPipeline<SolidFillPipeline>(*context_);
202
203 if (context_->GetCapabilities()->SupportsSSBO()) {
204 linear_gradient_ssbo_fill_pipelines_[default_options_] =
205 CreateDefaultPipeline<LinearGradientSSBOFillPipeline>(*context_);
206 radial_gradient_ssbo_fill_pipelines_[default_options_] =
207 CreateDefaultPipeline<RadialGradientSSBOFillPipeline>(*context_);
208 conical_gradient_ssbo_fill_pipelines_[default_options_] =
209 CreateDefaultPipeline<ConicalGradientSSBOFillPipeline>(*context_);
210 sweep_gradient_ssbo_fill_pipelines_[default_options_] =
211 CreateDefaultPipeline<SweepGradientSSBOFillPipeline>(*context_);
212 } else {
213 linear_gradient_fill_pipelines_[default_options_] =
214 CreateDefaultPipeline<LinearGradientFillPipeline>(*context_);
215 radial_gradient_fill_pipelines_[default_options_] =
216 CreateDefaultPipeline<RadialGradientFillPipeline>(*context_);
217 conical_gradient_fill_pipelines_[default_options_] =
218 CreateDefaultPipeline<ConicalGradientFillPipeline>(*context_);
219 sweep_gradient_fill_pipelines_[default_options_] =
220 CreateDefaultPipeline<SweepGradientFillPipeline>(*context_);
221 }
222
223 if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
224 framebuffer_blend_color_pipelines_[default_options_] =
225 CreateDefaultPipeline<FramebufferBlendColorPipeline>(*context_);
226 framebuffer_blend_colorburn_pipelines_[default_options_] =
227 CreateDefaultPipeline<FramebufferBlendColorBurnPipeline>(*context_);
228 framebuffer_blend_colordodge_pipelines_[default_options_] =
229 CreateDefaultPipeline<FramebufferBlendColorDodgePipeline>(*context_);
230 framebuffer_blend_darken_pipelines_[default_options_] =
231 CreateDefaultPipeline<FramebufferBlendDarkenPipeline>(*context_);
232 framebuffer_blend_difference_pipelines_[default_options_] =
233 CreateDefaultPipeline<FramebufferBlendDifferencePipeline>(*context_);
234 framebuffer_blend_exclusion_pipelines_[default_options_] =
235 CreateDefaultPipeline<FramebufferBlendExclusionPipeline>(*context_);
236 framebuffer_blend_hardlight_pipelines_[default_options_] =
237 CreateDefaultPipeline<FramebufferBlendHardLightPipeline>(*context_);
238 framebuffer_blend_hue_pipelines_[default_options_] =
239 CreateDefaultPipeline<FramebufferBlendHuePipeline>(*context_);
240 framebuffer_blend_lighten_pipelines_[default_options_] =
241 CreateDefaultPipeline<FramebufferBlendLightenPipeline>(*context_);
242 framebuffer_blend_luminosity_pipelines_[default_options_] =
243 CreateDefaultPipeline<FramebufferBlendLuminosityPipeline>(*context_);
244 framebuffer_blend_multiply_pipelines_[default_options_] =
245 CreateDefaultPipeline<FramebufferBlendMultiplyPipeline>(*context_);
246 framebuffer_blend_overlay_pipelines_[default_options_] =
247 CreateDefaultPipeline<FramebufferBlendOverlayPipeline>(*context_);
248 framebuffer_blend_saturation_pipelines_[default_options_] =
249 CreateDefaultPipeline<FramebufferBlendSaturationPipeline>(*context_);
250 framebuffer_blend_screen_pipelines_[default_options_] =
251 CreateDefaultPipeline<FramebufferBlendScreenPipeline>(*context_);
252 framebuffer_blend_softlight_pipelines_[default_options_] =
253 CreateDefaultPipeline<FramebufferBlendSoftLightPipeline>(*context_);
254 }
255
256 blend_color_pipelines_[default_options_] =
257 CreateDefaultPipeline<BlendColorPipeline>(*context_);
258 blend_colorburn_pipelines_[default_options_] =
259 CreateDefaultPipeline<BlendColorBurnPipeline>(*context_);
260 blend_colordodge_pipelines_[default_options_] =
261 CreateDefaultPipeline<BlendColorDodgePipeline>(*context_);
262 blend_darken_pipelines_[default_options_] =
263 CreateDefaultPipeline<BlendDarkenPipeline>(*context_);
264 blend_difference_pipelines_[default_options_] =
265 CreateDefaultPipeline<BlendDifferencePipeline>(*context_);
266 blend_exclusion_pipelines_[default_options_] =
267 CreateDefaultPipeline<BlendExclusionPipeline>(*context_);
268 blend_hardlight_pipelines_[default_options_] =
269 CreateDefaultPipeline<BlendHardLightPipeline>(*context_);
270 blend_hue_pipelines_[default_options_] =
271 CreateDefaultPipeline<BlendHuePipeline>(*context_);
272 blend_lighten_pipelines_[default_options_] =
273 CreateDefaultPipeline<BlendLightenPipeline>(*context_);
274 blend_luminosity_pipelines_[default_options_] =
275 CreateDefaultPipeline<BlendLuminosityPipeline>(*context_);
276 blend_multiply_pipelines_[default_options_] =
277 CreateDefaultPipeline<BlendMultiplyPipeline>(*context_);
278 blend_overlay_pipelines_[default_options_] =
279 CreateDefaultPipeline<BlendOverlayPipeline>(*context_);
280 blend_saturation_pipelines_[default_options_] =
281 CreateDefaultPipeline<BlendSaturationPipeline>(*context_);
282 blend_screen_pipelines_[default_options_] =
283 CreateDefaultPipeline<BlendScreenPipeline>(*context_);
284 blend_softlight_pipelines_[default_options_] =
285 CreateDefaultPipeline<BlendSoftLightPipeline>(*context_);
286
287 rrect_blur_pipelines_[default_options_] =
288 CreateDefaultPipeline<RRectBlurPipeline>(*context_);
289 texture_blend_pipelines_[default_options_] =
290 CreateDefaultPipeline<BlendPipeline>(*context_);
291 texture_pipelines_[default_options_] =
292 CreateDefaultPipeline<TexturePipeline>(*context_);
293 position_uv_pipelines_[default_options_] =
294 CreateDefaultPipeline<PositionUVPipeline>(*context_);
295 tiled_texture_pipelines_[default_options_] =
296 CreateDefaultPipeline<TiledTexturePipeline>(*context_);
297 gaussian_blur_noalpha_decal_pipelines_[default_options_] =
298 CreateDefaultPipeline<GaussianBlurDecalPipeline>(*context_);
299 gaussian_blur_noalpha_nodecal_pipelines_[default_options_] =
300 CreateDefaultPipeline<GaussianBlurPipeline>(*context_);
301 border_mask_blur_pipelines_[default_options_] =
302 CreateDefaultPipeline<BorderMaskBlurPipeline>(*context_);
303 morphology_filter_pipelines_[default_options_] =
304 CreateDefaultPipeline<MorphologyFilterPipeline>(*context_);
305 color_matrix_color_filter_pipelines_[default_options_] =
306 CreateDefaultPipeline<ColorMatrixColorFilterPipeline>(*context_);
307 linear_to_srgb_filter_pipelines_[default_options_] =
308 CreateDefaultPipeline<LinearToSrgbFilterPipeline>(*context_);
309 srgb_to_linear_filter_pipelines_[default_options_] =
310 CreateDefaultPipeline<SrgbToLinearFilterPipeline>(*context_);
311 glyph_atlas_pipelines_[default_options_] =
312 CreateDefaultPipeline<GlyphAtlasPipeline>(*context_);
313 glyph_atlas_color_pipelines_[default_options_] =
314 CreateDefaultPipeline<GlyphAtlasColorPipeline>(*context_);
315 geometry_color_pipelines_[default_options_] =
316 CreateDefaultPipeline<GeometryColorPipeline>(*context_);
317 yuv_to_rgb_filter_pipelines_[default_options_] =
318 CreateDefaultPipeline<YUVToRGBFilterPipeline>(*context_);
319 porter_duff_blend_pipelines_[default_options_] =
320 CreateDefaultPipeline<PorterDuffBlendPipeline>(*context_);
321 // GLES only shader.
322 #ifdef IMPELLER_ENABLE_OPENGLES
323 if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
324 texture_external_pipelines_[default_options_] =
325 CreateDefaultPipeline<TextureExternalPipeline>(*context_);
326 }
327 #endif // IMPELLER_ENABLE_OPENGLES
328 if (context_->GetCapabilities()->SupportsCompute()) {
329 auto pipeline_desc =
330 PointsComputeShaderPipeline::MakeDefaultPipelineDescriptor(*context_);
331 point_field_compute_pipelines_ =
332 context_->GetPipelineLibrary()->GetPipeline(pipeline_desc).Get();
333
334 auto uv_pipeline_desc =
335 UvComputeShaderPipeline::MakeDefaultPipelineDescriptor(*context_);
336 uv_compute_pipelines_ =
337 context_->GetPipelineLibrary()->GetPipeline(uv_pipeline_desc).Get();
338 }
339
340 /// Setup default clip pipeline.
341
342 auto clip_pipeline_descriptor =
343 ClipPipeline::Builder::MakeDefaultPipelineDescriptor(*context_);
344 if (!clip_pipeline_descriptor.has_value()) {
345 return;
346 }
347 ContentContextOptions{
348 .sample_count = SampleCount::kCount4,
349 .color_attachment_pixel_format =
350 context_->GetCapabilities()->GetDefaultColorFormat()}
351 .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
352 // Disable write to all color attachments.
353 auto clip_color_attachments =
354 clip_pipeline_descriptor->GetColorAttachmentDescriptors();
355 for (auto& color_attachment : clip_color_attachments) {
356 color_attachment.second.write_mask =
357 static_cast<uint64_t>(ColorWriteMask::kNone);
358 }
359 clip_pipeline_descriptor->SetColorAttachmentDescriptors(
360 std::move(clip_color_attachments));
361 clip_pipelines_[default_options_] =
362 std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor);
363
364 is_valid_ = true;
365 }
366
367 ContentContext::~ContentContext() = default;
368
369 bool ContentContext::IsValid() const {
370 return is_valid_;
371 }
372
373 std::shared_ptr<Texture> ContentContext::MakeSubpass(
374 const std::string& label,
375 ISize texture_size,
376 const SubpassCallback& subpass_callback,
377 bool msaa_enabled) const {
378 auto context = GetContext();
379
380 RenderTarget subpass_target;
381 if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
382 subpass_target = RenderTarget::CreateOffscreenMSAA(
383 *context, *GetRenderTargetCache(), texture_size,
384 SPrintF("%s Offscreen", label.c_str()),
385 RenderTarget::kDefaultColorAttachmentConfigMSAA //
386 #ifndef FML_OS_ANDROID // Reduce PSO variants for Vulkan.
387 ,
388 std::nullopt // stencil_attachment_config
389 #endif // FML_OS_ANDROID
390 );
391 } else {
392 subpass_target = RenderTarget::CreateOffscreen(
393 *context, *GetRenderTargetCache(), texture_size,
394 SPrintF("%s Offscreen", label.c_str()),
395 RenderTarget::kDefaultColorAttachmentConfig //
396 #ifndef FML_OS_ANDROID // Reduce PSO variants for Vulkan.
397 ,
398 std::nullopt // stencil_attachment_config
399 #endif // FML_OS_ANDROID
400 );
401 }
402 auto subpass_texture = subpass_target.GetRenderTargetTexture();
403 if (!subpass_texture) {
404 return nullptr;
405 }
406
407 auto sub_command_buffer = context->CreateCommandBuffer();
408 sub_command_buffer->SetLabel(SPrintF("%s CommandBuffer", label.c_str()));
409 if (!sub_command_buffer) {
410 return nullptr;
411 }
412
413 auto sub_renderpass = sub_command_buffer->CreateRenderPass(subpass_target);
414 if (!sub_renderpass) {
415 return nullptr;
416 }
417 sub_renderpass->SetLabel(SPrintF("%s RenderPass", label.c_str()));
418
419 if (!subpass_callback(*this, *sub_renderpass)) {
420 return nullptr;
421 }
422
423 if (!sub_command_buffer->SubmitCommandsAsync(std::move(sub_renderpass))) {
424 return nullptr;
425 }
426
427 return subpass_texture;
428 }
429
430 #if IMPELLER_ENABLE_3D
431 std::shared_ptr<scene::SceneContext> ContentContext::GetSceneContext() const {
432 return scene_context_;
433 }
434 #endif // IMPELLER_ENABLE_3D
435
436 std::shared_ptr<Tessellator> ContentContext::GetTessellator() const {
437 return tessellator_;
438 }
439
440 std::shared_ptr<Context> ContentContext::GetContext() const {
441 return context_;
442 }
443
444 const Capabilities& ContentContext::GetDeviceCapabilities() const {
445 return *context_->GetCapabilities();
446 }
447
448 void ContentContext::SetWireframe(bool wireframe) {
449 wireframe_ = wireframe;
450 }
451
452 } // namespace impeller
impeller::PipelineDescriptor
Definition: pipeline_descriptor.h:30
impeller::ColorAttachmentDescriptor::src_color_blend_factor
BlendFactor src_color_blend_factor
Definition: formats.h:455
impeller::PipelineDescriptor::SetPolygonMode
void SetPolygonMode(PolygonMode mode)
Definition: pipeline_descriptor.cc:272
impeller::Entity::kLastPipelineBlendMode
static constexpr BlendMode kLastPipelineBlendMode
Definition: entity.h:23
impeller::RenderTarget::kDefaultColorAttachmentConfig
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
Definition: render_target.h:65
impeller::StencilAttachmentDescriptor::stencil_compare
CompareFunction stencil_compare
Definition: formats.h:550
impeller::ContentContext::ContentContext
ContentContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
Definition: content_context.cc:172
impeller::PipelineDescriptor::SetStencilAttachmentDescriptors
PipelineDescriptor & SetStencilAttachmentDescriptors(std::optional< StencilAttachmentDescriptor > front_and_back)
Definition: pipeline_descriptor.cc:153
entity.h
impeller::PipelineDescriptor::SetColorAttachmentDescriptor
PipelineDescriptor & SetColorAttachmentDescriptor(size_t index, ColorAttachmentDescriptor desc)
Definition: pipeline_descriptor.cc:106
impeller::Tessellator
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
Definition: tessellator.h:35
impeller::BlendFactor::kOneMinusSourceAlpha
@ kOneMinusSourceAlpha
impeller::Context::GetCapabilities
virtual const std::shared_ptr< const Capabilities > & GetCapabilities() const =0
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
impeller::PipelineDescriptor::GetColorAttachmentDescriptor
const ColorAttachmentDescriptor * GetColorAttachmentDescriptor(size_t index) const
Definition: pipeline_descriptor.cc:120
impeller::PipelineDescriptor::SetPrimitiveType
void SetPrimitiveType(PrimitiveType type)
Definition: pipeline_descriptor.cc:264
impeller::RenderTarget::kDefaultColorAttachmentConfigMSAA
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
Definition: render_target.h:71
formats.h
impeller::BlendMode::kSourceIn
@ kSourceIn
impeller::ColorAttachmentDescriptor::alpha_blend_op
BlendOperation alpha_blend_op
Definition: formats.h:460
impeller::ContentContextOptions::blend_mode
BlendMode blend_mode
Definition: content_context.h:304
typographer_context.h
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::ContentContextOptions::ApplyToPipelineDescriptor
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
Definition: content_context.cc:23
impeller::BlendMode::kDestinationIn
@ kDestinationIn
impeller::SampleCount::kCount4
@ kCount4
impeller::PolygonMode::kFill
@ kFill
impeller::ContentContextOptions::wireframe
bool wireframe
Definition: content_context.h:310
impeller::BlendFactor::kSourceColor
@ kSourceColor
impeller::BlendMode::kXor
@ kXor
tessellator.h
impeller::BlendFactor::kDestinationColor
@ kDestinationColor
impeller::ContentContextOptions::stencil_compare
CompareFunction stencil_compare
Definition: content_context.h:305
impeller::BlendFactor::kZero
@ kZero
impeller::Capabilities
Definition: capabilities.h:14
impeller::TSize< int64_t >
impeller::ContentContext::MakeSubpass
std::shared_ptr< Texture > MakeSubpass(const std::string &label, ISize texture_size, const SubpassCallback &subpass_callback, bool msaa_enabled=true) const
Creates a new texture of size texture_size and calls subpass_callback with a RenderPass for drawing t...
Definition: content_context.cc:373
impeller::ComputePipelineBuilder::MakeDefaultPipelineDescriptor
static std::optional< ComputePipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context)
Create a default pipeline descriptor using the combination reflected shader information....
Definition: compute_pipeline_builder.h:43
impeller::ContentContextOptions::color_attachment_pixel_format
PixelFormat color_attachment_pixel_format
Definition: content_context.h:308
impeller::ContentContext::~ContentContext
~ContentContext()
render_pass.h
impeller::RenderTarget::GetRenderTargetTexture
std::shared_ptr< Texture > GetRenderTargetTexture() const
Definition: render_target.cc:155
impeller::BlendMode::kSourceOver
@ kSourceOver
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract
impeller::Context::BackendType::kOpenGLES
@ kOpenGLES
impeller::BlendMode::kPlus
@ kPlus
impeller::SPrintF
std::string SPrintF(const char *format,...)
Definition: strings.cc:12
impeller::BlendMode::kDestination
@ kDestination
impeller::ContentContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: content_context.cc:440
impeller::BlendOperation::kAdd
@ kAdd
impeller::ColorWriteMask::kNone
@ kNone
impeller::ContentContext::GetRenderTargetCache
std::shared_ptr< RenderTargetAllocator > GetRenderTargetCache() const
Definition: content_context.h:716
impeller::BlendMode::kDestinationATop
@ kDestinationATop
impeller::ColorAttachmentDescriptor::format
PixelFormat format
Definition: formats.h:452
impeller::StencilAttachmentDescriptor::depth_stencil_pass
StencilOperation depth_stencil_pass
Definition: formats.h:563
impeller::RenderTarget
Definition: render_target.h:48
impeller::ContentContextOptions::has_stencil_attachment
bool has_stencil_attachment
Definition: content_context.h:309
impeller::BlendFactor::kOne
@ kOne
impeller::ContentContextOptions::is_for_rrect_blur_clear
bool is_for_rrect_blur_clear
Definition: content_context.h:311
strings.h
impeller::BlendMode::kDestinationOut
@ kDestinationOut
impeller::ContentContext::GetTessellator
std::shared_ptr< Tessellator > GetTessellator() const
Definition: content_context.cc:436
impeller::ContentContextOptions::primitive_type
PrimitiveType primitive_type
Definition: content_context.h:307
pipeline_library.h
impeller::ContentContext::SubpassCallback
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
Definition: content_context.h:703
impeller::PipelineDescriptor::SetSampleCount
PipelineDescriptor & SetSampleCount(SampleCount samples)
Definition: pipeline_descriptor.cc:72
impeller::ColorAttachmentDescriptor::src_alpha_blend_factor
BlendFactor src_alpha_blend_factor
Definition: formats.h:459
impeller::RenderTarget::CreateOffscreen
static RenderTarget CreateOffscreen(const Context &context, RenderTargetAllocator &allocator, ISize size, const std::string &label="Offscreen", AttachmentConfig color_attachment_config=kDefaultColorAttachmentConfig, std::optional< AttachmentConfig > stencil_attachment_config=kDefaultStencilAttachmentConfig)
Definition: render_target.cc:223
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:60
command_buffer.h
impeller::ColorAttachmentDescriptor::dst_color_blend_factor
BlendFactor dst_color_blend_factor
Definition: formats.h:457
content_context.h
impeller::PipelineDescriptor::GetFrontStencilAttachmentDescriptor
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
Definition: pipeline_descriptor.cc:198
impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor
BlendFactor dst_alpha_blend_factor
Definition: formats.h:461
impeller::ContentContext::GetDeviceCapabilities
const Capabilities & GetDeviceCapabilities() const
Definition: content_context.cc:444
impeller::PipelineBuilder::MakeDefaultPipelineDescriptor
static std::optional< PipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context)
Create a default pipeline descriptor using the combination reflected shader information....
Definition: pipeline_builder.h:50
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:47
std
Definition: comparable.h:98
impeller::BlendMode::kDestinationOver
@ kDestinationOver
impeller::ContentContextOptions::sample_count
SampleCount sample_count
Definition: content_context.h:303
impeller::RenderTargetCache
An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame...
Definition: render_target_cache.h:15
impeller::StencilAttachmentDescriptor
Definition: formats.h:544
impeller::BlendMode::kClear
@ kClear
impeller::ContentContext::SetWireframe
void SetWireframe(bool wireframe)
Definition: content_context.cc:448
impeller::PolygonMode::kLine
@ kLine
impeller::ColorAttachmentDescriptor::color_blend_op
BlendOperation color_blend_op
Definition: formats.h:456
impeller::BlendMode::kSourceATop
@ kSourceATop
render_target.h
impeller::BlendMode::kModulate
@ kModulate
render_target_cache.h
impeller::BlendFactor::kSourceAlpha
@ kSourceAlpha
impeller::ContentContextOptions
Definition: content_context.h:302
impeller::LazyGlyphAtlas
Definition: lazy_glyph_atlas.h:17
impeller::PipelineDescriptor::ClearStencilAttachments
void ClearStencilAttachments()
Definition: pipeline_descriptor.cc:166
impeller
Definition: aiks_context.cc:10
impeller::ContentContext::IsValid
bool IsValid() const
Definition: content_context.cc:369
impeller::ColorAttachmentDescriptor::blending_enabled
bool blending_enabled
Definition: formats.h:453
impeller::BlendMode::kSourceOut
@ kSourceOut
impeller::RenderTarget::CreateOffscreenMSAA
static RenderTarget CreateOffscreenMSAA(const Context &context, RenderTargetAllocator &allocator, ISize size, const std::string &label="Offscreen MSAA", AttachmentConfigMSAA color_attachment_config=kDefaultColorAttachmentConfigMSAA, std::optional< AttachmentConfig > stencil_attachment_config=kDefaultStencilAttachmentConfig)
Definition: render_target.cc:270
impeller::BlendMode::kSource
@ kSource
impeller::CreateDefaultPipeline
static std::unique_ptr< PipelineT > CreateDefaultPipeline(const Context &context)
Definition: content_context.cc:157
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::ContentContextOptions::stencil_operation
StencilOperation stencil_operation
Definition: content_context.h:306
impeller::ColorAttachmentDescriptor
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:451