namespace skgpu { enumclass BackendApi : unsignedint; class RefCntedCallback; class TokenTracker;
}
namespace sktext::gpu { class StrikeCache; class TextBlobRedrawCoordinator;
}
namespace skgpu::graphite {
class AtlasProvider; class BackendTexture; class Context; class Device; class DrawBufferManager; class FloatStorageManager; class ImageProvider; class PaintParamsKeyBuilder; class PipelineDataGatherer; class ProxyReadCountMap; class RecorderPriv; class ResourceProvider; class RuntimeEffectDictionary; class SharedContext; class TaskList; class TextureInfo; class UploadBufferManager; class UploadList;
struct RecorderOptionsPriv;
using KeyAndDataBuilder = std::pair<PipelineDataGatherer, PaintParamsKeyBuilder>;
struct SK_API RecorderOptions final {
RecorderOptions();
RecorderOptions(const RecorderOptions&);
~RecorderOptions();
sk_sp<ImageProvider> fImageProvider;
static constexpr size_t kDefaultRecorderBudget = 256 * (1 << 20); // What is the budget for GPU resources allocated and held by this Recorder.
size_t fGpuBudgetInBytes = kDefaultRecorderBudget; // If Recordings are known to be played back in the order they are recorded, then Graphite // may be able to make certain assumptions that improve performance. This is often the case // if the content being drawn triggers the use of internal atlasing in Graphite (e.g. text).
std::optional<bool> fRequireOrderedRecordings;
// Private options that are only meant for testing within Skia's tools.
RecorderOptionsPriv* fRecorderOptionsPriv = nullptr;
};
class SK_API Recorder final : public SkRecorder { public:
Recorder(const Recorder&) = delete;
Recorder(Recorder&&) = delete;
Recorder& operator=(const Recorder&) = delete;
Recorder& operator=(Recorder&&) = delete;
// Adds a proc that will be moved to the Recording upon snap, subsequently attached to the // CommandBuffer when the Recording is added, and called when that CommandBuffer is submitted // and finishes. If the Recorder or Recording is deleted before the proc is added to the // CommandBuffer, it will be called with result Failure. void addFinishInfo(const InsertFinishInfo&);
// Returns a canvas that will record to a proxy surface, which must be instantiated on replay. // This can only be called once per Recording; subsequent calls will return null until a // Recording is snapped. Additionally, the returned SkCanvas is only valid until the next // Recording snap, at which point it is deleted.
SkCanvas* makeDeferredCanvas(const SkImageInfo&, const TextureInfo&);
// Provides access to functions that aren't part of the public API.
RecorderPriv priv(); const RecorderPriv priv() const; // NOLINT(readability-const-return-type)
private: static constexpr int kMaxKeyAndDataBuilders = 2;
friendclass Context; // For ctor friendclass Device; // For registering and deregistering Devices; friendclass RecorderPriv; // for ctor and hidden methods
// If Context is non-null, the Recorder will use the Context's resource provider // instead of creating its own.
Recorder(sk_sp<SharedContext>, const RecorderOptions&, const Context*);
// We keep track of all Devices that are connected to a Recorder. This allows the client to // safely delete an SkSurface or a Recorder in any order. If the client deletes the Recorder // we need to notify all Devices that the Recorder is no longer valid. If we delete the // SkSurface/Device first we will flush all the Device's into the Recorder before deregistering // it from the Recorder. // // We take a ref on the Device so that ~Device() does not have to deregister the recorder // (which can happen on any thread if the Device outlives the Surface via an Image view). // Recorder::flushTrackedDevices() cleans up uniquely held and immutable Devices on the recorder // thread so this extra ref is not significantly increasing the Device lifetime. // // Note: We could probably get by with only registering Devices directly connected to // SkSurfaces. All other one off Devices will be created in a controlled scope where the // Recorder should still be valid by the time they need to flush their work when the Device is // deleted. We would have to make sure we safely handle cases where a client calls saveLayer // then either deletes the SkSurface or Recorder before calling restore. For simplicity we just // register every device for now, but if we see extra overhead in pushing back the extra // pointers, we can look into only registering SkSurface Devices. void registerDevice(sk_sp<Device>); void deregisterDevice(const Device*);
sk_sp<SharedContext> fSharedContext;
ResourceProvider* fResourceProvider; // May point to the Context's resource provider
std::unique_ptr<ResourceProvider> fOwnedResourceProvider; // May be null
// NOTE: These are stored by pointer to allow them to be forward declared.
std::unique_ptr<TaskList> fRootTaskList; // Aggregated one-time uploads that precede all tasks in the root task list.
std::unique_ptr<UploadList> fRootUploads;
// Iterating over tracked devices in flushTrackedDevices() needs to be re-entrant and support // additions to fTrackedDevices if registerDevice() is triggered by a temporary device during // flushing. Removals are handled by setting elements to null; final clean up is handled at the // end of the initial call to flushTrackedDevices().
skia_private::TArray<sk_sp<Device>> fTrackedDevices; int fFlushingDevicesIndex = -1;
uint32_t fUniqueID; // Needed for MessageBox handling for text
uint32_t fNextRecordingID = 1; constbool fRequireOrderedRecordings;
// In debug builds we guard against improper thread handling // This guard is passed to the ResourceCache. // TODO: Should we also pass this to Device, DrawContext, and similar classes? mutable SingleOwner fSingleOwner;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.