| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
impeller::Attachment Struct Reference

`#include <formats.h>`

Inheritance diagram for impeller::Attachment:

## Public Member Functions
bool | IsValid () const

## Public Attributes
std::shared_ptr< Texture > | texture
std::shared_ptr< Texture > | resolve_texture
LoadAction | load_action = LoadAction::kDontCare
StoreAction | store_action = StoreAction::kStore

## Detailed Description

Definition at line 650 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
32 if (StoreActionNeedsResolveTexture(store_action)) {
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) {
41 if (store_action != StoreAction::kMultisampleResolve &&
42 store_action != StoreAction::kStoreAndMultisampleResolve) {
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 ==
49 StorageMode::kDeviceTransient &&
50 store_action == StoreAction::kStoreAndMultisampleResolve) {
51 VALIDATION_LOG
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) {
62 if (load_action == LoadAction::kLoad) {
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 }
69 if (store_action != StoreAction::kDontCare) {
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

LoadAction impeller::Attachment::load_action = LoadAction::kDontCare

Definition at line 653 of file formats.h.

Referenced by impeller::AttachmentToString(), impeller::ConfigureAttachment(), impeller::RenderTargetAllocator::CreateOffscreen(), impeller::RenderTargetAllocator::CreateOffscreenMSAA(), IsValid(), impeller::RenderTarget::SetupDepthStencilAttachments(), impeller::testing::TEST_P(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

## ◆ resolve_texture

std::shared_ptr<Texture> impeller::Attachment::resolve_texture

Definition at line 652 of file formats.h.

Referenced by impeller::AttachmentToString(), impeller::ConfigureResolveTextureAttachment(), impeller::RenderTargetAllocator::CreateOffscreenMSAA(), IsValid(), impeller::testing::TEST_P(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

## ◆ store_action

StoreAction impeller::Attachment::store_action = StoreAction::kStore

Definition at line 654 of file formats.h.

Referenced by impeller::AttachmentToString(), impeller::ConfigureAttachment(), impeller::ConfigureResolveTextureAttachment(), impeller::RenderTargetAllocator::CreateOffscreen(), impeller::RenderTargetAllocator::CreateOffscreenMSAA(), IsValid(), impeller::RenderTarget::SetupDepthStencilAttachments(), impeller::testing::TEST_P(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

## ◆ texture

std::shared_ptr<Texture> impeller::Attachment::texture

Definition at line 651 of file formats.h.

Referenced by impeller::AttachmentToString(), impeller::ConfigureAttachment(), impeller::RenderTargetAllocator::CreateOffscreen(), impeller::RenderTargetAllocator::CreateOffscreenMSAA(), IsValid(), impeller::RenderTarget::SetupDepthStencilAttachments(), impeller::testing::TEST_P(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

The documentation for this struct was generated from the following files:

- impeller/core/formats.h
- impeller/core/formats.cc

impeller::StoreAction::kMultisampleResolve
@ kMultisampleResolve
impeller::LoadAction::kLoad
@ kLoad
impeller::StoreAction::kStoreAndMultisampleResolve
@ kStoreAndMultisampleResolve
impeller::Attachment::store_action
StoreAction store_action
Definition: formats.h:654
impeller::StoreAction::kDontCare
@ kDontCare
impeller::StorageMode::kDeviceTransient
@ kDeviceTransient
impeller::Attachment::texture
std::shared_ptr< Texture > texture
Definition: formats.h:651
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73
impeller::Attachment::resolve_texture
std::shared_ptr< Texture > resolve_texture
Definition: formats.h:652
impeller::Attachment::load_action
LoadAction load_action
Definition: formats.h:653
impeller::StoreActionNeedsResolveTexture
constexpr bool StoreActionNeedsResolveTexture(StoreAction action)
Definition: formats.cc:15