Flutter Impeller
render_target_cache.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#pragma once
6
7
#include "
impeller/renderer/render_target.h
"
8
9
namespace
impeller
{
10
11
/// @brief An implementation of the [RenderTargetAllocator] that caches all
12
/// allocated texture data for one frame.
13
///
14
/// Any textures unused after a frame are immediately discarded.
15
class
RenderTargetCache
:
public
RenderTargetAllocator
{
16
public
:
17
explicit
RenderTargetCache
(std::shared_ptr<Allocator> allocator);
18
19
~RenderTargetCache
() =
default
;
20
21
// |RenderTargetAllocator|
22
void
Start
()
override
;
23
24
// |RenderTargetAllocator|
25
void
End
()
override
;
26
27
// |RenderTargetAllocator|
28
std::shared_ptr<Texture>
CreateTexture
(
29
const
TextureDescriptor
& desc)
override
;
30
31
// visible for testing.
32
size_t
CachedTextureCount
()
const
;
33
34
private
:
35
struct
TextureData {
36
bool
used_this_frame;
37
std::shared_ptr<Texture> texture;
38
};
39
40
std::vector<TextureData> texture_data_;
41
42
FML_DISALLOW_COPY_AND_ASSIGN(
RenderTargetCache
);
43
};
44
45
}
// namespace impeller
impeller::RenderTargetCache::CreateTexture
std::shared_ptr< Texture > CreateTexture(const TextureDescriptor &desc) override
Create a new render target texture, or recycle a previously allocated render target texture.
Definition:
render_target_cache.cc:34
impeller::RenderTargetCache::End
void End() override
Mark the end of a frame workload.
Definition:
render_target_cache.cc:19
impeller::RenderTargetCache::RenderTargetCache
RenderTargetCache(std::shared_ptr< Allocator > allocator)
Definition:
render_target_cache.cc:10
impeller::RenderTargetAllocator
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
Definition:
render_target.h:22
impeller::RenderTargetCache::~RenderTargetCache
~RenderTargetCache()=default
impeller::RenderTargetCache::Start
void Start() override
Mark the beginning of a frame workload.
Definition:
render_target_cache.cc:13
impeller::RenderTargetCache
An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame...
Definition:
render_target_cache.h:15
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition:
texture_descriptor.h:39
render_target.h
impeller
Definition:
aiks_context.cc:10
impeller::RenderTargetCache::CachedTextureCount
size_t CachedTextureCount() const
Definition:
render_target_cache.cc:30
impeller
entity
render_target_cache.h
Generated by
1.8.17