44
55#include " impeller/entity/entity_pass_target.h"
66
7+ #include " impeller/base/validation.h"
8+ #include " impeller/renderer/formats.h"
79#include " impeller/renderer/texture.h"
810
911namespace impeller {
@@ -15,8 +17,16 @@ EntityPassTarget::EntityPassTarget(const RenderTarget& render_target,
1517
1618std::shared_ptr<Texture> EntityPassTarget::Flip (Allocator& allocator) {
1719 auto color0 = target_.GetColorAttachments ().find (0 )->second ;
20+ if (!color0.resolve_texture ) {
21+ VALIDATION_LOG << " EntityPassTarget Flip should never be called for a "
22+ " non-MSAA target." ;
23+ // ...because there is never a circumstance where doing so would be
24+ // necessary. Unlike MSAA passes, non-MSAA passes can be trivially loaded
25+ // with `LoadAction::kLoad`.
26+ return color0.texture ;
27+ }
1828
19- if (supports_read_from_resolve_ && color0. resolve_texture ) {
29+ if (supports_read_from_resolve_) {
2030 // Just return the current resolve texture, which is safe to read in the
2131 // next render pass that'll resolve to `target_`.
2232 //
@@ -26,16 +36,16 @@ std::shared_ptr<Texture> EntityPassTarget::Flip(Allocator& allocator) {
2636
2737 if (!secondary_color_texture_) {
2838 // The second texture is allocated lazily to avoid unused allocations.
29- TextureDescriptor new_descriptor = color0.texture ->GetTextureDescriptor ();
39+ TextureDescriptor new_descriptor =
40+ color0.resolve_texture ->GetTextureDescriptor ();
3041 secondary_color_texture_ = allocator.CreateTexture (new_descriptor);
3142
3243 if (!secondary_color_texture_) {
3344 return nullptr ;
3445 }
3546 }
3647
37- std::swap (color0.resolve_texture ? color0.resolve_texture : color0.texture ,
38- secondary_color_texture_);
48+ std::swap (color0.resolve_texture , secondary_color_texture_);
3949
4050 target_.SetColorAttachment (color0, 0 );
4151
0 commit comments