Flutter Impeller
render_pass_gles.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 <cstdint>
8 
9 #include "GLES3/gl3.h"
10 #include "flutter/fml/trace_event.h"
11 #include "fml/closure.h"
12 #include "fml/logging.h"
20 
21 namespace impeller {
22 
23 RenderPassGLES::RenderPassGLES(std::weak_ptr<const Context> context,
24  const RenderTarget& target,
25  ReactorGLES::Ref reactor)
26  : RenderPass(std::move(context), target),
27  reactor_(std::move(reactor)),
28  is_valid_(reactor_ && reactor_->IsValid()) {}
29 
30 // |RenderPass|
32 
33 // |RenderPass|
34 bool RenderPassGLES::IsValid() const {
35  return is_valid_;
36 }
37 
38 // |RenderPass|
39 void RenderPassGLES::OnSetLabel(std::string label) {
40  label_ = std::move(label);
41 }
42 
44  const ColorAttachmentDescriptor* color) {
45  if (color->blending_enabled) {
46  gl.Enable(GL_BLEND);
47  gl.BlendFuncSeparate(
48  ToBlendFactor(color->src_color_blend_factor), // src color
49  ToBlendFactor(color->dst_color_blend_factor), // dst color
50  ToBlendFactor(color->src_alpha_blend_factor), // src alpha
51  ToBlendFactor(color->dst_alpha_blend_factor) // dst alpha
52  );
53  gl.BlendEquationSeparate(
54  ToBlendOperation(color->color_blend_op), // mode color
55  ToBlendOperation(color->alpha_blend_op) // mode alpha
56  );
57  } else {
58  gl.Disable(GL_BLEND);
59  }
60 
61  {
62  const auto is_set = [](std::underlying_type_t<ColorWriteMask> mask,
63  ColorWriteMask check) -> GLboolean {
64  using RawType = decltype(mask);
65  return (static_cast<RawType>(mask) & static_cast<RawType>(check))
66  ? GL_TRUE
67  : GL_FALSE;
68  };
69 
70  gl.ColorMask(is_set(color->write_mask, ColorWriteMask::kRed), // red
71  is_set(color->write_mask, ColorWriteMask::kGreen), // green
72  is_set(color->write_mask, ColorWriteMask::kBlue), // blue
73  is_set(color->write_mask, ColorWriteMask::kAlpha) // alpha
74  );
75  }
76 }
77 
78 void ConfigureStencil(GLenum face,
79  const ProcTableGLES& gl,
80  const StencilAttachmentDescriptor& stencil,
81  uint32_t stencil_reference) {
82  gl.StencilOpSeparate(
83  face, // face
84  ToStencilOp(stencil.stencil_failure), // stencil fail
85  ToStencilOp(stencil.depth_failure), // depth fail
86  ToStencilOp(stencil.depth_stencil_pass) // depth stencil pass
87  );
88  gl.StencilFuncSeparate(face, // face
89  ToCompareFunction(stencil.stencil_compare), // func
90  stencil_reference, // ref
91  stencil.read_mask // mask
92  );
93  gl.StencilMaskSeparate(face, stencil.write_mask);
94 }
95 
97  const PipelineDescriptor& pipeline,
98  uint32_t stencil_reference) {
99  if (!pipeline.HasStencilAttachmentDescriptors()) {
100  gl.Disable(GL_STENCIL_TEST);
101  return;
102  }
103 
104  gl.Enable(GL_STENCIL_TEST);
105  const auto& front = pipeline.GetFrontStencilAttachmentDescriptor();
106  const auto& back = pipeline.GetBackStencilAttachmentDescriptor();
107 
108  if (front.has_value() && back.has_value() && front == back) {
109  ConfigureStencil(GL_FRONT_AND_BACK, gl, *front, stencil_reference);
110  return;
111  }
112  if (front.has_value()) {
113  ConfigureStencil(GL_FRONT, gl, *front, stencil_reference);
114  }
115  if (back.has_value()) {
116  ConfigureStencil(GL_BACK, gl, *back, stencil_reference);
117  }
118 }
119 
120 //------------------------------------------------------------------------------
121 /// @brief Encapsulates data that will be needed in the reactor for the
122 /// encoding of commands for this render pass.
123 ///
126 
128  uint32_t clear_stencil = 0u;
130 
131  std::shared_ptr<Texture> color_attachment;
132  std::shared_ptr<Texture> depth_attachment;
133  std::shared_ptr<Texture> stencil_attachment;
134 
138 
142 
143  std::string label;
144 };
145 
146 [[nodiscard]] bool EncodeCommandsInReactor(
147  const RenderPassData& pass_data,
148  const std::shared_ptr<Allocator>& transients_allocator,
149  const ReactorGLES& reactor,
150  const std::vector<Command>& commands,
151  const std::shared_ptr<GPUTracerGLES>& tracer) {
152  TRACE_EVENT0("impeller", "RenderPassGLES::EncodeCommandsInReactor");
153 
154  if (commands.empty()) {
155  return true;
156  }
157 
158  const auto& gl = reactor.GetProcTable();
159 #ifdef IMPELLER_DEBUG
160  tracer->MarkFrameStart(gl);
161 #endif // IMPELLER_DEBUG
162 
163  fml::ScopedCleanupClosure pop_pass_debug_marker(
164  [&gl]() { gl.PopDebugGroup(); });
165  if (!pass_data.label.empty()) {
166  gl.PushDebugGroup(pass_data.label);
167  } else {
168  pop_pass_debug_marker.Release();
169  }
170 
171  GLuint fbo = GL_NONE;
172  fml::ScopedCleanupClosure delete_fbo([&gl, &fbo]() {
173  if (fbo != GL_NONE) {
174  gl.BindFramebuffer(GL_FRAMEBUFFER, GL_NONE);
175  gl.DeleteFramebuffers(1u, &fbo);
176  }
177  });
178 
179  const auto is_default_fbo =
181 
182  if (!is_default_fbo) {
183  // Create and bind an offscreen FBO.
184  gl.GenFramebuffers(1u, &fbo);
185  gl.BindFramebuffer(GL_FRAMEBUFFER, fbo);
186 
187  if (auto color = TextureGLES::Cast(pass_data.color_attachment.get())) {
188  if (!color->SetAsFramebufferAttachment(
189  GL_FRAMEBUFFER, TextureGLES::AttachmentPoint::kColor0)) {
190  return false;
191  }
192  }
193 
194  if (auto depth = TextureGLES::Cast(pass_data.depth_attachment.get())) {
195  if (!depth->SetAsFramebufferAttachment(
196  GL_FRAMEBUFFER, TextureGLES::AttachmentPoint::kDepth)) {
197  return false;
198  }
199  }
200  if (auto stencil = TextureGLES::Cast(pass_data.stencil_attachment.get())) {
201  if (!stencil->SetAsFramebufferAttachment(
202  GL_FRAMEBUFFER, TextureGLES::AttachmentPoint::kStencil)) {
203  return false;
204  }
205  }
206 
207  auto status = gl.CheckFramebufferStatus(GL_FRAMEBUFFER);
208  if (status != GL_FRAMEBUFFER_COMPLETE) {
209  VALIDATION_LOG << "Could not create a complete frambuffer: "
210  << DebugToFramebufferError(status);
211  return false;
212  }
213  }
214 
215  gl.ClearColor(pass_data.clear_color.red, // red
216  pass_data.clear_color.green, // green
217  pass_data.clear_color.blue, // blue
218  pass_data.clear_color.alpha // alpha
219  );
220  if (pass_data.depth_attachment) {
221  // TODO(bdero): Desktop GL for Apple requires glClearDepth. glClearDepthf
222  // throws GL_INVALID_OPERATION.
223  // https://github.com/flutter/flutter/issues/136322
224 #if !FML_OS_MACOSX
225  gl.ClearDepthf(pass_data.clear_depth);
226 #endif
227  }
228  if (pass_data.stencil_attachment) {
229  gl.ClearStencil(pass_data.clear_stencil);
230  }
231 
232  GLenum clear_bits = 0u;
233  if (pass_data.clear_color_attachment) {
234  clear_bits |= GL_COLOR_BUFFER_BIT;
235  }
236  if (pass_data.clear_depth_attachment) {
237  clear_bits |= GL_DEPTH_BUFFER_BIT;
238  }
239  if (pass_data.clear_stencil_attachment) {
240  clear_bits |= GL_STENCIL_BUFFER_BIT;
241  }
242 
243  gl.Disable(GL_SCISSOR_TEST);
244  gl.Disable(GL_DEPTH_TEST);
245  gl.Disable(GL_STENCIL_TEST);
246  gl.Disable(GL_CULL_FACE);
247  gl.Disable(GL_BLEND);
248  gl.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
249 
250  gl.Clear(clear_bits);
251 
252  for (const auto& command : commands) {
253  if (command.instance_count != 1u) {
254  VALIDATION_LOG << "GLES backend does not support instanced rendering.";
255  return false;
256  }
257 
258  if (!command.pipeline) {
259  VALIDATION_LOG << "Command has no pipeline specified.";
260  return false;
261  }
262 
263 #ifdef IMPELLER_DEBUG
264  fml::ScopedCleanupClosure pop_cmd_debug_marker(
265  [&gl]() { gl.PopDebugGroup(); });
266  if (!command.label.empty()) {
267  gl.PushDebugGroup(command.label);
268  } else {
269  pop_cmd_debug_marker.Release();
270  }
271 #endif // IMPELLER_DEBUG
272 
273  const auto& pipeline = PipelineGLES::Cast(*command.pipeline);
274 
275  const auto* color_attachment =
276  pipeline.GetDescriptor().GetLegacyCompatibleColorAttachment();
277  if (!color_attachment) {
279  << "Color attachment is too complicated for a legacy renderer.";
280  return false;
281  }
282 
283  //--------------------------------------------------------------------------
284  /// Configure blending.
285  ///
286  ConfigureBlending(gl, color_attachment);
287 
288  //--------------------------------------------------------------------------
289  /// Setup stencil.
290  ///
291  ConfigureStencil(gl, pipeline.GetDescriptor(), command.stencil_reference);
292 
293  //--------------------------------------------------------------------------
294  /// Configure depth.
295  ///
296  if (auto depth =
297  pipeline.GetDescriptor().GetDepthStencilAttachmentDescriptor();
298  depth.has_value()) {
299  gl.Enable(GL_DEPTH_TEST);
300  gl.DepthFunc(ToCompareFunction(depth->depth_compare));
301  gl.DepthMask(depth->depth_write_enabled ? GL_TRUE : GL_FALSE);
302  } else {
303  gl.Disable(GL_DEPTH_TEST);
304  }
305 
306  // Both the viewport and scissor are specified in framebuffer coordinates.
307  // Impeller's framebuffer coordinate system is top left origin, but OpenGL's
308  // is bottom left origin, so we convert the coordinates here.
309  auto target_size = pass_data.color_attachment->GetSize();
310 
311  //--------------------------------------------------------------------------
312  /// Setup the viewport.
313  ///
314  const auto& viewport = command.viewport.value_or(pass_data.viewport);
315  gl.Viewport(viewport.rect.GetX(), // x
316  target_size.height - viewport.rect.GetY() -
317  viewport.rect.GetHeight(), // y
318  viewport.rect.GetWidth(), // width
319  viewport.rect.GetHeight() // height
320  );
321  if (pass_data.depth_attachment) {
322  // TODO(bdero): Desktop GL for Apple requires glDepthRange. glDepthRangef
323  // throws GL_INVALID_OPERATION.
324  // https://github.com/flutter/flutter/issues/136322
325 #if !FML_OS_MACOSX
326  gl.DepthRangef(viewport.depth_range.z_near, viewport.depth_range.z_far);
327 #endif
328  }
329 
330  //--------------------------------------------------------------------------
331  /// Setup the scissor rect.
332  ///
333  if (command.scissor.has_value()) {
334  const auto& scissor = command.scissor.value();
335  gl.Enable(GL_SCISSOR_TEST);
336  gl.Scissor(
337  scissor.GetX(), // x
338  target_size.height - scissor.GetY() - scissor.GetHeight(), // y
339  scissor.GetWidth(), // width
340  scissor.GetHeight() // height
341  );
342  } else {
343  gl.Disable(GL_SCISSOR_TEST);
344  }
345 
346  //--------------------------------------------------------------------------
347  /// Setup culling.
348  ///
349  switch (pipeline.GetDescriptor().GetCullMode()) {
350  case CullMode::kNone:
351  gl.Disable(GL_CULL_FACE);
352  break;
354  gl.Enable(GL_CULL_FACE);
355  gl.CullFace(GL_FRONT);
356  break;
357  case CullMode::kBackFace:
358  gl.Enable(GL_CULL_FACE);
359  gl.CullFace(GL_BACK);
360  break;
361  }
362  //--------------------------------------------------------------------------
363  /// Setup winding order.
364  ///
365  switch (pipeline.GetDescriptor().GetWindingOrder()) {
367  gl.FrontFace(GL_CW);
368  break;
370  gl.FrontFace(GL_CCW);
371  break;
372  }
373 
374  if (command.vertex_buffer.index_type == IndexType::kUnknown) {
375  return false;
376  }
377 
378  auto vertex_desc_gles = pipeline.GetBufferBindings();
379 
380  //--------------------------------------------------------------------------
381  /// Bind vertex and index buffers.
382  ///
383  auto& vertex_buffer_view = command.vertex_buffer.vertex_buffer;
384 
385  if (!vertex_buffer_view) {
386  return false;
387  }
388 
389  auto vertex_buffer =
390  vertex_buffer_view.buffer->GetDeviceBuffer(*transients_allocator);
391 
392  if (!vertex_buffer) {
393  return false;
394  }
395 
396  const auto& vertex_buffer_gles = DeviceBufferGLES::Cast(*vertex_buffer);
397  if (!vertex_buffer_gles.BindAndUploadDataIfNecessary(
399  return false;
400  }
401 
402  //--------------------------------------------------------------------------
403  /// Bind the pipeline program.
404  ///
405  if (!pipeline.BindProgram()) {
406  return false;
407  }
408 
409  //--------------------------------------------------------------------------
410  /// Bind vertex attribs.
411  ///
412  if (!vertex_desc_gles->BindVertexAttributes(
413  gl, vertex_buffer_view.range.offset)) {
414  return false;
415  }
416 
417  //--------------------------------------------------------------------------
418  /// Bind uniform data.
419  ///
420  if (!vertex_desc_gles->BindUniformData(gl, //
421  *transients_allocator, //
422  command.vertex_bindings, //
423  command.fragment_bindings //
424  )) {
425  return false;
426  }
427 
428  //--------------------------------------------------------------------------
429  /// Determine the primitive type.
430  ///
431  // GLES doesn't support setting the fill mode, so override the primitive
432  // with GL_LINE_STRIP to somewhat emulate PolygonMode::kLine. This isn't
433  // correct; full triangle outlines won't be drawn and disconnected
434  // geometry may appear connected. However this can still be useful for
435  // wireframe debug views.
436  auto mode = pipeline.GetDescriptor().GetPolygonMode() == PolygonMode::kLine
437  ? GL_LINE_STRIP
438  : ToMode(pipeline.GetDescriptor().GetPrimitiveType());
439 
440  //--------------------------------------------------------------------------
441  /// Finally! Invoke the draw call.
442  ///
443  if (command.vertex_buffer.index_type == IndexType::kNone) {
444  gl.DrawArrays(mode, command.base_vertex,
445  command.vertex_buffer.vertex_count);
446  } else {
447  // Bind the index buffer if necessary.
448  auto index_buffer_view = command.vertex_buffer.index_buffer;
449  auto index_buffer =
450  index_buffer_view.buffer->GetDeviceBuffer(*transients_allocator);
451  const auto& index_buffer_gles = DeviceBufferGLES::Cast(*index_buffer);
452  if (!index_buffer_gles.BindAndUploadDataIfNecessary(
454  return false;
455  }
456  gl.DrawElements(mode, // mode
457  command.vertex_buffer.vertex_count, // count
458  ToIndexType(command.vertex_buffer.index_type), // type
459  reinterpret_cast<const GLvoid*>(static_cast<GLsizei>(
460  index_buffer_view.range.offset)) // indices
461  );
462  }
463 
464  //--------------------------------------------------------------------------
465  /// Unbind vertex attribs.
466  ///
467  if (!vertex_desc_gles->UnbindVertexAttributes(gl)) {
468  return false;
469  }
470 
471  //--------------------------------------------------------------------------
472  /// Unbind the program pipeline.
473  ///
474  if (!pipeline.UnbindProgram()) {
475  return false;
476  }
477  }
478 
479  if (gl.DiscardFramebufferEXT.IsAvailable()) {
480  std::vector<GLenum> attachments;
481 
482  if (pass_data.discard_color_attachment) {
483  attachments.push_back(is_default_fbo ? GL_COLOR_EXT
484  : GL_COLOR_ATTACHMENT0);
485  }
486  if (pass_data.discard_depth_attachment) {
487  attachments.push_back(is_default_fbo ? GL_DEPTH_EXT
488  : GL_DEPTH_ATTACHMENT);
489  }
490 
491 // TODO(jonahwilliams): discarding the stencil on the default fbo when running
492 // on Windows causes Angle to discard the entire render target. Until we know
493 // the reason, default to storing.
494 #ifdef FML_OS_WIN
495  if (pass_data.discard_stencil_attachment && !is_default_fbo) {
496 #else
497  if (pass_data.discard_stencil_attachment) {
498 #endif
499  attachments.push_back(is_default_fbo ? GL_STENCIL_EXT
500  : GL_STENCIL_ATTACHMENT);
501  }
502  gl.DiscardFramebufferEXT(GL_FRAMEBUFFER, // target
503  attachments.size(), // attachments to discard
504  attachments.data() // size
505  );
506  }
507 
508 #ifdef IMPELLER_DEBUG
509  if (is_default_fbo) {
510  tracer->MarkFrameEnd(gl);
511  }
512 #endif // IMPELLER_DEBUG
513 
514  return true;
515 }
516 
517 // |RenderPass|
518 bool RenderPassGLES::OnEncodeCommands(const Context& context) const {
519  if (!IsValid()) {
520  return false;
521  }
522  if (commands_.empty()) {
523  return true;
524  }
525  const auto& render_target = GetRenderTarget();
526  if (!render_target.HasColorAttachment(0u)) {
527  return false;
528  }
529  const auto& color0 = render_target.GetColorAttachments().at(0u);
530  const auto& depth0 = render_target.GetDepthAttachment();
531  const auto& stencil0 = render_target.GetStencilAttachment();
532 
533  auto pass_data = std::make_shared<RenderPassData>();
534  pass_data->label = label_;
536 
537  //----------------------------------------------------------------------------
538  /// Setup color data.
539  ///
540  pass_data->color_attachment = color0.texture;
541  pass_data->clear_color = color0.clear_color;
542  pass_data->clear_color_attachment = CanClearAttachment(color0.load_action);
543  pass_data->discard_color_attachment =
544  CanDiscardAttachmentWhenDone(color0.store_action);
545 
546  // When we are using EXT_multisampled_render_to_texture, it is implicitly
547  // resolved when we bind the texture to the framebuffer. We don't need to
548  // discard the attachment when we are done.
549  if (color0.resolve_texture) {
550  FML_DCHECK(context.GetCapabilities()->SupportsImplicitResolvingMSAA());
551  pass_data->discard_color_attachment = false;
552  }
553 
554  //----------------------------------------------------------------------------
555  /// Setup depth data.
556  ///
557  if (depth0.has_value()) {
558  pass_data->depth_attachment = depth0->texture;
559  pass_data->clear_depth = depth0->clear_depth;
560  pass_data->clear_depth_attachment = CanClearAttachment(depth0->load_action);
561  pass_data->discard_depth_attachment =
562  CanDiscardAttachmentWhenDone(depth0->store_action);
563  }
564 
565  //----------------------------------------------------------------------------
566  /// Setup stencil data.
567  ///
568  if (stencil0.has_value()) {
569  pass_data->stencil_attachment = stencil0->texture;
570  pass_data->clear_stencil = stencil0->clear_stencil;
571  pass_data->clear_stencil_attachment =
572  CanClearAttachment(stencil0->load_action);
573  pass_data->discard_stencil_attachment =
574  CanDiscardAttachmentWhenDone(stencil0->store_action);
575  }
576 
577  std::shared_ptr<const RenderPassGLES> shared_this = shared_from_this();
578  auto tracer = ContextGLES::Cast(context).GetGPUTracer();
579  return reactor_->AddOperation([pass_data,
580  allocator = context.GetResourceAllocator(),
581  render_pass = std::move(shared_this),
582  tracer](const auto& reactor) {
583  auto result = EncodeCommandsInReactor(*pass_data, allocator, reactor,
584  render_pass->commands_, tracer);
585  FML_CHECK(result) << "Must be able to encode GL commands without error.";
586  });
587 }
588 
589 } // namespace impeller
impeller::PipelineDescriptor
Definition: pipeline_descriptor.h:29
impeller::RenderPassData::discard_stencil_attachment
bool discard_stencil_attachment
Definition: render_pass_gles.cc:141
impeller::DeviceBufferGLES::BindingType::kArrayBuffer
@ kArrayBuffer
impeller::ReactorGLES::GetProcTable
const ProcTableGLES & GetProcTable() const
Get the OpenGL proc. table the reactor uses to manage handles.
Definition: reactor_gles.cc:48
impeller::PipelineDescriptor::GetBackStencilAttachmentDescriptor
std::optional< StencilAttachmentDescriptor > GetBackStencilAttachmentDescriptor() const
Definition: pipeline_descriptor.cc:245
impeller::ColorAttachmentDescriptor::src_color_blend_factor
BlendFactor src_color_blend_factor
Definition: formats.h:498
impeller::RenderPass::GetRenderTarget
const RenderTarget & GetRenderTarget() const
Definition: render_pass.cc:43
impeller::RenderPassGLES::~RenderPassGLES
~RenderPassGLES() override
impeller::RenderPassData::color_attachment
std::shared_ptr< Texture > color_attachment
Definition: render_pass_gles.cc:131
impeller::RenderPassData::label
std::string label
Definition: render_pass_gles.cc:143
impeller::ColorWriteMask
ColorWriteMask
Definition: formats.h:433
impeller::RenderPassData::clear_depth
Scalar clear_depth
Definition: render_pass_gles.cc:129
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::TextureGLES::AttachmentPoint::kDepth
@ kDepth
impeller::CanClearAttachment
constexpr bool CanClearAttachment(LoadAction action)
Definition: formats.h:234
impeller::RenderPassData::clear_depth_attachment
bool clear_depth_attachment
Definition: render_pass_gles.cc:136
impeller::StencilAttachmentDescriptor::depth_failure
StencilOperation depth_failure
Definition: formats.h:602
impeller::StencilAttachmentDescriptor::stencil_compare
CompareFunction stencil_compare
Definition: formats.h:593
impeller::Viewport::rect
Rect rect
Definition: formats.h:396
impeller::Color
Definition: color.h:124
impeller::RenderPassData::viewport
Viewport viewport
Definition: render_pass_gles.cc:125
impeller::ColorAttachmentDescriptor::write_mask
std::underlying_type_t< ColorWriteMask > write_mask
Definition: formats.h:506
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::ProcTableGLES::PushDebugGroup
void PushDebugGroup(const std::string &string) const
Definition: proc_table_gles.cc:365
impeller::ToBlendFactor
constexpr GLenum ToBlendFactor(BlendFactor factor)
Definition: formats_gles.h:91
impeller::ReactorGLES::Ref
std::shared_ptr< ReactorGLES > Ref
Definition: reactor_gles.h:87
impeller::RenderPassData::clear_stencil_attachment
bool clear_stencil_attachment
Definition: render_pass_gles.cc:137
impeller::ColorWriteMask::kGreen
@ kGreen
texture_gles.h
impeller::RenderPassData::clear_stencil
uint32_t clear_stencil
Definition: render_pass_gles.cc:128
context_gles.h
impeller::ColorWriteMask::kRed
@ kRed
impeller::ColorAttachmentDescriptor::alpha_blend_op
BlendOperation alpha_blend_op
Definition: formats.h:503
impeller::Color::alpha
Scalar alpha
Definition: color.h:143
impeller::WindingOrder::kClockwise
@ kClockwise
impeller::StencilAttachmentDescriptor::write_mask
uint32_t write_mask
Definition: formats.h:617
impeller::RenderPassData::stencil_attachment
std::shared_ptr< Texture > stencil_attachment
Definition: render_pass_gles.cc:133
impeller::RenderPassData
Encapsulates data that will be needed in the reactor for the encoding of commands for this render pas...
Definition: render_pass_gles.cc:124
impeller::RenderPassData::discard_depth_attachment
bool discard_depth_attachment
Definition: render_pass_gles.cc:140
validation.h
impeller::Color::green
Scalar green
Definition: color.h:133
impeller::TextureGLES::AttachmentPoint::kColor0
@ kColor0
device_buffer_gles.h
impeller::RenderPass::GetRenderTargetSize
ISize GetRenderTargetSize() const
Definition: render_pass.cc:47
impeller::ToIndexType
constexpr GLenum ToIndexType(IndexType type)
Definition: formats_gles.h:34
gpu_tracer_gles.h
impeller::ToCompareFunction
constexpr GLenum ToCompareFunction(CompareFunction func)
Definition: formats_gles.h:69
impeller::CullMode::kBackFace
@ kBackFace
impeller::CullMode::kNone
@ kNone
impeller::StencilAttachmentDescriptor::read_mask
uint32_t read_mask
Definition: formats.h:612
impeller::RenderPassData::clear_color_attachment
bool clear_color_attachment
Definition: render_pass_gles.cc:135
impeller::PipelineDescriptor::HasStencilAttachmentDescriptors
bool HasStencilAttachmentDescriptors() const
Definition: pipeline_descriptor.cc:249
render_pass_gles.h
impeller::DeviceBufferGLES::BindingType::kElementArrayBuffer
@ kElementArrayBuffer
impeller::ToMode
constexpr GLenum ToMode(PrimitiveType primitive_type)
Definition: formats_gles.h:18
impeller::Color::red
Scalar red
Definition: color.h:128
impeller::WindingOrder::kCounterClockwise
@ kCounterClockwise
impeller::StencilAttachmentDescriptor::stencil_failure
StencilOperation stencil_failure
Definition: formats.h:597
impeller::IndexType::kNone
@ kNone
Does not use the index buffer.
impeller::StencilAttachmentDescriptor::depth_stencil_pass
StencilOperation depth_stencil_pass
Definition: formats.h:606
impeller::ProcTableGLES
Definition: proc_table_gles.h:217
impeller::CanDiscardAttachmentWhenDone
constexpr bool CanDiscardAttachmentWhenDone(StoreAction action)
Definition: formats.h:245
impeller::TextureGLES::AttachmentPoint::kStencil
@ kStencil
impeller::RenderPass::commands_
std::vector< Command > commands_
Definition: render_pass.h:105
impeller::ColorAttachmentDescriptor::src_alpha_blend_factor
BlendFactor src_alpha_blend_factor
Definition: formats.h:502
formats_gles.h
impeller::Viewport
Definition: formats.h:395
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:67
impeller::CullMode::kFrontFace
@ kFrontFace
impeller::ColorAttachmentDescriptor::dst_color_blend_factor
BlendFactor dst_color_blend_factor
Definition: formats.h:500
impeller::PipelineDescriptor::GetFrontStencilAttachmentDescriptor
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
Definition: pipeline_descriptor.cc:204
impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor
BlendFactor dst_alpha_blend_factor
Definition: formats.h:504
pipeline_gles.h
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:47
impeller::TRect< Scalar >::MakeSize
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:44
std
Definition: comparable.h:95
impeller::ConfigureBlending
void ConfigureBlending(const ProcTableGLES &gl, const ColorAttachmentDescriptor *color)
Definition: render_pass_gles.cc:43
impeller::BackendCast< TextureGLES, Texture >::Cast
static TextureGLES & Cast(Texture &base)
Definition: backend_cast.h:15
impeller::StencilAttachmentDescriptor
Definition: formats.h:587
impeller::ColorWriteMask::kAlpha
@ kAlpha
impeller::ReactorGLES
The reactor attempts to make thread-safe usage of OpenGL ES easier to reason about.
Definition: reactor_gles.h:56
impeller::ColorWriteMask::kBlue
@ kBlue
impeller::ConfigureStencil
void ConfigureStencil(GLenum face, const ProcTableGLES &gl, const StencilAttachmentDescriptor &stencil, uint32_t stencil_reference)
Definition: render_pass_gles.cc:78
impeller::PolygonMode::kLine
@ kLine
impeller::ContextGLES::GetGPUTracer
std::shared_ptr< GPUTracerGLES > GetGPUTracer() const
Definition: context_gles.h:46
impeller::ToBlendOperation
constexpr GLenum ToBlendOperation(BlendOperation op)
Definition: formats_gles.h:127
impeller::ColorAttachmentDescriptor::color_blend_op
BlendOperation color_blend_op
Definition: formats.h:499
impeller::TextureGLES::IsWrapped
IsWrapped
Definition: texture_gles.h:25
impeller::RenderPassData::depth_attachment
std::shared_ptr< Texture > depth_attachment
Definition: render_pass_gles.cc:132
impeller::RenderPassData::discard_color_attachment
bool discard_color_attachment
Definition: render_pass_gles.cc:139
impeller::Color::blue
Scalar blue
Definition: color.h:138
impeller::ToStencilOp
constexpr GLenum ToStencilOp(StencilOperation op)
Definition: formats_gles.h:47
impeller::EncodeCommandsInReactor
bool EncodeCommandsInReactor(const std::shared_ptr< Allocator > &transients_allocator, const ReactorGLES &reactor, const std::vector< std::unique_ptr< BlitEncodeGLES >> &commands, const std::string &label)
Definition: blit_pass_gles.cc:34
impeller
Definition: aiks_context.cc:10
impeller::Context::GetResourceAllocator
virtual std::shared_ptr< Allocator > GetResourceAllocator() const =0
Returns the allocator used to create textures and buffers on the device.
impeller::ColorAttachmentDescriptor::blending_enabled
bool blending_enabled
Definition: formats.h:496
impeller::IndexType::kUnknown
@ kUnknown
impeller::DebugToFramebufferError
std::string DebugToFramebufferError(int status)
Definition: formats_gles.cc:9
impeller::RenderPassData::clear_color
Color clear_color
Definition: render_pass_gles.cc:127
impeller::ColorAttachmentDescriptor
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:494