| 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
5 #include "impeller/renderer/backend/gles/render_pass_gles.h"
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"
13 #include "impeller/base/validation.h"
14 #include "impeller/renderer/backend/gles/context_gles.h"
15 #include "impeller/renderer/backend/gles/device_buffer_gles.h"
16 #include "impeller/renderer/backend/gles/formats_gles.h"
17 #include "impeller/renderer/backend/gles/gpu_tracer_gles.h"
18 #include "impeller/renderer/backend/gles/pipeline_gles.h"
19 #include "impeller/renderer/backend/gles/texture_gles.h"
20
21 namespace impeller {
22
23 RenderPassGLES::RenderPassGLES(std::shared_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|
31 RenderPassGLES::~RenderPassGLES() = default;
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
43 void ConfigureBlending(const ProcTableGLES& gl,
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 = [](ColorWriteMask mask,
63 ColorWriteMask check) -> GLboolean {
64 return (mask & check) ? GL_TRUE : GL_FALSE;
65 };
66
67 gl.ColorMask(
68 is_set(color->write_mask, ColorWriteMaskBits::kRed), // red
69 is_set(color->write_mask, ColorWriteMaskBits::kGreen), // green
70 is_set(color->write_mask, ColorWriteMaskBits::kBlue), // blue
71 is_set(color->write_mask, ColorWriteMaskBits::kAlpha) // alpha
72 );
73 }
74 }
75
76 void ConfigureStencil(GLenum face,
77 const ProcTableGLES& gl,
78 const StencilAttachmentDescriptor& stencil,
79 uint32_t stencil_reference) {
80 gl.StencilOpSeparate(
81 face, // face
82 ToStencilOp(stencil.stencil_failure), // stencil fail
83 ToStencilOp(stencil.depth_failure), // depth fail
84 ToStencilOp(stencil.depth_stencil_pass) // depth stencil pass
85 );
86 gl.StencilFuncSeparate(face, // face
87 ToCompareFunction(stencil.stencil_compare), // func
88 stencil_reference, // ref
89 stencil.read_mask // mask
90 );
91 gl.StencilMaskSeparate(face, stencil.write_mask);
92 }
93
94 void ConfigureStencil(const ProcTableGLES& gl,
95 const PipelineDescriptor& pipeline,
96 uint32_t stencil_reference) {
97 if (!pipeline.HasStencilAttachmentDescriptors()) {
98 gl.Disable(GL_STENCIL_TEST);
99 return;
100 }
101
102 gl.Enable(GL_STENCIL_TEST);
103 const auto& front = pipeline.GetFrontStencilAttachmentDescriptor();
104 const auto& back = pipeline.GetBackStencilAttachmentDescriptor();
105
106 if (front.has_value() && back.has_value() && front == back) {
107 ConfigureStencil(GL_FRONT_AND_BACK, gl, *front, stencil_reference);
108 return;
109 }
110 if (front.has_value()) {
111 ConfigureStencil(GL_FRONT, gl, *front, stencil_reference);
112 }
113 if (back.has_value()) {
114 ConfigureStencil(GL_BACK, gl, *back, stencil_reference);
115 }
116 }
117
118 //------------------------------------------------------------------------------
119 /// @brief Encapsulates data that will be needed in the reactor for the
120 /// encoding of commands for this render pass.
121 ///
122 struct RenderPassData {
123 Viewport viewport;
124
125 Color clear_color;
126 uint32_t clear_stencil = 0u;
127 Scalar clear_depth = 1.0;
128
129 std::shared_ptr<Texture> color_attachment;
130 std::shared_ptr<Texture> depth_attachment;
131 std::shared_ptr<Texture> stencil_attachment;
132
133 bool clear_color_attachment = true;
134 bool clear_depth_attachment = true;
135 bool clear_stencil_attachment = true;
136
137 bool discard_color_attachment = true;
138 bool discard_depth_attachment = true;
139 bool discard_stencil_attachment = true;
140
141 std::string label;
142 };
143
144 [[nodiscard]] bool EncodeCommandsInReactor(
145 const RenderPassData& pass_data,
146 const std::shared_ptr<Allocator>& transients_allocator,
147 const ReactorGLES& reactor,
148 const std::vector<Command>& commands,
149 const std::shared_ptr<GPUTracerGLES>& tracer) {
150 TRACE_EVENT0("impeller", "RenderPassGLES::EncodeCommandsInReactor");
151
152 const auto& gl = reactor.GetProcTable();
153 #ifdef IMPELLER_DEBUG
154 tracer->MarkFrameStart(gl);
155 #endif // IMPELLER_DEBUG
156
157 fml::ScopedCleanupClosure pop_pass_debug_marker(
158 [&gl]() { gl.PopDebugGroup(); });
159 if (!pass_data.label.empty()) {
160 gl.PushDebugGroup(pass_data.label);
161 } else {
162 pop_pass_debug_marker.Release();
163 }
164
165 GLuint fbo = GL_NONE;
166 fml::ScopedCleanupClosure delete_fbo([&gl, &fbo]() {
167 if (fbo != GL_NONE) {
168 gl.BindFramebuffer(GL_FRAMEBUFFER, GL_NONE);
169 gl.DeleteFramebuffers(1u, &fbo);
170 }
171 });
172
173 TextureGLES& color_gles = TextureGLES::Cast(*pass_data.color_attachment);
174 const bool is_default_fbo = color_gles.IsWrapped();
175
176 if (is_default_fbo) {
177 if (color_gles.GetFBO().has_value()) {
178 // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
179 gl.BindFramebuffer(GL_FRAMEBUFFER, *color_gles.GetFBO());
180 }
181 } else {
182 // Create and bind an offscreen FBO.
183 gl.GenFramebuffers(1u, &fbo);
184 gl.BindFramebuffer(GL_FRAMEBUFFER, fbo);
185
186 if (!color_gles.SetAsFramebufferAttachment(
187 GL_FRAMEBUFFER, TextureGLES::AttachmentType::kColor0)) {
188 return false;
189 }
190
191 if (auto depth = TextureGLES::Cast(pass_data.depth_attachment.get())) {
192 if (!depth->SetAsFramebufferAttachment(
193 GL_FRAMEBUFFER, TextureGLES::AttachmentType::kDepth)) {
194 return false;
195 }
196 }
197 if (auto stencil = TextureGLES::Cast(pass_data.stencil_attachment.get())) {
198 if (!stencil->SetAsFramebufferAttachment(
199 GL_FRAMEBUFFER, TextureGLES::AttachmentType::kStencil)) {
200 return false;
201 }
202 }
203
204 auto status = gl.CheckFramebufferStatus(GL_FRAMEBUFFER);
205 if (status != GL_FRAMEBUFFER_COMPLETE) {
206 VALIDATION_LOG << "Could not create a complete frambuffer: "
207 << DebugToFramebufferError(status);
208 return false;
209 }
210 }
211
212 gl.ClearColor(pass_data.clear_color.red, // red
213 pass_data.clear_color.green, // green
214 pass_data.clear_color.blue, // blue
215 pass_data.clear_color.alpha // alpha
216 );
217 if (pass_data.depth_attachment) {
218 if (gl.DepthRangef.IsAvailable()) {
219 gl.ClearDepthf(pass_data.clear_depth);
220 } else {
221 gl.ClearDepth(pass_data.clear_depth);
222 }
223 }
224 if (pass_data.stencil_attachment) {
225 gl.ClearStencil(pass_data.clear_stencil);
226 }
227
228 GLenum clear_bits = 0u;
229 if (pass_data.clear_color_attachment) {
230 clear_bits |= GL_COLOR_BUFFER_BIT;
231 }
232 if (pass_data.clear_depth_attachment) {
233 clear_bits |= GL_DEPTH_BUFFER_BIT;
234 }
235 if (pass_data.clear_stencil_attachment) {
236 clear_bits |= GL_STENCIL_BUFFER_BIT;
237 }
238
239 gl.Disable(GL_SCISSOR_TEST);
240 gl.Disable(GL_DEPTH_TEST);
241 gl.Disable(GL_STENCIL_TEST);
242 gl.Disable(GL_CULL_FACE);
243 gl.Disable(GL_BLEND);
244 gl.Disable(GL_DITHER);
245 gl.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
246 gl.DepthMask(GL_TRUE);
247 gl.StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF);
248 gl.StencilMaskSeparate(GL_BACK, 0xFFFFFFFF);
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) {
278 VALIDATION_LOG
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 if (gl.DepthRangef.IsAvailable()) {
323 gl.DepthRangef(viewport.depth_range.z_near, viewport.depth_range.z_far);
324 } else {
325 gl.DepthRange(viewport.depth_range.z_near, viewport.depth_range.z_far);
326 }
327 }
328
329 //--------------------------------------------------------------------------
330 /// Setup the scissor rect.
331 ///
332 if (command.scissor.has_value()) {
333 const auto& scissor = command.scissor.value();
334 gl.Enable(GL_SCISSOR_TEST);
335 gl.Scissor(
336 scissor.GetX(), // x
337 target_size.height - scissor.GetY() - scissor.GetHeight(), // y
338 scissor.GetWidth(), // width
339 scissor.GetHeight() // height
340 );
341 } else {
342 gl.Disable(GL_SCISSOR_TEST);
343 }
344
345 //--------------------------------------------------------------------------
346 /// Setup culling.
347 ///
348 switch (pipeline.GetDescriptor().GetCullMode()) {
349 case CullMode::kNone:
350 gl.Disable(GL_CULL_FACE);
351 break;
352 case CullMode::kFrontFace:
353 gl.Enable(GL_CULL_FACE);
354 gl.CullFace(GL_FRONT);
355 break;
356 case CullMode::kBackFace:
357 gl.Enable(GL_CULL_FACE);
358 gl.CullFace(GL_BACK);
359 break;
360 }
361 //--------------------------------------------------------------------------
362 /// Setup winding order.
363 ///
364 switch (pipeline.GetDescriptor().GetWindingOrder()) {
365 case WindingOrder::kClockwise:
366 gl.FrontFace(GL_CW);
367 break;
368 case WindingOrder::kCounterClockwise:
369 gl.FrontFace(GL_CCW);
370 break;
371 }
372
373 if (command.vertex_buffer.index_type == IndexType::kUnknown) {
374 return false;
375 }
376
377 auto vertex_desc_gles = pipeline.GetBufferBindings();
378
379 //--------------------------------------------------------------------------
380 /// Bind vertex and index buffers.
381 ///
382 auto& vertex_buffer_view = command.vertex_buffer.vertex_buffer;
383
384 if (!vertex_buffer_view) {
385 return false;
386 }
387
388 auto vertex_buffer = vertex_buffer_view.buffer;
389
390 if (!vertex_buffer) {
391 return false;
392 }
393
394 const auto& vertex_buffer_gles = DeviceBufferGLES::Cast(*vertex_buffer);
395 if (!vertex_buffer_gles.BindAndUploadDataIfNecessary(
396 DeviceBufferGLES::BindingType::kArrayBuffer)) {
397 return false;
398 }
399
400 //--------------------------------------------------------------------------
401 /// Bind the pipeline program.
402 ///
403 if (!pipeline.BindProgram()) {
404 return false;
405 }
406
407 //--------------------------------------------------------------------------
408 /// Bind vertex attribs.
409 ///
410 if (!vertex_desc_gles->BindVertexAttributes(
411 gl, vertex_buffer_view.range.offset)) {
412 return false;
413 }
414
415 //--------------------------------------------------------------------------
416 /// Bind uniform data.
417 ///
418 if (!vertex_desc_gles->BindUniformData(gl, //
419 *transients_allocator, //
420 command.vertex_bindings, //
421 command.fragment_bindings //
422 )) {
423 return false;
424 }
425
426 //--------------------------------------------------------------------------
427 /// Determine the primitive type.
428 ///
429 // GLES doesn't support setting the fill mode, so override the primitive
430 // with GL_LINE_STRIP to somewhat emulate PolygonMode::kLine. This isn't
431 // correct; full triangle outlines won't be drawn and disconnected
432 // geometry may appear connected. However this can still be useful for
433 // wireframe debug views.
434 auto mode = pipeline.GetDescriptor().GetPolygonMode() == PolygonMode::kLine
435 ? GL_LINE_STRIP
436 : ToMode(pipeline.GetDescriptor().GetPrimitiveType());
437
438 //--------------------------------------------------------------------------
439 /// Finally! Invoke the draw call.
440 ///
441 if (command.vertex_buffer.index_type == IndexType::kNone) {
442 gl.DrawArrays(mode, command.base_vertex,
443 command.vertex_buffer.vertex_count);
444 } else {
445 // Bind the index buffer if necessary.
446 auto index_buffer_view = command.vertex_buffer.index_buffer;
447 auto index_buffer = index_buffer_view.buffer;
448 const auto& index_buffer_gles = DeviceBufferGLES::Cast(*index_buffer);
449 if (!index_buffer_gles.BindAndUploadDataIfNecessary(
450 DeviceBufferGLES::BindingType::kElementArrayBuffer)) {
451 return false;
452 }
453 gl.DrawElements(mode, // mode
454 command.vertex_buffer.vertex_count, // count
455 ToIndexType(command.vertex_buffer.index_type), // type
456 reinterpret_cast<const GLvoid*>(static_cast<GLsizei>(
457 index_buffer_view.range.offset)) // indices
458 );
459 }
460
461 //--------------------------------------------------------------------------
462 /// Unbind vertex attribs.
463 ///
464 if (!vertex_desc_gles->UnbindVertexAttributes(gl)) {
465 return false;
466 }
467
468 //--------------------------------------------------------------------------
469 /// Unbind the program pipeline.
470 ///
471 if (!pipeline.UnbindProgram()) {
472 return false;
473 }
474 }
475
476 if (gl.DiscardFramebufferEXT.IsAvailable()) {
477 std::vector<GLenum> attachments;
478
479 // TODO(130048): discarding stencil or depth on the default fbo causes Angle
480 // to discard the entire render target. Until we know the reason, default to
481 // storing.
482 bool angle_safe = gl.GetCapabilities()->IsANGLE() ? !is_default_fbo : true;
483
484 if (pass_data.discard_color_attachment) {
485 attachments.push_back(is_default_fbo ? GL_COLOR_EXT
486 : GL_COLOR_ATTACHMENT0);
487 }
488 if (pass_data.discard_depth_attachment && angle_safe) {
489 attachments.push_back(is_default_fbo ? GL_DEPTH_EXT
490 : GL_DEPTH_ATTACHMENT);
491 }
492
493 if (pass_data.discard_stencil_attachment && angle_safe) {
494 attachments.push_back(is_default_fbo ? GL_STENCIL_EXT
495 : GL_STENCIL_ATTACHMENT);
496 }
497 gl.DiscardFramebufferEXT(GL_FRAMEBUFFER, // target
498 attachments.size(), // attachments to discard
499 attachments.data() // size
500 );
501 }
502
503 #ifdef IMPELLER_DEBUG
504 if (is_default_fbo) {
505 tracer->MarkFrameEnd(gl);
506 }
507 #endif // IMPELLER_DEBUG
508
509 return true;
510 }
511
512 // |RenderPass|
513 bool RenderPassGLES::OnEncodeCommands(const Context& context) const {
514 if (!IsValid()) {
515 return false;
516 }
517 const auto& render_target = GetRenderTarget();
518 if (!render_target.HasColorAttachment(0u)) {
519 return false;
520 }
521 const auto& color0 = render_target.GetColorAttachments().at(0u);
522 const auto& depth0 = render_target.GetDepthAttachment();
523 const auto& stencil0 = render_target.GetStencilAttachment();
524
525 auto pass_data = std::make_shared<RenderPassData>();
526 pass_data->label = label_;
527 pass_data->viewport.rect = Rect::MakeSize(GetRenderTargetSize());
528
529 //----------------------------------------------------------------------------
530 /// Setup color data.
531 ///
532 pass_data->color_attachment = color0.texture;
533 pass_data->clear_color = color0.clear_color;
534 pass_data->clear_color_attachment = CanClearAttachment(color0.load_action);
535 pass_data->discard_color_attachment =
536 CanDiscardAttachmentWhenDone(color0.store_action);
537
538 // When we are using EXT_multisampled_render_to_texture, it is implicitly
539 // resolved when we bind the texture to the framebuffer. We don't need to
540 // discard the attachment when we are done.
541 if (color0.resolve_texture) {
542 FML_DCHECK(context.GetCapabilities()->SupportsImplicitResolvingMSAA());
543 pass_data->discard_color_attachment = false;
544 }
545
546 //----------------------------------------------------------------------------
547 /// Setup depth data.
548 ///
549 if (depth0.has_value()) {
550 pass_data->depth_attachment = depth0->texture;
551 pass_data->clear_depth = depth0->clear_depth;
552 pass_data->clear_depth_attachment = CanClearAttachment(depth0->load_action);
553 pass_data->discard_depth_attachment =
554 CanDiscardAttachmentWhenDone(depth0->store_action);
555 }
556
557 //----------------------------------------------------------------------------
558 /// Setup stencil data.
559 ///
560 if (stencil0.has_value()) {
561 pass_data->stencil_attachment = stencil0->texture;
562 pass_data->clear_stencil = stencil0->clear_stencil;
563 pass_data->clear_stencil_attachment =
564 CanClearAttachment(stencil0->load_action);
565 pass_data->discard_stencil_attachment =
566 CanDiscardAttachmentWhenDone(stencil0->store_action);
567 }
568
569 std::shared_ptr<const RenderPassGLES> shared_this = shared_from_this();
570 auto tracer = ContextGLES::Cast(context).GetGPUTracer();
571 return reactor_->AddOperation([pass_data,
572 allocator = context.GetResourceAllocator(),
573 render_pass = std::move(shared_this),
574 tracer](const auto& reactor) {
575 auto result = EncodeCommandsInReactor(*pass_data, allocator, reactor,
576 render_pass->commands_, tracer);
577 FML_CHECK(result) << "Must be able to encode GL commands without error.";
578 });
579 }
580
581 } // namespace impeller
impeller::PipelineDescriptor
Definition: pipeline_descriptor.h:24
impeller::RenderPassData::discard_stencil_attachment
bool discard_stencil_attachment
Definition: render_pass_gles.cc:139
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:243
impeller::RenderPass::GetRenderTarget
const RenderTarget & GetRenderTarget() const
Definition: render_pass.cc:39
impeller::RenderPassGLES::~RenderPassGLES
~RenderPassGLES() override
impeller::RenderPassData::color_attachment
std::shared_ptr< Texture > color_attachment
Definition: render_pass_gles.cc:129
impeller::RenderPassData::label
std::string label
Definition: render_pass_gles.cc:141
impeller::RenderPassData::clear_depth
Scalar clear_depth
Definition: render_pass_gles.cc:127
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::CanClearAttachment
constexpr bool CanClearAttachment(LoadAction action)
Definition: formats.h:239
impeller::RenderPassData::clear_depth_attachment
bool clear_depth_attachment
Definition: render_pass_gles.cc:134
impeller::StencilAttachmentDescriptor::depth_failure
StencilOperation depth_failure
Definition: formats.h:625
impeller::StencilAttachmentDescriptor::stencil_compare
CompareFunction stencil_compare
Definition: formats.h:616
impeller::TextureGLES::AttachmentType::kDepth
@ kDepth
impeller::Color
Definition: color.h:123
impeller::RenderPassData::viewport
Viewport viewport
Definition: render_pass_gles.cc:123
impeller::ColorWriteMaskBits::kGreen
@ kGreen
impeller::ProcTableGLES::PushDebugGroup
void PushDebugGroup(const std::string &string) const
Definition: proc_table_gles.cc:374
impeller::ToBlendFactor
constexpr GLenum ToBlendFactor(BlendFactor factor)
Definition: formats_gles.h:92
impeller::ReactorGLES::Ref
std::shared_ptr< ReactorGLES > Ref
Definition: reactor_gles.h:86
impeller::RenderPassData::clear_stencil_attachment
bool clear_stencil_attachment
Definition: render_pass_gles.cc:135
texture_gles.h
impeller::RenderPassData::clear_stencil
uint32_t clear_stencil
Definition: render_pass_gles.cc:126
context_gles.h
impeller::Color::alpha
Scalar alpha
Definition: color.h:142
impeller::WindingOrder::kClockwise
@ kClockwise
impeller::StencilAttachmentDescriptor::write_mask
uint32_t write_mask
Definition: formats.h:640
impeller::TextureGLES::AttachmentType::kColor0
@ kColor0
impeller::RenderPassData::stencil_attachment
std::shared_ptr< Texture > stencil_attachment
Definition: render_pass_gles.cc:131
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:122
impeller::RenderPassData::discard_depth_attachment
bool discard_depth_attachment
Definition: render_pass_gles.cc:138
validation.h
impeller::Color::green
Scalar green
Definition: color.h:132
impeller::Mask< ColorWriteMaskBits >
device_buffer_gles.h
impeller::RenderPass::GetRenderTargetSize
ISize GetRenderTargetSize() const
Definition: render_pass.cc:43
impeller::ToIndexType
constexpr GLenum ToIndexType(IndexType type)
Definition: formats_gles.h:35
gpu_tracer_gles.h
impeller::ToCompareFunction
constexpr GLenum ToCompareFunction(CompareFunction func)
Definition: formats_gles.h:70
impeller::CullMode::kBackFace
@ kBackFace
impeller::CullMode::kNone
@ kNone
impeller::StencilAttachmentDescriptor::read_mask
uint32_t read_mask
Definition: formats.h:635
impeller::RenderPassData::clear_color_attachment
bool clear_color_attachment
Definition: render_pass_gles.cc:133
impeller::PipelineDescriptor::HasStencilAttachmentDescriptors
bool HasStencilAttachmentDescriptors() const
Definition: pipeline_descriptor.cc:247
render_pass_gles.h
impeller::DeviceBufferGLES::BindingType::kElementArrayBuffer
@ kElementArrayBuffer
impeller::ToMode
constexpr GLenum ToMode(PrimitiveType primitive_type)
Definition: formats_gles.h:17
impeller::Color::red
Scalar red
Definition: color.h:127
impeller::WindingOrder::kCounterClockwise
@ kCounterClockwise
impeller::StencilAttachmentDescriptor::stencil_failure
StencilOperation stencil_failure
Definition: formats.h:620
impeller::IndexType::kNone
@ kNone
Does not use the index buffer.
impeller::StencilAttachmentDescriptor::depth_stencil_pass
StencilOperation depth_stencil_pass
Definition: formats.h:629
impeller::ProcTableGLES
Definition: proc_table_gles.h:226
impeller::CanDiscardAttachmentWhenDone
constexpr bool CanDiscardAttachmentWhenDone(StoreAction action)
Definition: formats.h:250
impeller::TextureGLES::AttachmentType::kStencil
@ kStencil
formats_gles.h
impeller::Viewport
Definition: formats.h:403
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::CullMode::kFrontFace
@ kFrontFace
impeller::ColorWriteMaskBits::kAlpha
@ kAlpha
impeller::PipelineDescriptor::GetFrontStencilAttachmentDescriptor
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
Definition: pipeline_descriptor.cc:202
pipeline_gles.h
impeller::TRect< Scalar >::MakeSize
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:150
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:13
impeller::StencilAttachmentDescriptor
Definition: formats.h:610
impeller::ColorWriteMaskBits::kRed
@ kRed
impeller::ColorWriteMaskBits::kBlue
@ kBlue
impeller::ReactorGLES
The reactor attempts to make thread-safe usage of OpenGL ES easier to reason about.
Definition: reactor_gles.h:55
impeller::ConfigureStencil
void ConfigureStencil(GLenum face, const ProcTableGLES &gl, const StencilAttachmentDescriptor &stencil, uint32_t stencil_reference)
Definition: render_pass_gles.cc:76
color
DlColor color
Definition: dl_golden_blur_unittests.cc:24
impeller::PolygonMode::kLine
@ kLine
impeller::ContextGLES::GetGPUTracer
std::shared_ptr< GPUTracerGLES > GetGPUTracer() const
Definition: context_gles.h:44
impeller::ToBlendOperation
constexpr GLenum ToBlendOperation(BlendOperation op)
Definition: formats_gles.h:128
impeller::TextureGLES
Definition: texture_gles.h:17
impeller::RenderPassData::depth_attachment
std::shared_ptr< Texture > depth_attachment
Definition: render_pass_gles.cc:130
impeller::RenderPassData::discard_color_attachment
bool discard_color_attachment
Definition: render_pass_gles.cc:137
impeller::Color::blue
Scalar blue
Definition: color.h:137
impeller::ToStencilOp
constexpr GLenum ToStencilOp(StencilOperation op)
Definition: formats_gles.h:48
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: allocation.cc:12
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:125
impeller::ColorAttachmentDescriptor
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:518