6db27c28c6
Local Skia and DDL recording will always attempt to reduce opList splitting. Android, Flutter, Google3 and non-DDL Chrome will not. Note that this is a bit aggressive. Intermediate flushes based on memory usage have not yet been implemented. The plan is to run this locally in Skia until the next Chrome branch and then enable it everywhere else (when intermediate flushes have been implemented). OpList splitting reduction in Chrome is disabled in the following Chrome-side CL: https://chromium-review.googlesource.com/c/chromium/src/+/1588756/ (Disable opList splitting reduction in Skia) It is disabled in Android in: https://googleplex-android-review.git.corp.google.com/c/platform/external/skia/+/7259923 (Update #defines to suppress Ganesh features in SkUserConfigManual.h) It is disabled in Flutter and Google3 w/in this CL. Change-Id: I59ff448d2c42629fab6cffccb2894d030c73431d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211101 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
122 lines
5.2 KiB
C++
122 lines
5.2 KiB
C++
/*
|
|
* Copyright 2019 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef GrRecordingContext_DEFINED
|
|
#define GrRecordingContext_DEFINED
|
|
|
|
#include "include/core/SkRefCnt.h"
|
|
#include "include/private/GrAuditTrail.h"
|
|
#include "include/private/GrImageContext.h"
|
|
|
|
class GrDrawingManager;
|
|
class GrOnFlushCallbackObject;
|
|
class GrOpMemoryPool;
|
|
class GrRecordingContextPriv;
|
|
class GrStrikeCache;
|
|
class GrTextBlobCache;
|
|
|
|
class SK_API GrRecordingContext : public GrImageContext {
|
|
public:
|
|
~GrRecordingContext() override;
|
|
|
|
// Provides access to functions that aren't part of the public API.
|
|
GrRecordingContextPriv priv();
|
|
const GrRecordingContextPriv priv() const;
|
|
|
|
protected:
|
|
friend class GrRecordingContextPriv; // for hidden functions
|
|
|
|
GrRecordingContext(GrBackendApi, const GrContextOptions&, uint32_t contextID);
|
|
bool init(sk_sp<const GrCaps>, sk_sp<GrSkSLFPFactoryCache>) override;
|
|
void setupDrawingManager(bool sortOpLists, bool reduceOpListSplitting);
|
|
|
|
void abandonContext() override;
|
|
|
|
GrDrawingManager* drawingManager();
|
|
|
|
sk_sp<GrOpMemoryPool> refOpMemoryPool();
|
|
GrOpMemoryPool* opMemoryPool();
|
|
|
|
GrStrikeCache* getGrStrikeCache() { return fStrikeCache.get(); }
|
|
GrTextBlobCache* getTextBlobCache();
|
|
const GrTextBlobCache* getTextBlobCache() const;
|
|
|
|
/**
|
|
* Registers an object for flush-related callbacks. (See GrOnFlushCallbackObject.)
|
|
*
|
|
* NOTE: the drawing manager tracks this object as a raw pointer; it is up to the caller to
|
|
* ensure its lifetime is tied to that of the context.
|
|
*/
|
|
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
|
|
|
|
sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>,
|
|
sk_sp<SkColorSpace> = nullptr,
|
|
const SkSurfaceProps* = nullptr);
|
|
|
|
sk_sp<GrSurfaceContext> makeDeferredSurfaceContext(const GrBackendFormat&,
|
|
const GrSurfaceDesc&,
|
|
GrSurfaceOrigin,
|
|
GrMipMapped,
|
|
SkBackingFit,
|
|
SkBudgeted,
|
|
sk_sp<SkColorSpace> colorSpace = nullptr,
|
|
const SkSurfaceProps* = nullptr);
|
|
|
|
/*
|
|
* Create a new render target context backed by a deferred-style
|
|
* GrRenderTargetProxy. We guarantee that "asTextureProxy" will succeed for
|
|
* renderTargetContexts created via this entry point.
|
|
*/
|
|
sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContext(
|
|
const GrBackendFormat& format,
|
|
SkBackingFit fit,
|
|
int width, int height,
|
|
GrPixelConfig config,
|
|
sk_sp<SkColorSpace> colorSpace,
|
|
int sampleCnt = 1,
|
|
GrMipMapped = GrMipMapped::kNo,
|
|
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
|
|
const SkSurfaceProps* surfaceProps = nullptr,
|
|
SkBudgeted = SkBudgeted::kYes);
|
|
|
|
/*
|
|
* This method will attempt to create a renderTargetContext that has, at least, the number of
|
|
* channels and precision per channel as requested in 'config' (e.g., A8 and 888 can be
|
|
* converted to 8888). It may also swizzle the channels (e.g., BGRA -> RGBA).
|
|
* SRGB-ness will be preserved.
|
|
*/
|
|
sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
|
|
const GrBackendFormat& format,
|
|
SkBackingFit fit,
|
|
int width, int height,
|
|
GrPixelConfig config,
|
|
sk_sp<SkColorSpace> colorSpace,
|
|
int sampleCnt = 1,
|
|
GrMipMapped = GrMipMapped::kNo,
|
|
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
|
|
const SkSurfaceProps* surfaceProps = nullptr,
|
|
SkBudgeted budgeted = SkBudgeted::kYes);
|
|
|
|
GrAuditTrail* auditTrail() { return &fAuditTrail; }
|
|
|
|
GrRecordingContext* asRecordingContext() override { return this; }
|
|
|
|
private:
|
|
std::unique_ptr<GrDrawingManager> fDrawingManager;
|
|
// All the GrOp-derived classes use this pool.
|
|
sk_sp<GrOpMemoryPool> fOpMemoryPool;
|
|
|
|
std::unique_ptr<GrStrikeCache> fStrikeCache;
|
|
std::unique_ptr<GrTextBlobCache> fTextBlobCache;
|
|
|
|
GrAuditTrail fAuditTrail;
|
|
|
|
typedef GrImageContext INHERITED;
|
|
};
|
|
|
|
#endif
|