Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
skgpu::graphite::AtlasProvider Class Referencefinal

#include <AtlasProvider.h>

Public Types

enum class  PathAtlasFlags : unsigned { kNone = 0b000 , kCompute = 0b001 , kRaster = 0b010 }
 
using PathAtlasFlagsBitMask = SkEnumBitMask< PathAtlasFlags >
 

Public Member Functions

 AtlasProvider (Recorder *)
 
 ~AtlasProvider ()=default
 
TextAtlasManagertextAtlasManager () const
 
bool isAvailable (PathAtlasFlags atlasType) const
 
std::unique_ptr< ComputePathAtlascreateComputePathAtlas (Recorder *recorder) const
 
RasterPathAtlasgetRasterPathAtlas () const
 
sk_sp< TextureProxygetAtlasTexture (Recorder *, uint16_t width, uint16_t height, SkColorType, uint16_t identifier, bool requireStorageUsage)
 
void clearTexturePool ()
 
void recordUploads (DrawContext *)
 
void postFlush ()
 

Static Public Member Functions

static PathAtlasFlagsBitMask QueryPathAtlasSupport (const Caps *)
 

Detailed Description

AtlasProvider groups various texture atlas management algorithms together.

Definition at line 33 of file AtlasProvider.h.

Member Typedef Documentation

◆ PathAtlasFlagsBitMask

Definition at line 43 of file AtlasProvider.h.

Member Enumeration Documentation

◆ PathAtlasFlags

enum class skgpu::graphite::AtlasProvider::PathAtlasFlags : unsigned
strong
Enumerator
kNone 
kCompute 
kRaster 

Definition at line 35 of file AtlasProvider.h.

35 : unsigned {
36 kNone = 0b000,
37 // ComputePathAtlas is supported
38 kCompute = 0b001,
39 // RasterPathAtlas is supported
40 kRaster = 0b010,
41 };

Constructor & Destructor Documentation

◆ AtlasProvider()

skgpu::graphite::AtlasProvider::AtlasProvider ( Recorder recorder)
explicit

Definition at line 31 of file AtlasProvider.cpp.

32 : fTextAtlasManager(std::make_unique<TextAtlasManager>(recorder))
33 , fRasterPathAtlas(std::make_unique<RasterPathAtlas>(recorder))
34 , fPathAtlasFlags(QueryPathAtlasSupport(recorder->priv().caps())) {}
static PathAtlasFlagsBitMask QueryPathAtlasSupport(const Caps *)
const Caps * caps() const

◆ ~AtlasProvider()

skgpu::graphite::AtlasProvider::~AtlasProvider ( )
default

Member Function Documentation

◆ clearTexturePool()

void skgpu::graphite::AtlasProvider::clearTexturePool ( )

Definition at line 85 of file AtlasProvider.cpp.

85 {
86 fTexturePool.clear();
87}

◆ createComputePathAtlas()

std::unique_ptr< ComputePathAtlas > skgpu::graphite::AtlasProvider::createComputePathAtlas ( Recorder recorder) const

Definition at line 36 of file AtlasProvider.cpp.

36 {
38 return ComputePathAtlas::CreateDefault(recorder);
39 }
40 return nullptr;
41}
bool isAvailable(PathAtlasFlags atlasType) const
static std::unique_ptr< ComputePathAtlas > CreateDefault(Recorder *)

◆ getAtlasTexture()

sk_sp< TextureProxy > skgpu::graphite::AtlasProvider::getAtlasTexture ( Recorder recorder,
uint16_t  width,
uint16_t  height,
SkColorType  colorType,
uint16_t  identifier,
bool  requireStorageUsage 
)

Definition at line 47 of file AtlasProvider.cpp.

52 {
53 uint64_t key = static_cast<uint64_t>(width) << 48 |
54 static_cast<uint64_t>(height) << 32 |
55 static_cast<uint64_t>(colorType) << 16 |
56 static_cast<uint64_t>(identifier);
57 auto iter = fTexturePool.find(key);
58 if (iter != fTexturePool.end()) {
59 return iter->second;
60 }
61
62 // We currently only make the distinction between a storage texture (written by a
63 // compute pass) and a plain sampleable texture (written via upload) that won't be
64 // used as a render attachment.
65 const Caps* caps = recorder->priv().caps();
66 auto textureInfo = requireStorageUsage
68 : caps->getDefaultSampledTextureInfo(colorType,
69 Mipmapped::kNo,
70 recorder->priv().isProtected(),
71 Renderable::kNo);
73 recorder->priv().resourceProvider(),
74 SkISize::Make((int32_t) width, (int32_t) height),
75 textureInfo,
77 if (!proxy) {
78 return nullptr;
79 }
80
81 fTexturePool[key] = proxy;
82 return proxy;
83}
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
virtual TextureInfo getDefaultStorageTextureInfo(SkColorType) const =0
Protected isProtected() const
ResourceProvider * resourceProvider()
static sk_sp< TextureProxy > Make(const Caps *, ResourceProvider *, SkISize dimensions, const TextureInfo &, skgpu::Budgeted)
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)
int32_t height
int32_t width
static constexpr SkISize Make(int32_t w, int32_t h)
Definition SkSize.h:20

◆ getRasterPathAtlas()

RasterPathAtlas * skgpu::graphite::AtlasProvider::getRasterPathAtlas ( ) const

Definition at line 43 of file AtlasProvider.cpp.

43 {
44 return fRasterPathAtlas.get();
45}

◆ isAvailable()

bool skgpu::graphite::AtlasProvider::isAvailable ( PathAtlasFlags  atlasType) const
inline

Definition at line 56 of file AtlasProvider.h.

56 {
57 return SkToBool(fPathAtlasFlags & atlasType);
58 }
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35

◆ postFlush()

void skgpu::graphite::AtlasProvider::postFlush ( )

Definition at line 99 of file AtlasProvider.cpp.

99 {
100 fTextAtlasManager->postFlush();
101 if (fRasterPathAtlas) {
102 fRasterPathAtlas->postFlush();
103 }
104}

◆ QueryPathAtlasSupport()

AtlasProvider::PathAtlasFlagsBitMask skgpu::graphite::AtlasProvider::QueryPathAtlasSupport ( const Caps caps)
static

Definition at line 22 of file AtlasProvider.cpp.

22 {
27 }
28 return flags;
29}
SkEnumBitMask< PathAtlasFlags > PathAtlasFlagsBitMask
static bool IsVelloRendererSupported(const Caps *)
FlutterSemanticsFlag flags

◆ recordUploads()

void skgpu::graphite::AtlasProvider::recordUploads ( DrawContext dc)

Definition at line 89 of file AtlasProvider.cpp.

89 {
90 if (!fTextAtlasManager->recordUploads(dc)) {
91 SKGPU_LOG_E("TextAtlasManager uploads have failed -- may see invalid results.");
92 }
93
94 if (fRasterPathAtlas) {
95 fRasterPathAtlas->recordUploads(dc);
96 }
97}
#define SKGPU_LOG_E(fmt,...)
Definition Log.h:38

◆ textAtlasManager()

TextAtlasManager * skgpu::graphite::AtlasProvider::textAtlasManager ( ) const
inline

Definition at line 53 of file AtlasProvider.h.

53{ return fTextAtlasManager.get(); }

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