Flutter Impeller
impeller::Attachment Struct Reference

#include <formats.h>

Inheritance diagram for impeller::Attachment:
impeller::ColorAttachment impeller::DepthAttachment impeller::StencilAttachment

Public Member Functions

bool IsValid () const
 

Public Attributes

std::shared_ptr< Texturetexture
 
std::shared_ptr< Textureresolve_texture
 
LoadAction load_action = LoadAction::kDontCare
 
StoreAction store_action = StoreAction::kStore
 

Detailed Description

Definition at line 638 of file formats.h.

Member Function Documentation

◆ IsValid()

bool impeller::Attachment::IsValid ( ) const

Definition at line 26 of file formats.cc.

26  {
27  if (!texture || !texture->IsValid()) {
28  VALIDATION_LOG << "Attachment has no texture.";
29  return false;
30  }
31 
33  if (!resolve_texture || !resolve_texture->IsValid()) {
34  VALIDATION_LOG << "Store action needs resolve but no valid resolve "
35  "texture specified.";
36  return false;
37  }
38  }
39 
40  if (resolve_texture) {
43  VALIDATION_LOG << "A resolve texture was specified, but the store action "
44  "doesn't include multisample resolve.";
45  return false;
46  }
47 
48  if (texture->GetTextureDescriptor().storage_mode ==
52  << "The multisample texture cannot be transient when "
53  "specifying the StoreAndMultisampleResolve StoreAction.";
54  }
55  }
56 
57  auto storage_mode = resolve_texture
58  ? resolve_texture->GetTextureDescriptor().storage_mode
59  : texture->GetTextureDescriptor().storage_mode;
60 
61  if (storage_mode == StorageMode::kDeviceTransient) {
63  VALIDATION_LOG << "The LoadAction cannot be Load when attaching a device "
64  "transient " +
65  std::string(resolve_texture ? "resolve texture."
66  : "texture.");
67  return false;
68  }
70  VALIDATION_LOG << "The StoreAction must be DontCare when attaching a "
71  "device transient " +
72  std::string(resolve_texture ? "resolve texture."
73  : "texture.");
74  return false;
75  }
76  }
77 
78  return true;
79 }

References impeller::kDeviceTransient, impeller::kDontCare, impeller::kLoad, impeller::kMultisampleResolve, impeller::kStoreAndMultisampleResolve, load_action, resolve_texture, store_action, impeller::StoreActionNeedsResolveTexture(), texture, and VALIDATION_LOG.

Referenced by impeller::RenderTarget::SetColorAttachment(), and impeller::testing::TEST_P().

Member Data Documentation

◆ load_action

◆ resolve_texture

◆ store_action

◆ texture


The documentation for this struct was generated from the following files:
impeller::StoreAction::kMultisampleResolve
@ kMultisampleResolve
impeller::LoadAction::kLoad
@ kLoad
impeller::StoreAction::kStoreAndMultisampleResolve
@ kStoreAndMultisampleResolve
impeller::Attachment::store_action
StoreAction store_action
Definition: formats.h:642
impeller::StoreAction::kDontCare
@ kDontCare
impeller::StorageMode::kDeviceTransient
@ kDeviceTransient
impeller::Attachment::texture
std::shared_ptr< Texture > texture
Definition: formats.h:639
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73
impeller::Attachment::resolve_texture
std::shared_ptr< Texture > resolve_texture
Definition: formats.h:640
impeller::Attachment::load_action
LoadAction load_action
Definition: formats.h:641
impeller::StoreActionNeedsResolveTexture
constexpr bool StoreActionNeedsResolveTexture(StoreAction action)
Definition: formats.cc:15