Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
skgpu::graphite::RecorderPriv Class Reference

#include <RecorderPriv.h>

Public Member Functions

void add (sk_sp< Task >)
 
void flushTrackedDevices ()
 
const Capscaps () const
 
ResourceProviderresourceProvider ()
 
const RuntimeEffectDictionaryruntimeEffectDictionary () const
 
RuntimeEffectDictionaryruntimeEffectDictionary ()
 
const ShaderCodeDictionaryshaderCodeDictionary () const
 
ShaderCodeDictionaryshaderCodeDictionary ()
 
const RendererProviderrendererProvider () const
 
Protected isProtected () const
 
UniformDataCacheuniformDataCache ()
 
TextureDataCachetextureDataCache ()
 
DrawBufferManagerdrawBufferManager ()
 
UploadBufferManageruploadBufferManager ()
 
AtlasProvideratlasProvider ()
 
TokenTrackertokenTracker ()
 
sktext::gpu::StrikeCachestrikeCache ()
 
sktext::gpu::TextBlobRedrawCoordinatortextBlobCache ()
 
ProxyCacheproxyCache ()
 
void addPendingRead (const TextureProxy *)
 
uint32_t uniqueID () const
 
size_t getResourceCacheLimit () const
 

Static Public Member Functions

static sk_sp< TextureProxyCreateCachedProxy (Recorder *, const SkBitmap &, std::string_view label)
 

Friends

class Recorder
 

Detailed Description

Definition at line 26 of file RecorderPriv.h.

Member Function Documentation

◆ add()

void skgpu::graphite::RecorderPriv::add ( sk_sp< Task task)

Definition at line 485 of file Recorder.cpp.

485 {
487 fRecorder->fRootTaskList->add(std::move(task));
488}
#define ASSERT_SINGLE_OWNER_PRIV
Definition: Recorder.cpp:58

◆ addPendingRead()

void skgpu::graphite::RecorderPriv::addPendingRead ( const TextureProxy proxy)

Definition at line 480 of file Recorder.cpp.

480 {
482 fRecorder->fProxyReadCounts->increment(proxy);
483}

◆ atlasProvider()

AtlasProvider * skgpu::graphite::RecorderPriv::atlasProvider ( )
inline

Definition at line 61 of file RecorderPriv.h.

61{ return fRecorder->fAtlasProvider.get(); }

◆ caps()

const Caps * skgpu::graphite::RecorderPriv::caps ( ) const
inline

Definition at line 31 of file RecorderPriv.h.

31{ return fRecorder->fSharedContext->caps(); }

◆ CreateCachedProxy()

sk_sp< TextureProxy > skgpu::graphite::RecorderPriv::CreateCachedProxy ( Recorder recorder,
const SkBitmap bitmap,
std::string_view  label 
)
static

Definition at line 544 of file Recorder.cpp.

546 {
547 SkASSERT(!bitmap.isNull());
548
549 if (!recorder) {
550 return nullptr;
551 }
552 return recorder->priv().proxyCache()->findOrCreateCachedProxy(recorder,
553 bitmap,
554 std::move(label));
555}
#define SkASSERT(cond)
Definition: SkAssert.h:116
sk_sp< TextureProxy > findOrCreateCachedProxy(Recorder *, const SkBitmap &, std::string_view label)
Definition: ProxyCache.cpp:74
Definition: bitmap.py:1

◆ drawBufferManager()

DrawBufferManager * skgpu::graphite::RecorderPriv::drawBufferManager ( )
inline

Definition at line 58 of file RecorderPriv.h.

58{ return fRecorder->fDrawBufferManager.get(); }

◆ flushTrackedDevices()

void skgpu::graphite::RecorderPriv::flushTrackedDevices ( )

Definition at line 490 of file Recorder.cpp.

490 {
492
493 // If this is the initial flushTrackedDevices() call, fFlushingTrackedDevicesIndex will be -1
494 // so we start iterating at 0. We remember the starting device index to perform clean up only
495 // when it was 0 to prevent modifying the underlying data structure while iterating over it.
496 // However, when flushing one device it may register new devices as well as recursively call
497 // flushTrackedDevices(). In that case, it picks up the next device after the current one that
498 // triggered the recursive flush since all prior devices have been flushed are in progress
499 // (and they should not be flushed while in an unfinished flush). When the control flow returns
500 // to the outer flushTrackedDevices(), it will pick up with wherever the inner flush had ended.
501 // TODO(b/330864257): Once paint data is extracted at draw time (so picture shaders are rendered
502 // to images before a flush instead of inside a flush), we can simplify this and assert that
503 // flushTrackedDevices() is not recursively called and that devices are not added or removed
504 // while flushing.
505 const int startingIndex = fRecorder->fFlushingDevicesIndex;
506 while (fRecorder->fFlushingDevicesIndex < fRecorder->fTrackedDevices.size() - 1) {
507 // Advance before calling flushPendingWorkToRecorder() so that any re-entrant clal to
508 // flushTrackedDevices() will skip the current device.
509 fRecorder->fFlushingDevicesIndex++;
510 // Entries may be set to null from a call to deregisterDevice(), which will be cleaned up
511 // along with any immutable or uniquely held Devices once everything is flushed.
512 Device* device = fRecorder->fTrackedDevices[fRecorder->fFlushingDevicesIndex].get();
513 if (device) {
514 device->flushPendingWorkToRecorder();
515 }
516 }
517
518 // Issue next upload flush token. This is only used by the atlasing code which
519 // always uses this method. Calling in Device::flushPendingWorkToRecorder may
520 // miss parent device flushes, increment too often, and lead to atlas corruption.
521 this->tokenTracker()->issueFlushToken();
522
523 if (startingIndex < 0) {
524 // Initial call to flushTrackedDevices() so cleanup null/immutable devices and reset the
525 // loop index.
526 int i = 0;
527 while (i < fRecorder->fTrackedDevices.size()) {
528 Device* device = fRecorder->fTrackedDevices[i].get();
529 if (!device || !device->recorder() || device->unique()) {
530 if (device) {
531 device->abandonRecorder(); // Keep ~Device() happy
532 }
533 fRecorder->fTrackedDevices.removeShuffle(i);
534 // Keep i as-is to process what was just shuffled to the ith index.
535 } else {
536 i++;
537 }
538 }
539
540 fRecorder->fFlushingDevicesIndex = -1;
541 }
542}
TokenTracker * tokenTracker()
Definition: RecorderPriv.h:62
VkDevice device
Definition: main.cc:53

◆ getResourceCacheLimit()

size_t skgpu::graphite::RecorderPriv::getResourceCacheLimit ( ) const

Definition at line 557 of file Recorder.cpp.

557 {
558 return fRecorder->fResourceProvider->getResourceCacheLimit();
559}

◆ isProtected()

Protected skgpu::graphite::RecorderPriv::isProtected ( ) const
inline

Definition at line 52 of file RecorderPriv.h.

52 {
53 return fRecorder->fSharedContext->isProtected();
54 }

◆ proxyCache()

ProxyCache * skgpu::graphite::RecorderPriv::proxyCache ( )
inline

Definition at line 67 of file RecorderPriv.h.

67{ return this->resourceProvider()->proxyCache(); }
ResourceProvider * resourceProvider()
Definition: RecorderPriv.h:33

◆ rendererProvider()

const RendererProvider * skgpu::graphite::RecorderPriv::rendererProvider ( ) const
inline

Definition at line 48 of file RecorderPriv.h.

48 {
49 return fRecorder->fSharedContext->rendererProvider();
50 }

◆ resourceProvider()

ResourceProvider * skgpu::graphite::RecorderPriv::resourceProvider ( )
inline

Definition at line 33 of file RecorderPriv.h.

33{ return fRecorder->fResourceProvider; }

◆ runtimeEffectDictionary() [1/2]

RuntimeEffectDictionary * skgpu::graphite::RecorderPriv::runtimeEffectDictionary ( )
inline

Definition at line 38 of file RecorderPriv.h.

38 {
39 return fRecorder->fRuntimeEffectDict.get();
40 }

◆ runtimeEffectDictionary() [2/2]

const RuntimeEffectDictionary * skgpu::graphite::RecorderPriv::runtimeEffectDictionary ( ) const
inline

Definition at line 35 of file RecorderPriv.h.

35 {
36 return fRecorder->fRuntimeEffectDict.get();
37 }

◆ shaderCodeDictionary() [1/2]

ShaderCodeDictionary * skgpu::graphite::RecorderPriv::shaderCodeDictionary ( )
inline

Definition at line 44 of file RecorderPriv.h.

44 {
45 return fRecorder->fSharedContext->shaderCodeDictionary();
46 }

◆ shaderCodeDictionary() [2/2]

const ShaderCodeDictionary * skgpu::graphite::RecorderPriv::shaderCodeDictionary ( ) const
inline

Definition at line 41 of file RecorderPriv.h.

41 {
42 return fRecorder->fSharedContext->shaderCodeDictionary();
43 }

◆ strikeCache()

sktext::gpu::StrikeCache * skgpu::graphite::RecorderPriv::strikeCache ( )
inline

Definition at line 63 of file RecorderPriv.h.

63{ return fRecorder->fStrikeCache.get(); }

◆ textBlobCache()

sktext::gpu::TextBlobRedrawCoordinator * skgpu::graphite::RecorderPriv::textBlobCache ( )
inline

Definition at line 64 of file RecorderPriv.h.

64 {
65 return fRecorder->fTextBlobCache.get();
66 }

◆ textureDataCache()

TextureDataCache * skgpu::graphite::RecorderPriv::textureDataCache ( )
inline

Definition at line 57 of file RecorderPriv.h.

57{ return fRecorder->fTextureDataCache.get(); }

◆ tokenTracker()

TokenTracker * skgpu::graphite::RecorderPriv::tokenTracker ( )
inline

Definition at line 62 of file RecorderPriv.h.

62{ return fRecorder->fTokenTracker.get(); }

◆ uniformDataCache()

UniformDataCache * skgpu::graphite::RecorderPriv::uniformDataCache ( )
inline

Definition at line 56 of file RecorderPriv.h.

56{ return fRecorder->fUniformDataCache.get(); }

◆ uniqueID()

uint32_t skgpu::graphite::RecorderPriv::uniqueID ( ) const
inline

Definition at line 76 of file RecorderPriv.h.

76{ return fRecorder->fUniqueID; }

◆ uploadBufferManager()

UploadBufferManager * skgpu::graphite::RecorderPriv::uploadBufferManager ( )
inline

Definition at line 59 of file RecorderPriv.h.

59{ return fRecorder->fUploadBufferManager.get(); }

Friends And Related Function Documentation

◆ Recorder

friend class Recorder
friend

Definition at line 103 of file RecorderPriv.h.


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