Flutter Impeller
render_pass_vk.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 <array>
8 #include <cstdint>
9 #include <vector>
10 
11 #include "flutter/fml/trace_event.h"
13 #include "impeller/core/formats.h"
25 #include "vulkan/vulkan_enums.hpp"
26 #include "vulkan/vulkan_handles.hpp"
27 #include "vulkan/vulkan_to_string.hpp"
28 
29 namespace impeller {
30 
31 static vk::AttachmentDescription CreateAttachmentDescription(
32  const Attachment& attachment,
33  const std::shared_ptr<Texture> Attachment::*texture_ptr,
34  bool supports_framebuffer_fetch) {
35  const auto& texture = attachment.*texture_ptr;
36  if (!texture) {
37  return {};
38  }
39  const auto& texture_vk = TextureVK::Cast(*texture);
40  const auto& desc = texture->GetTextureDescriptor();
41  auto current_layout = texture_vk.GetLayout();
42 
43  auto load_action = attachment.load_action;
44  auto store_action = attachment.store_action;
45 
46  if (current_layout == vk::ImageLayout::eUndefined) {
47  load_action = LoadAction::kClear;
48  }
49 
50  if (desc.storage_mode == StorageMode::kDeviceTransient) {
51  store_action = StoreAction::kDontCare;
52  } else if (texture_ptr == &Attachment::resolve_texture) {
53  store_action = StoreAction::kStore;
54  }
55 
56  // Always insert a barrier to transition to color attachment optimal.
57  if (current_layout != vk::ImageLayout::ePresentSrcKHR &&
58  current_layout != vk::ImageLayout::eUndefined) {
59  // Note: This should incur a barrier.
60  current_layout = vk::ImageLayout::eGeneral;
61  }
62 
63  return CreateAttachmentDescription(desc.format, //
64  desc.sample_count, //
65  load_action, //
66  store_action, //
67  current_layout,
68  supports_framebuffer_fetch //
69  );
70 }
71 
72 static void SetTextureLayout(
73  const Attachment& attachment,
74  const vk::AttachmentDescription& attachment_desc,
75  const std::shared_ptr<CommandBufferVK>& command_buffer,
76  const std::shared_ptr<Texture> Attachment::*texture_ptr) {
77  const auto& texture = attachment.*texture_ptr;
78  if (!texture) {
79  return;
80  }
81  const auto& texture_vk = TextureVK::Cast(*texture);
82 
83  if (attachment_desc.initialLayout == vk::ImageLayout::eGeneral) {
84  BarrierVK barrier;
85  barrier.new_layout = vk::ImageLayout::eGeneral;
86  barrier.cmd_buffer = command_buffer->GetEncoder()->GetCommandBuffer();
87  barrier.src_access = vk::AccessFlagBits::eShaderRead;
88  barrier.src_stage = vk::PipelineStageFlagBits::eFragmentShader;
89  barrier.dst_access = vk::AccessFlagBits::eColorAttachmentWrite |
90  vk::AccessFlagBits::eTransferWrite;
91  barrier.dst_stage = vk::PipelineStageFlagBits::eColorAttachmentOutput |
92  vk::PipelineStageFlagBits::eTransfer;
93 
94  texture_vk.SetLayout(barrier);
95  }
96 
97  // Instead of transitioning layouts manually using barriers, we are going to
98  // make the subpass perform our transitions.
99  texture_vk.SetLayoutWithoutEncoding(attachment_desc.finalLayout);
100 }
101 
102 SharedHandleVK<vk::RenderPass> RenderPassVK::CreateVKRenderPass(
103  const ContextVK& context,
104  const std::shared_ptr<CommandBufferVK>& command_buffer,
105  bool supports_framebuffer_fetch) const {
106  std::vector<vk::AttachmentDescription> attachments;
107 
108  std::vector<vk::AttachmentReference> color_refs;
109  std::vector<vk::AttachmentReference> resolve_refs;
110  vk::AttachmentReference depth_stencil_ref = kUnusedAttachmentReference;
111 
112  // Spec says: "Each element of the pColorAttachments array corresponds to an
113  // output location in the shader, i.e. if the shader declares an output
114  // variable decorated with a Location value of X, then it uses the attachment
115  // provided in pColorAttachments[X]. If the attachment member of any element
116  // of pColorAttachments is VK_ATTACHMENT_UNUSED."
117  //
118  // Just initialize all the elements as unused and fill in the valid bind
119  // points in the loop below.
120  color_refs.resize(render_target_.GetMaxColorAttacmentBindIndex() + 1u,
122  resolve_refs.resize(render_target_.GetMaxColorAttacmentBindIndex() + 1u,
124 
125  for (const auto& [bind_point, color] : render_target_.GetColorAttachments()) {
126  color_refs[bind_point] = vk::AttachmentReference{
127  static_cast<uint32_t>(attachments.size()),
128  supports_framebuffer_fetch ? vk::ImageLayout::eGeneral
129  : vk::ImageLayout::eColorAttachmentOptimal};
130  attachments.emplace_back(CreateAttachmentDescription(
131  color, &Attachment::texture, supports_framebuffer_fetch));
132  SetTextureLayout(color, attachments.back(), command_buffer,
134  if (color.resolve_texture) {
135  resolve_refs[bind_point] = vk::AttachmentReference{
136  static_cast<uint32_t>(attachments.size()),
137  supports_framebuffer_fetch
138  ? vk::ImageLayout::eGeneral
139  : vk::ImageLayout::eColorAttachmentOptimal};
140  attachments.emplace_back(CreateAttachmentDescription(
141  color, &Attachment::resolve_texture, supports_framebuffer_fetch));
142  SetTextureLayout(color, attachments.back(), command_buffer,
144  }
145  }
146 
147  if (auto depth = render_target_.GetDepthAttachment(); depth.has_value()) {
148  depth_stencil_ref = vk::AttachmentReference{
149  static_cast<uint32_t>(attachments.size()),
150  vk::ImageLayout::eDepthStencilAttachmentOptimal};
151  attachments.emplace_back(CreateAttachmentDescription(
152  depth.value(), &Attachment::texture, supports_framebuffer_fetch));
153  SetTextureLayout(depth.value(), attachments.back(), command_buffer,
155  }
156 
157  if (auto stencil = render_target_.GetStencilAttachment();
158  stencil.has_value()) {
159  depth_stencil_ref = vk::AttachmentReference{
160  static_cast<uint32_t>(attachments.size()),
161  vk::ImageLayout::eDepthStencilAttachmentOptimal};
162  attachments.emplace_back(CreateAttachmentDescription(
163  stencil.value(), &Attachment::texture, supports_framebuffer_fetch));
164  SetTextureLayout(stencil.value(), attachments.back(), command_buffer,
166  }
167 
168  vk::SubpassDescription subpass_desc;
169  subpass_desc.pipelineBindPoint = vk::PipelineBindPoint::eGraphics;
170  subpass_desc.setColorAttachments(color_refs);
171  subpass_desc.setResolveAttachments(resolve_refs);
172  subpass_desc.setPDepthStencilAttachment(&depth_stencil_ref);
173 
174  std::vector<vk::SubpassDependency> subpass_dependencies;
175  std::vector<vk::AttachmentReference> subpass_color_ref;
176  subpass_color_ref.push_back(vk::AttachmentReference{
177  static_cast<uint32_t>(0), vk::ImageLayout::eColorAttachmentOptimal});
178  if (supports_framebuffer_fetch) {
179  subpass_desc.setFlags(vk::SubpassDescriptionFlagBits::
180  eRasterizationOrderAttachmentColorAccessARM);
181  subpass_desc.setInputAttachments(subpass_color_ref);
182  }
183 
184  vk::RenderPassCreateInfo render_pass_desc;
185  render_pass_desc.setAttachments(attachments);
186  render_pass_desc.setPSubpasses(&subpass_desc);
187  render_pass_desc.setSubpassCount(1u);
188 
189  auto [result, pass] =
190  context.GetDevice().createRenderPassUnique(render_pass_desc);
191  if (result != vk::Result::eSuccess) {
192  VALIDATION_LOG << "Failed to create render pass: " << vk::to_string(result);
193  return {};
194  }
195  context.SetDebugName(pass.get(), debug_label_.c_str());
196  return MakeSharedVK(std::move(pass));
197 }
198 
199 RenderPassVK::RenderPassVK(const std::shared_ptr<const Context>& context,
200  const RenderTarget& target,
201  std::weak_ptr<CommandBufferVK> command_buffer)
202  : RenderPass(context, target), command_buffer_(std::move(command_buffer)) {
203  is_valid_ = true;
204 }
205 
206 RenderPassVK::~RenderPassVK() = default;
207 
208 bool RenderPassVK::IsValid() const {
209  return is_valid_;
210 }
211 
212 void RenderPassVK::OnSetLabel(std::string label) {
213  debug_label_ = std::move(label);
214 }
215 
216 static vk::ClearColorValue VKClearValueFromColor(Color color) {
217  vk::ClearColorValue value;
218  value.setFloat32(
219  std::array<float, 4>{color.red, color.green, color.blue, color.alpha});
220  return value;
221 }
222 
223 static vk::ClearDepthStencilValue VKClearValueFromDepthStencil(uint32_t stencil,
224  Scalar depth) {
225  vk::ClearDepthStencilValue value;
226  value.depth = depth;
227  value.stencil = stencil;
228  return value;
229 }
230 
231 static std::vector<vk::ClearValue> GetVKClearValues(
232  const RenderTarget& target) {
233  std::vector<vk::ClearValue> clears;
234 
235  for (const auto& [_, color] : target.GetColorAttachments()) {
236  clears.emplace_back(VKClearValueFromColor(color.clear_color));
237  if (color.resolve_texture) {
238  clears.emplace_back(VKClearValueFromColor(color.clear_color));
239  }
240  }
241 
242  const auto& depth = target.GetDepthAttachment();
243  const auto& stencil = target.GetStencilAttachment();
244 
245  if (depth.has_value()) {
246  clears.emplace_back(VKClearValueFromDepthStencil(
247  stencil ? stencil->clear_stencil : 0u, depth->clear_depth));
248  }
249 
250  if (stencil.has_value()) {
251  clears.emplace_back(VKClearValueFromDepthStencil(
252  stencil->clear_stencil, depth ? depth->clear_depth : 0.0f));
253  }
254 
255  return clears;
256 }
257 
258 SharedHandleVK<vk::Framebuffer> RenderPassVK::CreateVKFramebuffer(
259  const ContextVK& context,
260  const vk::RenderPass& pass) const {
261  vk::FramebufferCreateInfo fb_info;
262 
263  fb_info.renderPass = pass;
264 
265  const auto target_size = render_target_.GetRenderTargetSize();
266  fb_info.width = target_size.width;
267  fb_info.height = target_size.height;
268  fb_info.layers = 1u;
269 
270  std::vector<vk::ImageView> attachments;
271 
272  // This bit must be consistent to ensure compatibility with the pass created
273  // earlier. Follow this order: Color attachments, then depth, then stencil.
274  for (const auto& [_, color] : render_target_.GetColorAttachments()) {
275  // The bind point doesn't matter here since that information is present in
276  // the render pass.
277  attachments.emplace_back(TextureVK::Cast(*color.texture).GetImageView());
278  if (color.resolve_texture) {
279  attachments.emplace_back(
280  TextureVK::Cast(*color.resolve_texture).GetImageView());
281  }
282  }
283  if (auto depth = render_target_.GetDepthAttachment(); depth.has_value()) {
284  attachments.emplace_back(TextureVK::Cast(*depth->texture).GetImageView());
285  }
286  if (auto stencil = render_target_.GetStencilAttachment();
287  stencil.has_value()) {
288  attachments.emplace_back(TextureVK::Cast(*stencil->texture).GetImageView());
289  }
290 
291  fb_info.setAttachments(attachments);
292 
293  auto [result, framebuffer] =
294  context.GetDevice().createFramebufferUnique(fb_info);
295 
296  if (result != vk::Result::eSuccess) {
297  VALIDATION_LOG << "Could not create framebuffer: " << vk::to_string(result);
298  return {};
299  }
300 
301  return MakeSharedVK(std::move(framebuffer));
302 }
303 
304 static bool UpdateBindingLayouts(const Bindings& bindings,
305  const vk::CommandBuffer& buffer) {
306  // All previous writes via a render or blit pass must be done before another
307  // shader attempts to read the resource.
308  BarrierVK barrier;
309  barrier.cmd_buffer = buffer;
310  barrier.src_access = vk::AccessFlagBits::eColorAttachmentWrite |
311  vk::AccessFlagBits::eTransferWrite;
312  barrier.src_stage = vk::PipelineStageFlagBits::eColorAttachmentOutput |
313  vk::PipelineStageFlagBits::eTransfer;
314  barrier.dst_access = vk::AccessFlagBits::eShaderRead;
315  barrier.dst_stage = vk::PipelineStageFlagBits::eFragmentShader;
316 
317  barrier.new_layout = vk::ImageLayout::eShaderReadOnlyOptimal;
318 
319  for (const TextureAndSampler& data : bindings.sampled_images) {
320  if (!TextureVK::Cast(*data.texture.resource).SetLayout(barrier)) {
321  return false;
322  }
323  }
324  return true;
325 }
326 
327 static bool UpdateBindingLayouts(const Command& command,
328  const vk::CommandBuffer& buffer) {
329  return UpdateBindingLayouts(command.vertex_bindings, buffer) &&
330  UpdateBindingLayouts(command.fragment_bindings, buffer);
331 }
332 
333 static bool UpdateBindingLayouts(const std::vector<Command>& commands,
334  const vk::CommandBuffer& buffer) {
335  for (const Command& command : commands) {
336  if (!UpdateBindingLayouts(command, buffer)) {
337  return false;
338  }
339  }
340  return true;
341 }
342 
343 static void SetViewportAndScissor(const Command& command,
344  const vk::CommandBuffer& cmd_buffer,
345  PassBindingsCache& cmd_buffer_cache,
346  const ISize& target_size) {
347  // Set the viewport.
348  const auto& vp = command.viewport.value_or<Viewport>(
349  {.rect = Rect::MakeSize(target_size)});
350  vk::Viewport viewport = vk::Viewport()
351  .setWidth(vp.rect.GetWidth())
352  .setHeight(-vp.rect.GetHeight())
353  .setY(vp.rect.GetHeight())
354  .setMinDepth(0.0f)
355  .setMaxDepth(1.0f);
356  cmd_buffer_cache.SetViewport(cmd_buffer, 0, 1, &viewport);
357 
358  // Set the scissor rect.
359  const auto& sc = command.scissor.value_or(IRect::MakeSize(target_size));
360  vk::Rect2D scissor =
361  vk::Rect2D()
362  .setOffset(vk::Offset2D(sc.GetX(), sc.GetY()))
363  .setExtent(vk::Extent2D(sc.GetWidth(), sc.GetHeight()));
364  cmd_buffer_cache.SetScissor(cmd_buffer, 0, 1, &scissor);
365 }
366 
367 static bool EncodeCommand(const Context& context,
368  const Command& command,
369  CommandEncoderVK& encoder,
370  PassBindingsCache& command_buffer_cache,
371  const ISize& target_size,
372  const vk::DescriptorSet vk_desc_set) {
373 #ifdef IMPELLER_DEBUG
374  fml::ScopedCleanupClosure pop_marker(
375  [&encoder]() { encoder.PopDebugGroup(); });
376  if (!command.label.empty()) {
377  encoder.PushDebugGroup(command.label.c_str());
378  } else {
379  pop_marker.Release();
380  }
381 #endif // IMPELLER_DEBUG
382 
383  const auto& cmd_buffer = encoder.GetCommandBuffer();
384  const auto& pipeline_vk = PipelineVK::Cast(*command.pipeline);
385 
386  encoder.GetCommandBuffer().bindDescriptorSets(
387  vk::PipelineBindPoint::eGraphics, // bind point
388  pipeline_vk.GetPipelineLayout(), // layout
389  0, // first set
390  {vk::DescriptorSet{vk_desc_set}}, // sets
391  nullptr // offsets
392  );
393 
394  command_buffer_cache.BindPipeline(
395  cmd_buffer, vk::PipelineBindPoint::eGraphics, pipeline_vk.GetPipeline());
396 
397  // Set the viewport and scissors.
398  SetViewportAndScissor(command, cmd_buffer, command_buffer_cache, target_size);
399 
400  // Set the stencil reference.
401  command_buffer_cache.SetStencilReference(
402  cmd_buffer, vk::StencilFaceFlagBits::eVkStencilFrontAndBack,
403  command.stencil_reference);
404 
405  // Configure vertex and index and buffers for binding.
406  auto& vertex_buffer_view = command.vertex_buffer.vertex_buffer;
407 
408  if (!vertex_buffer_view) {
409  return false;
410  }
411 
412  auto& allocator = *context.GetResourceAllocator();
413  auto vertex_buffer = vertex_buffer_view.buffer->GetDeviceBuffer(allocator);
414 
415  if (!vertex_buffer) {
416  VALIDATION_LOG << "Failed to acquire device buffer"
417  << " for vertex buffer view";
418  return false;
419  }
420 
421  if (!encoder.Track(vertex_buffer)) {
422  return false;
423  }
424 
425  // Bind the vertex buffer.
426  auto vertex_buffer_handle = DeviceBufferVK::Cast(*vertex_buffer).GetBuffer();
427  vk::Buffer vertex_buffers[] = {vertex_buffer_handle};
428  vk::DeviceSize vertex_buffer_offsets[] = {vertex_buffer_view.range.offset};
429  cmd_buffer.bindVertexBuffers(0u, 1u, vertex_buffers, vertex_buffer_offsets);
430 
431  if (command.vertex_buffer.index_type != IndexType::kNone) {
432  // Bind the index buffer.
433  auto index_buffer_view = command.vertex_buffer.index_buffer;
434  if (!index_buffer_view) {
435  return false;
436  }
437 
438  auto index_buffer = index_buffer_view.buffer->GetDeviceBuffer(allocator);
439  if (!index_buffer) {
440  VALIDATION_LOG << "Failed to acquire device buffer"
441  << " for index buffer view";
442  return false;
443  }
444 
445  if (!encoder.Track(index_buffer)) {
446  return false;
447  }
448 
449  auto index_buffer_handle = DeviceBufferVK::Cast(*index_buffer).GetBuffer();
450  cmd_buffer.bindIndexBuffer(index_buffer_handle,
451  index_buffer_view.range.offset,
452  ToVKIndexType(command.vertex_buffer.index_type));
453 
454  // Engage!
455  cmd_buffer.drawIndexed(command.vertex_buffer.vertex_count, // index count
456  command.instance_count, // instance count
457  0u, // first index
458  command.base_vertex, // vertex offset
459  0u // first instance
460  );
461  } else {
462  cmd_buffer.draw(command.vertex_buffer.vertex_count, // vertex count
463  command.instance_count, // instance count
464  command.base_vertex, // vertex offset
465  0u // first instance
466  );
467  }
468  return true;
469 }
470 
471 bool RenderPassVK::OnEncodeCommands(const Context& context) const {
472  TRACE_EVENT0("impeller", "RenderPassVK::OnEncodeCommands");
473  if (!IsValid()) {
474  return false;
475  }
476 
477  const auto& vk_context = ContextVK::Cast(context);
478 
479  auto command_buffer = command_buffer_.lock();
480  if (!command_buffer) {
481  VALIDATION_LOG << "Command buffer died before commands could be encoded.";
482  return false;
483  }
484  auto encoder = command_buffer->GetEncoder();
485  if (!encoder) {
486  return false;
487  }
488 
489  fml::ScopedCleanupClosure pop_marker(
490  [&encoder]() { encoder->PopDebugGroup(); });
491  if (!debug_label_.empty()) {
492  encoder->PushDebugGroup(debug_label_.c_str());
493  } else {
494  pop_marker.Release();
495  }
496 
497  auto cmd_buffer = encoder->GetCommandBuffer();
498 
499  if (!UpdateBindingLayouts(commands_, cmd_buffer)) {
500  return false;
501  }
502 
503  render_target_.IterateAllAttachments(
504  [&encoder](const auto& attachment) -> bool {
505  encoder->Track(attachment.texture);
506  encoder->Track(attachment.resolve_texture);
507  return true;
508  });
509 
510  const auto& target_size = render_target_.GetRenderTargetSize();
511 
512  auto render_pass = CreateVKRenderPass(
513  vk_context, command_buffer,
514  vk_context.GetCapabilities()->SupportsFramebufferFetch());
515  if (!render_pass) {
516  VALIDATION_LOG << "Could not create renderpass.";
517  return false;
518  }
519 
520  auto framebuffer = CreateVKFramebuffer(vk_context, *render_pass);
521  if (!framebuffer) {
522  VALIDATION_LOG << "Could not create framebuffer.";
523  return false;
524  }
525 
526  if (!encoder->Track(framebuffer) || !encoder->Track(render_pass)) {
527  return false;
528  }
529 
530  auto clear_values = GetVKClearValues(render_target_);
531 
532  vk::RenderPassBeginInfo pass_info;
533  pass_info.renderPass = *render_pass;
534  pass_info.framebuffer = *framebuffer;
535  pass_info.renderArea.extent.width = static_cast<uint32_t>(target_size.width);
536  pass_info.renderArea.extent.height =
537  static_cast<uint32_t>(target_size.height);
538  pass_info.setClearValues(clear_values);
539 
540  const auto& color_image_vk = TextureVK::Cast(
541  *render_target_.GetColorAttachments().find(0u)->second.texture);
542  auto desc_sets_result = AllocateAndBindDescriptorSets(
543  vk_context, encoder, commands_, color_image_vk);
544  if (!desc_sets_result.ok()) {
545  return false;
546  }
547  auto desc_sets = desc_sets_result.value();
548 
549  {
550  TRACE_EVENT0("impeller", "EncodeRenderPassCommands");
551  cmd_buffer.beginRenderPass(pass_info, vk::SubpassContents::eInline);
552 
553  fml::ScopedCleanupClosure end_render_pass(
554  [cmd_buffer]() { cmd_buffer.endRenderPass(); });
555 
556  auto desc_index = 0u;
557  for (const auto& command : commands_) {
558  if (!EncodeCommand(context, command, *encoder, pass_bindings_cache_,
559  target_size, desc_sets[desc_index])) {
560  return false;
561  }
562  desc_index += 1;
563  }
564  }
565 
566  return true;
567 }
568 
569 } // namespace impeller
impeller::BarrierVK::dst_access
vk::AccessFlags dst_access
Definition: barrier_vk.h:43
impeller::Command
An object used to specify work to the GPU along with references to resources the GPU will used when d...
Definition: command.h:92
impeller::SetViewportAndScissor
static void SetViewportAndScissor(const Command &command, const vk::CommandBuffer &cmd_buffer, PassBindingsCache &cmd_buffer_cache, const ISize &target_size)
Definition: render_pass_vk.cc:343
impeller::Command::scissor
std::optional< IRect > scissor
Definition: command.h:139
impeller::VKClearValueFromDepthStencil
static vk::ClearDepthStencilValue VKClearValueFromDepthStencil(uint32_t stencil, Scalar depth)
Definition: render_pass_vk.cc:223
impeller::Resource::resource
ResourceType resource
Definition: command.h:34
impeller::Attachment::store_action
StoreAction store_action
Definition: formats.h:637
impeller::Scalar
float Scalar
Definition: scalar.h:18
barrier_vk.h
impeller::AllocateAndBindDescriptorSets
fml::StatusOr< std::vector< vk::DescriptorSet > > AllocateAndBindDescriptorSets(const ContextVK &context, const std::shared_ptr< CommandEncoderVK > &encoder, const std::vector< Command > &commands, const TextureVK &input_attachment)
Definition: binding_helpers_vk.cc:123
shared_object_vk.h
impeller::CommandEncoderVK::PushDebugGroup
void PushDebugGroup(const char *label) const
Definition: command_encoder_vk.cc:311
impeller::Color
Definition: color.h:124
command_encoder_vk.h
impeller::BarrierVK::new_layout
vk::ImageLayout new_layout
Definition: barrier_vk.h:23
impeller::BarrierVK::cmd_buffer
vk::CommandBuffer cmd_buffer
Definition: barrier_vk.h:22
formats.h
impeller::Command::viewport
std::optional< Viewport > viewport
Definition: command.h:133
impeller::Bindings::sampled_images
std::vector< TextureAndSampler > sampled_images
Definition: command.h:74
impeller::Color::alpha
Scalar alpha
Definition: color.h:143
impeller::StoreAction::kDontCare
@ kDontCare
formats_vk.h
impeller::EncodeCommand
static bool EncodeCommand(const Context &context, const Command &command, CommandEncoderVK &encoder, PassBindingsCache &command_buffer_cache, const ISize &target_size, const vk::DescriptorSet vk_desc_set)
Definition: render_pass_vk.cc:367
impeller::RenderTarget::GetColorAttachments
const std::map< size_t, ColorAttachment > & GetColorAttachments() const
Definition: render_target.cc:209
pipeline_vk.h
render_pass_vk.h
validation.h
impeller::Color::green
Scalar green
Definition: color.h:133
impeller::PassBindingsCache::SetScissor
void SetScissor(const IRect &scissor)
Definition: render_pass_mtl.mm:324
impeller::CreateAttachmentDescription
constexpr vk::AttachmentDescription CreateAttachmentDescription(PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action, vk::ImageLayout current_layout, bool supports_framebuffer_fetch)
Definition: formats_vk.h:429
impeller::SetTextureLayout
static void SetTextureLayout(const Attachment &attachment, const vk::AttachmentDescription &attachment_desc, const std::shared_ptr< CommandBufferVK > &command_buffer, const std::shared_ptr< Texture > Attachment::*texture_ptr)
Definition: render_pass_vk.cc:72
command.h
command_buffer_vk.h
impeller::TSize< int64_t >
impeller::LoadAction::kClear
@ kClear
impeller::RenderTarget::GetDepthAttachment
const std::optional< DepthAttachment > & GetDepthAttachment() const
Definition: render_target.cc:214
impeller::StorageMode::kDeviceTransient
@ kDeviceTransient
impeller::Command::vertex_bindings
Bindings vertex_bindings
Definition: command.h:101
impeller::BarrierVK
Defines an operations and memory access barrier on a resource.
Definition: barrier_vk.h:21
impeller::GetVKClearValues
static std::vector< vk::ClearValue > GetVKClearValues(const RenderTarget &target)
Definition: render_pass_vk.cc:231
impeller::ToVKIndexType
constexpr vk::IndexType ToVKIndexType(IndexType index_type)
Definition: formats_vk.h:331
impeller::UpdateBindingLayouts
static bool UpdateBindingLayouts(const std::vector< Command > &commands, const vk::CommandBuffer &buffer)
Definition: render_pass_vk.cc:333
impeller::Attachment::texture
std::shared_ptr< Texture > texture
Definition: formats.h:634
impeller::PassBindingsCache
Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do add...
Definition: render_pass_mtl.mm:195
impeller::Color::red
Scalar red
Definition: color.h:128
impeller::BarrierVK::src_access
vk::AccessFlags src_access
Definition: barrier_vk.h:33
impeller::Attachment
Definition: formats.h:633
impeller::RenderTarget
Definition: render_target.h:49
impeller::StoreAction::kStore
@ kStore
impeller::RenderPass::render_target_
const RenderTarget render_target_
Definition: render_pass.h:103
impeller::CommandEncoderVK::PopDebugGroup
void PopDebugGroup() const
Definition: command_encoder_vk.cc:322
texture_vk.h
impeller::TextureAndSampler
combines the texture, sampler and sampler slot information.
Definition: command.h:61
impeller::BarrierVK::dst_stage
vk::PipelineStageFlags dst_stage
Definition: barrier_vk.h:38
impeller::Viewport
Definition: formats.h:395
impeller::TextureAndSampler::texture
TextureResource texture
Definition: command.h:63
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:67
impeller::Attachment::resolve_texture
std::shared_ptr< Texture > resolve_texture
Definition: formats.h:635
impeller::MakeSharedVK
auto MakeSharedVK(vk::UniqueHandle< T, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE > handle)
Definition: shared_object_vk.h:43
impeller::PassBindingsCache::SetViewport
void SetViewport(const Viewport &viewport)
Definition: render_pass_mtl.mm:309
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:47
std
Definition: comparable.h:95
impeller::Command::fragment_bindings
Bindings fragment_bindings
Definition: command.h:106
binding_helpers_vk.h
impeller::BackendCast< TextureVK, Texture >::Cast
static TextureVK & Cast(Texture &base)
Definition: backend_cast.h:15
impeller::Attachment::load_action
LoadAction load_action
Definition: formats.h:636
device_buffer_vk.h
impeller::kUnusedAttachmentReference
static constexpr vk::AttachmentReference kUnusedAttachmentReference
Definition: formats_vk.h:493
impeller::RenderTarget::GetMaxColorAttacmentBindIndex
size_t GetMaxColorAttacmentBindIndex() const
Definition: render_target.cc:172
impeller::Command::pipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > pipeline
Definition: command.h:96
impeller::RenderTarget::GetStencilAttachment
const std::optional< StencilAttachment > & GetStencilAttachment() const
Definition: render_target.cc:218
context_vk.h
impeller::Color::blue
Scalar blue
Definition: color.h:138
impeller::CommandEncoderVK
Definition: command_encoder_vk.h:49
impeller
Definition: aiks_context.cc:10
impeller::CommandEncoderVK::GetCommandBuffer
vk::CommandBuffer GetCommandBuffer() const
Definition: command_encoder_vk.cc:231
impeller::BarrierVK::src_stage
vk::PipelineStageFlags src_stage
Definition: barrier_vk.h:28
impeller::Bindings
Definition: command.h:73
impeller::VKClearValueFromColor
static vk::ClearColorValue VKClearValueFromColor(Color color)
Definition: render_pass_vk.cc:216