4
4
5
5
#include " impeller/entity/entity_pass_target.h"
6
6
7
+ #include " impeller/base/validation.h"
8
+ #include " impeller/renderer/formats.h"
7
9
#include " impeller/renderer/texture.h"
8
10
9
11
namespace impeller {
@@ -15,8 +17,16 @@ EntityPassTarget::EntityPassTarget(const RenderTarget& render_target,
15
17
16
18
std::shared_ptr<Texture> EntityPassTarget::Flip (Allocator& allocator) {
17
19
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
+ }
18
28
19
- if (supports_read_from_resolve_ && color0. resolve_texture ) {
29
+ if (supports_read_from_resolve_) {
20
30
// Just return the current resolve texture, which is safe to read in the
21
31
// next render pass that'll resolve to `target_`.
22
32
//
@@ -26,16 +36,16 @@ std::shared_ptr<Texture> EntityPassTarget::Flip(Allocator& allocator) {
26
36
27
37
if (!secondary_color_texture_) {
28
38
// 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 ();
30
41
secondary_color_texture_ = allocator.CreateTexture (new_descriptor);
31
42
32
43
if (!secondary_color_texture_) {
33
44
return nullptr ;
34
45
}
35
46
}
36
47
37
- std::swap (color0.resolve_texture ? color0.resolve_texture : color0.texture ,
38
- secondary_color_texture_);
48
+ std::swap (color0.resolve_texture , secondary_color_texture_);
39
49
40
50
target_.SetColorAttachment (color0, 0 );
41
51
0 commit comments