Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | List of all members
skgpu::graphite::StaticBufferManager Class Reference

#include <BufferManager.h>

Public Types

enum class  FinishResult : int { kFailure , kSuccess , kNoWork }
 

Public Member Functions

 StaticBufferManager (ResourceProvider *, const Caps *)
 
 ~StaticBufferManager ()
 
VertexWriter getVertexWriter (size_t size, BindBufferInfo *binding)
 
VertexWriter getIndexWriter (size_t size, BindBufferInfo *binding)
 
FinishResult finalize (Context *, QueueManager *, GlobalCache *)
 

Detailed Description

The StaticBufferManager is the one-time-only analog to DrawBufferManager and provides "static" Buffers to RenderSteps and other Context-lifetime-tied objects, where the Buffers' contents will not change and can benefit from prioritizing GPU reads. The assumed use case is that they remain read-only on the GPU as well, so a single static buffer can be shared by all Recorders.

Unlike DrawBufferManager's getXWriter() functions that return both a Writer and a BindBufferInfo, StaticBufferManager returns only a Writer and accepts a BindBufferInfo* as an argument. This will be re-written with the final binding info for the GPU-private data once that can be determined after all static buffers have been requested.

Definition at line 228 of file BufferManager.h.

Member Enumeration Documentation

◆ FinishResult

Enumerator
kFailure 
kSuccess 
kNoWork 

Definition at line 241 of file BufferManager.h.

241 : int {
242 kFailure, // Unable to create or copy static buffers
243 kSuccess, // Successfully created static buffers and added GPU tasks to the queue
244 kNoWork // No static buffers required, no GPU tasks add to the queue
245 };
@ kSuccess
Definition: embedder.h:73
@ kFailure
Failed to make the egl context for the surface current.

Constructor & Destructor Documentation

◆ StaticBufferManager()

skgpu::graphite::StaticBufferManager::StaticBufferManager ( ResourceProvider resourceProvider,
const Caps caps 
)

Definition at line 480 of file BufferManager.cpp.

482 : fResourceProvider(resourceProvider)
483 , fUploadManager(resourceProvider, caps)
484 , fRequiredTransferAlignment(caps->requiredTransferBufferAlignment())
485 , fVertexBufferInfo(BufferType::kVertex, caps)
486 , fIndexBufferInfo(BufferType::kIndex, caps) {}

◆ ~StaticBufferManager()

skgpu::graphite::StaticBufferManager::~StaticBufferManager ( )
default

Member Function Documentation

◆ finalize()

StaticBufferManager::FinishResult skgpu::graphite::StaticBufferManager::finalize ( Context context,
QueueManager queueManager,
GlobalCache globalCache 
)

Definition at line 577 of file BufferManager.cpp.

579 {
580 if (fMappingFailed) {
582 }
583
584 const size_t totalRequiredBytes = fVertexBufferInfo.fTotalRequiredBytes +
585 fIndexBufferInfo.fTotalRequiredBytes;
586 SkASSERT(totalRequiredBytes <= kMaxStaticDataSize);
587 if (!totalRequiredBytes) {
589 }
590
591 if (!fVertexBufferInfo.createAndUpdateBindings(fResourceProvider,
592 context,
593 queueManager,
594 globalCache,
595 "StaticVertexBuffer")) {
597 }
598 if (!fIndexBufferInfo.createAndUpdateBindings(fResourceProvider,
599 context,
600 queueManager,
601 globalCache,
602 "StaticIndexBuffer")) {
604 }
605 queueManager->addUploadBufferManagerRefs(&fUploadManager);
606
607 // Reset the static buffer manager since the Recording's copy tasks now manage ownership of
608 // the transfer buffers and the GlobalCache owns the final static buffers.
609 fVertexBufferInfo.reset();
610 fIndexBufferInfo.reset();
611
613}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ getIndexWriter()

VertexWriter skgpu::graphite::StaticBufferManager::getIndexWriter ( size_t  size,
BindBufferInfo binding 
)

Definition at line 499 of file BufferManager.cpp.

499 {
500 void* data = this->prepareStaticData(&fIndexBufferInfo, size, binding);
501 return VertexWriter{data, size};
502}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ getVertexWriter()

VertexWriter skgpu::graphite::StaticBufferManager::getVertexWriter ( size_t  size,
BindBufferInfo binding 
)

Definition at line 494 of file BufferManager.cpp.

494 {
495 void* data = this->prepareStaticData(&fVertexBufferInfo, size, binding);
496 return VertexWriter{data, size};
497}

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