14 bool supports_read_from_resolve,
15 bool supports_implicit_msaa)
16 : target_(render_target),
17 supports_read_from_resolve_(supports_read_from_resolve),
18 supports_implicit_msaa_(supports_implicit_msaa) {}
22 if (!color0.resolve_texture) {
23 VALIDATION_LOG <<
"EntityPassTarget Flip should never be called for a "
28 return color0.texture;
31 if (supports_read_from_resolve_) {
36 return color0.resolve_texture;
39 if (!secondary_color_texture_) {
42 color0.resolve_texture->GetTextureDescriptor();
43 secondary_color_texture_ = allocator.
CreateTexture(new_descriptor);
45 if (!secondary_color_texture_) {
52 if (supports_implicit_msaa_) {
53 auto new_secondary = color0.resolve_texture;
54 color0.resolve_texture = secondary_color_texture_;
55 color0.texture = secondary_color_texture_;
56 secondary_color_texture_ = new_secondary;
58 std::swap(color0.resolve_texture, secondary_color_texture_);
65 return secondary_color_texture_;
void swap(sk_sp< T > &a, sk_sp< T > &b)
An object that allocates device memory.
std::shared_ptr< Texture > CreateTexture(const TextureDescriptor &desc)
std::shared_ptr< Texture > Flip(Allocator &allocator)
Flips the backdrop and returns a readable texture that can be bound/sampled to restore the previous p...
const RenderTarget & GetRenderTarget() const
EntityPassTarget(const RenderTarget &render_target, bool supports_read_from_resolve, bool supports_implicit_msaa)
const std::map< size_t, ColorAttachment > & GetColorAttachments() const
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...