2011-07-28 14:26:00 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2010 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2011-02-22 20:59:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrContext_DEFINED
|
|
|
|
#define GrContext_DEFINED
|
|
|
|
|
2015-11-11 21:18:11 +00:00
|
|
|
#include "GrCaps.h"
|
2013-09-18 13:00:55 +00:00
|
|
|
#include "GrColor.h"
|
|
|
|
#include "SkMatrix.h"
|
2014-06-12 17:24:21 +00:00
|
|
|
#include "SkPathEffect.h"
|
2013-09-18 13:00:55 +00:00
|
|
|
#include "SkTypes.h"
|
2016-01-08 15:19:47 +00:00
|
|
|
#include "../private/GrAuditTrail.h"
|
2016-01-06 16:26:09 +00:00
|
|
|
#include "../private/GrSingleOwner.h"
|
2011-02-22 20:59:41 +00:00
|
|
|
|
2016-12-16 19:24:34 +00:00
|
|
|
class GrAtlasGlyphCache;
|
2015-05-22 21:01:46 +00:00
|
|
|
struct GrContextOptions;
|
2016-08-03 21:26:53 +00:00
|
|
|
class GrContextPriv;
|
2016-03-11 14:46:33 +00:00
|
|
|
class GrContextThreadSafeProxy;
|
2015-10-17 14:43:27 +00:00
|
|
|
class GrDrawingManager;
|
2016-12-16 23:59:19 +00:00
|
|
|
struct GrDrawOpAtlasConfig;
|
2016-10-27 18:47:55 +00:00
|
|
|
class GrRenderTargetContext;
|
2014-09-23 16:50:21 +00:00
|
|
|
class GrFragmentProcessor;
|
2011-05-02 21:14:59 +00:00
|
|
|
class GrGpu;
|
2011-08-17 13:42:46 +00:00
|
|
|
class GrIndexBuffer;
|
2013-03-22 18:34:09 +00:00
|
|
|
class GrOvalRenderer;
|
2013-11-01 15:23:44 +00:00
|
|
|
class GrPath;
|
2015-01-22 18:16:09 +00:00
|
|
|
class GrPipelineBuilder;
|
2011-07-26 20:45:30 +00:00
|
|
|
class GrResourceEntry;
|
2015-02-11 18:49:59 +00:00
|
|
|
class GrResourceCache;
|
2015-04-30 21:18:54 +00:00
|
|
|
class GrResourceProvider;
|
2017-03-09 03:21:00 +00:00
|
|
|
class GrSamplerParams;
|
2017-03-30 12:02:11 +00:00
|
|
|
class GrSurfaceProxy;
|
2015-04-08 16:08:31 +00:00
|
|
|
class GrTextBlobCache;
|
2014-06-24 07:12:27 +00:00
|
|
|
class GrTextContext;
|
2017-03-09 03:21:00 +00:00
|
|
|
class GrTextureProxy;
|
2011-08-17 13:42:46 +00:00
|
|
|
class GrVertexBuffer;
|
2016-01-22 15:17:34 +00:00
|
|
|
class GrSwizzle;
|
2015-09-15 21:16:10 +00:00
|
|
|
class SkTraceMemoryDump;
|
2011-07-26 20:45:30 +00:00
|
|
|
|
2017-03-09 03:21:00 +00:00
|
|
|
class SkImage;
|
|
|
|
class SkSurfaceProps;
|
|
|
|
|
2013-09-09 13:38:37 +00:00
|
|
|
class SK_API GrContext : public SkRefCnt {
|
2011-02-22 20:59:41 +00:00
|
|
|
public:
|
|
|
|
/**
|
2012-10-25 18:43:28 +00:00
|
|
|
* Creates a GrContext for a backend context.
|
2011-02-22 20:59:41 +00:00
|
|
|
*/
|
2015-05-22 21:01:46 +00:00
|
|
|
static GrContext* Create(GrBackend, GrBackendContext, const GrContextOptions& options);
|
|
|
|
static GrContext* Create(GrBackend, GrBackendContext);
|
2011-02-22 20:59:41 +00:00
|
|
|
|
|
|
|
virtual ~GrContext();
|
|
|
|
|
2016-10-27 16:30:08 +00:00
|
|
|
sk_sp<GrContextThreadSafeProxy> threadSafeProxy();
|
2016-03-11 14:46:33 +00:00
|
|
|
|
2011-02-22 20:59:41 +00:00
|
|
|
/**
|
|
|
|
* The GrContext normally assumes that no outsider is setting state
|
|
|
|
* within the underlying 3D API's context/device/whatever. This call informs
|
|
|
|
* the context that the state was modified and it should resend. Shouldn't
|
|
|
|
* be called frequently for good performance.
|
2013-06-28 18:57:35 +00:00
|
|
|
* The flag bits, state, is dpendent on which backend is used by the
|
|
|
|
* context, either GL or D3D (possible in future).
|
2011-02-22 20:59:41 +00:00
|
|
|
*/
|
2013-06-28 18:57:35 +00:00
|
|
|
void resetContext(uint32_t state = kAll_GrBackendState);
|
2011-02-22 20:59:41 +00:00
|
|
|
|
2012-09-24 19:33:59 +00:00
|
|
|
/**
|
|
|
|
* Callback function to allow classes to cleanup on GrContext destruction.
|
|
|
|
* The 'info' field is filled in with the 'info' passed to addCleanUp.
|
|
|
|
*/
|
|
|
|
typedef void (*PFCleanUpFunc)(const GrContext* context, void* info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a function to be called from within GrContext's destructor.
|
|
|
|
* This gives classes a chance to free resources held on a per context basis.
|
|
|
|
* The 'info' parameter will be stored and passed to the callback function.
|
|
|
|
*/
|
|
|
|
void addCleanUp(PFCleanUpFunc cleanUp, void* info) {
|
|
|
|
CleanUpData* entry = fCleanUpData.push();
|
|
|
|
|
|
|
|
entry->fFunc = cleanUp;
|
|
|
|
entry->fInfo = info;
|
|
|
|
}
|
|
|
|
|
2011-03-30 21:26:44 +00:00
|
|
|
/**
|
2016-04-01 18:54:31 +00:00
|
|
|
* Abandons all GPU resources and assumes the underlying backend 3D API context is not longer
|
|
|
|
* usable. Call this if you have lost the associated GPU context, and thus internal texture,
|
|
|
|
* buffer, etc. references/IDs are now invalid. Calling this ensures that the destructors of the
|
|
|
|
* GrContext and any of its created resource objects will not make backend 3D API calls. Content
|
|
|
|
* rendered but not previously flushed may be lost. After this function is called all subsequent
|
|
|
|
* calls on the GrContext will fail or be no-ops.
|
|
|
|
*
|
|
|
|
* The typical use case for this function is that the underlying 3D context was lost and further
|
|
|
|
* API calls may crash.
|
2011-03-30 21:26:44 +00:00
|
|
|
*/
|
2014-07-28 20:48:36 +00:00
|
|
|
void abandonContext();
|
2011-06-08 22:55:10 +00:00
|
|
|
|
2016-04-01 18:54:31 +00:00
|
|
|
/**
|
|
|
|
* This is similar to abandonContext() however the underlying 3D context is not yet lost and
|
|
|
|
* the GrContext will cleanup all allocated resources before returning. After returning it will
|
|
|
|
* assume that the underlying context may no longer be valid.
|
|
|
|
*
|
|
|
|
* The typical use case for this function is that the client is going to destroy the 3D context
|
|
|
|
* but can't guarantee that GrContext will be destroyed first (perhaps because it may be ref'ed
|
|
|
|
* elsewhere by either the client or Skia objects).
|
|
|
|
*/
|
|
|
|
void releaseResourcesAndAbandonContext();
|
|
|
|
|
2014-05-09 14:29:32 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// Resource Cache
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the current GPU resource cache limits.
|
|
|
|
*
|
|
|
|
* @param maxResources If non-null, returns maximum number of resources that
|
|
|
|
* can be held in the cache.
|
|
|
|
* @param maxResourceBytes If non-null, returns maximum number of bytes of
|
|
|
|
* video memory that can be held in the cache.
|
|
|
|
*/
|
|
|
|
void getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the current GPU resource cache usage.
|
|
|
|
*
|
|
|
|
* @param resourceCount If non-null, returns the number of resources that are held in the
|
|
|
|
* cache.
|
|
|
|
* @param maxResourceBytes If non-null, returns the total number of bytes of video memory held
|
|
|
|
* in the cache.
|
|
|
|
*/
|
|
|
|
void getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const;
|
|
|
|
|
2017-05-24 15:41:33 +00:00
|
|
|
/**
|
|
|
|
* Gets the number of bytes in the cache consumed by purgeable (e.g. unlocked) resources.
|
|
|
|
*/
|
|
|
|
size_t getResourceCachePurgeableBytes() const;
|
|
|
|
|
2014-05-09 14:29:32 +00:00
|
|
|
/**
|
|
|
|
* Specify the GPU resource cache limits. If the current cache exceeds either
|
|
|
|
* of these, it will be purged (LRU) to keep the cache within these limits.
|
|
|
|
*
|
|
|
|
* @param maxResources The maximum number of resources that can be held in
|
|
|
|
* the cache.
|
|
|
|
* @param maxResourceBytes The maximum number of bytes of video memory
|
|
|
|
* that can be held in the cache.
|
|
|
|
*/
|
|
|
|
void setResourceCacheLimits(int maxResources, size_t maxResourceBytes);
|
|
|
|
|
2011-02-22 20:59:41 +00:00
|
|
|
/**
|
2012-10-15 14:25:31 +00:00
|
|
|
* Frees GPU created by the context. Can be called to reduce GPU memory
|
2011-03-30 21:26:44 +00:00
|
|
|
* pressure.
|
2011-02-22 20:59:41 +00:00
|
|
|
*/
|
2011-03-30 21:26:44 +00:00
|
|
|
void freeGpuResources();
|
|
|
|
|
2014-05-09 14:29:32 +00:00
|
|
|
/**
|
|
|
|
* Purge all the unlocked resources from the cache.
|
|
|
|
* This entry point is mainly meant for timing texture uploads
|
|
|
|
* and is not defined in normal builds of Skia.
|
|
|
|
*/
|
|
|
|
void purgeAllUnlockedResources();
|
|
|
|
|
2017-03-22 18:53:13 +00:00
|
|
|
/**
|
|
|
|
* Purge GPU resources that haven't been used in the past 'ms' milliseconds, regardless of
|
|
|
|
* whether the context is currently under budget.
|
|
|
|
*/
|
|
|
|
void purgeResourcesNotUsedInMs(std::chrono::milliseconds ms);
|
|
|
|
|
2017-05-25 20:43:59 +00:00
|
|
|
/**
|
|
|
|
* Purge unlocked resources from the cache until the the provided byte count has been reached
|
|
|
|
* or we have purged all unlocked resources. The default policy is to purge in LRU order, but
|
|
|
|
* can be overridden to prefer purging scratch resources (in LRU order) prior to purging other
|
|
|
|
* resource types.
|
|
|
|
*
|
|
|
|
* @param maxBytesToPurge the desired number of bytes to be purged.
|
|
|
|
* @param preferScratchResources If true scratch resources will be purged prior to other
|
|
|
|
* resource types.
|
|
|
|
*/
|
|
|
|
void purgeUnlockedResources(size_t bytesToPurge, bool preferScratchResources);
|
|
|
|
|
2015-05-29 15:02:10 +00:00
|
|
|
/** Access the context capabilities */
|
|
|
|
const GrCaps* caps() const { return fCaps; }
|
2013-03-19 13:58:55 +00:00
|
|
|
|
2014-03-10 07:40:03 +00:00
|
|
|
/**
|
|
|
|
* Returns the recommended sample count for a render target when using this
|
|
|
|
* context.
|
|
|
|
*
|
|
|
|
* @param config the configuration of the render target.
|
|
|
|
* @param dpi the display density in dots per inch.
|
|
|
|
*
|
|
|
|
* @return sample count that should be perform well and have good enough
|
|
|
|
* rendering quality for the display. Alternatively returns 0 if
|
|
|
|
* MSAA is not supported or recommended to be used by default.
|
|
|
|
*/
|
|
|
|
int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const;
|
|
|
|
|
2017-04-24 14:57:28 +00:00
|
|
|
/*
|
|
|
|
* 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.
|
2016-04-28 16:55:15 +00:00
|
|
|
*/
|
2017-04-21 12:28:48 +00:00
|
|
|
sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContext(
|
2017-04-24 14:57:28 +00:00
|
|
|
SkBackingFit fit,
|
2017-04-21 12:28:48 +00:00
|
|
|
int width, int height,
|
|
|
|
GrPixelConfig config,
|
|
|
|
sk_sp<SkColorSpace> colorSpace,
|
|
|
|
int sampleCnt = 0,
|
|
|
|
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
|
|
|
|
const SkSurfaceProps* surfaceProps = nullptr,
|
|
|
|
SkBudgeted = SkBudgeted::kYes);
|
2016-09-06 12:20:20 +00:00
|
|
|
/*
|
2016-10-27 18:47:55 +00:00
|
|
|
* This method will attempt to create a renderTargetContext that has, at least, the number of
|
2016-09-06 12:20:20 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
2016-11-21 19:05:03 +00:00
|
|
|
sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
|
|
|
|
SkBackingFit fit,
|
|
|
|
int width, int height,
|
|
|
|
GrPixelConfig config,
|
|
|
|
sk_sp<SkColorSpace> colorSpace,
|
|
|
|
int sampleCnt = 0,
|
2017-01-30 13:06:27 +00:00
|
|
|
GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
|
2016-09-06 12:20:20 +00:00
|
|
|
const SkSurfaceProps* surfaceProps = nullptr,
|
|
|
|
SkBudgeted budgeted = SkBudgeted::kYes);
|
|
|
|
|
2011-02-22 20:59:41 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// Misc.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call to ensure all drawing to the context has been issued to the
|
|
|
|
* underlying 3D API.
|
|
|
|
*/
|
2016-09-07 17:02:04 +00:00
|
|
|
void flush();
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2015-05-07 15:23:19 +00:00
|
|
|
/**
|
|
|
|
* An ID associated with this context, guaranteed to be unique.
|
|
|
|
*/
|
|
|
|
uint32_t uniqueID() { return fUniqueID; }
|
|
|
|
|
2011-02-22 20:59:41 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// Functions intended for internal use only.
|
|
|
|
GrGpu* getGpu() { return fGpu; }
|
2011-08-23 20:54:07 +00:00
|
|
|
const GrGpu* getGpu() const { return fGpu; }
|
2016-12-16 19:24:34 +00:00
|
|
|
GrAtlasGlyphCache* getAtlasGlyphCache() { return fAtlasGlyphCache; }
|
2016-10-27 16:30:08 +00:00
|
|
|
GrTextBlobCache* getTextBlobCache() { return fTextBlobCache.get(); }
|
2015-10-17 14:43:27 +00:00
|
|
|
bool abandoned() const;
|
2015-04-30 21:18:54 +00:00
|
|
|
GrResourceProvider* resourceProvider() { return fResourceProvider; }
|
|
|
|
const GrResourceProvider* resourceProvider() const { return fResourceProvider; }
|
2015-02-11 18:49:59 +00:00
|
|
|
GrResourceCache* getResourceCache() { return fResourceCache; }
|
2012-06-06 18:21:18 +00:00
|
|
|
|
2015-12-02 17:05:37 +00:00
|
|
|
/** Reset GPU stats */
|
|
|
|
void resetGpuStats() const ;
|
|
|
|
|
2015-02-03 02:26:03 +00:00
|
|
|
/** Prints cache stats to the string if GR_CACHE_STATS == 1. */
|
|
|
|
void dumpCacheStats(SkString*) const;
|
2015-12-02 22:08:25 +00:00
|
|
|
void dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) const;
|
2012-08-22 10:57:05 +00:00
|
|
|
void printCacheStats() const;
|
2014-09-18 20:52:08 +00:00
|
|
|
|
2015-02-03 02:26:03 +00:00
|
|
|
/** Prints GPU stats to the string if GR_GPU_STATS == 1. */
|
|
|
|
void dumpGpuStats(SkString*) const;
|
2015-12-02 22:08:25 +00:00
|
|
|
void dumpGpuStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) const;
|
2015-02-03 02:26:03 +00:00
|
|
|
void printGpuStats() const;
|
2014-09-18 20:52:08 +00:00
|
|
|
|
2015-08-03 17:17:44 +00:00
|
|
|
/** Specify the TextBlob cache limit. If the current cache exceeds this limit it will purge.
|
|
|
|
this is for testing only */
|
|
|
|
void setTextBlobCacheLimit_ForTesting(size_t bytes);
|
|
|
|
|
2015-08-19 15:16:43 +00:00
|
|
|
/** Specify the sizes of the GrAtlasTextContext atlases. The configs pointer below should be
|
|
|
|
to an array of 3 entries */
|
2016-12-16 23:59:19 +00:00
|
|
|
void setTextContextAtlasSizes_ForTesting(const GrDrawOpAtlasConfig* configs);
|
2015-08-19 15:16:43 +00:00
|
|
|
|
2015-09-15 21:16:10 +00:00
|
|
|
/** Enumerates all cached GPU resources and dumps their memory to traceMemoryDump. */
|
|
|
|
void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
|
|
|
|
|
2016-12-20 16:05:30 +00:00
|
|
|
/** Get pointer to atlas texture for given mask format. Note that this wraps an
|
|
|
|
actively mutating texture in an SkImage. This could yield unexpected results
|
|
|
|
if it gets cached or used more generally. */
|
2017-01-20 15:03:25 +00:00
|
|
|
sk_sp<SkImage> getFontAtlasImage_ForTesting(GrMaskFormat format);
|
2015-11-08 16:07:24 +00:00
|
|
|
|
2016-01-11 18:39:11 +00:00
|
|
|
GrAuditTrail* getAuditTrail() { return &fAuditTrail; }
|
2016-01-08 15:19:47 +00:00
|
|
|
|
2016-01-11 21:29:31 +00:00
|
|
|
/** This is only useful for debug purposes */
|
|
|
|
SkDEBUGCODE(GrSingleOwner* debugSingleOwner() const { return &fSingleOwner; } )
|
|
|
|
|
2016-08-03 21:26:53 +00:00
|
|
|
// Provides access to functions that aren't part of the public API.
|
|
|
|
GrContextPriv contextPriv();
|
|
|
|
const GrContextPriv contextPriv() const;
|
|
|
|
|
2011-02-22 20:59:41 +00:00
|
|
|
private:
|
2016-03-11 14:46:33 +00:00
|
|
|
GrGpu* fGpu;
|
|
|
|
const GrCaps* fCaps;
|
|
|
|
GrResourceCache* fResourceCache;
|
2017-03-04 13:12:46 +00:00
|
|
|
GrResourceProvider* fResourceProvider;
|
2015-04-30 21:18:54 +00:00
|
|
|
|
2016-10-27 16:30:08 +00:00
|
|
|
sk_sp<GrContextThreadSafeProxy> fThreadSafeProxy;
|
2016-03-11 14:46:33 +00:00
|
|
|
|
2016-12-16 19:24:34 +00:00
|
|
|
GrAtlasGlyphCache* fAtlasGlyphCache;
|
2016-10-27 16:30:08 +00:00
|
|
|
std::unique_ptr<GrTextBlobCache> fTextBlobCache;
|
2011-03-25 12:31:16 +00:00
|
|
|
|
2017-02-14 19:15:48 +00:00
|
|
|
bool fDisableGpuYUVConversion;
|
2016-03-11 14:46:33 +00:00
|
|
|
bool fDidTestPMConversions;
|
2017-04-20 14:24:36 +00:00
|
|
|
// true if the PM/UPM conversion succeeded; false otherwise
|
|
|
|
bool fPMUPMConversionsRoundTrip;
|
2012-08-27 12:53:13 +00:00
|
|
|
|
2016-01-06 16:26:09 +00:00
|
|
|
// In debug builds we guard against improper thread handling
|
2016-01-08 18:09:13 +00:00
|
|
|
// This guard is passed to the GrDrawingManager and, from there to all the
|
2017-03-04 13:12:46 +00:00
|
|
|
// GrRenderTargetContexts. It is also passed to the GrResourceProvider and SkGpuDevice.
|
2016-03-11 14:46:33 +00:00
|
|
|
mutable GrSingleOwner fSingleOwner;
|
2016-01-06 16:26:09 +00:00
|
|
|
|
2012-09-24 19:33:59 +00:00
|
|
|
struct CleanUpData {
|
|
|
|
PFCleanUpFunc fFunc;
|
|
|
|
void* fInfo;
|
|
|
|
};
|
|
|
|
|
2016-03-11 14:46:33 +00:00
|
|
|
SkTDArray<CleanUpData> fCleanUpData;
|
2013-07-25 15:32:06 +00:00
|
|
|
|
2016-03-11 14:46:33 +00:00
|
|
|
const uint32_t fUniqueID;
|
2014-08-12 14:26:25 +00:00
|
|
|
|
2016-10-27 16:30:08 +00:00
|
|
|
std::unique_ptr<GrDrawingManager> fDrawingManager;
|
2015-10-17 14:43:27 +00:00
|
|
|
|
2016-03-11 14:46:33 +00:00
|
|
|
GrAuditTrail fAuditTrail;
|
2016-01-08 15:19:47 +00:00
|
|
|
|
2017-04-13 13:54:12 +00:00
|
|
|
GrBackend fBackend;
|
|
|
|
|
2016-10-27 18:47:55 +00:00
|
|
|
// TODO: have the GrClipStackClip use renderTargetContexts and rm this friending
|
2016-08-03 21:26:53 +00:00
|
|
|
friend class GrContextPriv;
|
2016-08-06 05:32:12 +00:00
|
|
|
|
2015-05-22 21:01:46 +00:00
|
|
|
GrContext(); // init must be called after the constructor.
|
|
|
|
bool init(GrBackend, GrBackendContext, const GrContextOptions& options);
|
2015-05-26 18:38:03 +00:00
|
|
|
|
2013-01-29 07:05:52 +00:00
|
|
|
/**
|
2017-04-17 15:48:28 +00:00
|
|
|
* These functions create premul <-> unpremul effects. If the second argument is 'true', they
|
|
|
|
* use the specialized round-trip effects from GrConfigConversionEffect, otherwise they
|
|
|
|
* create effects that do naive multiply or divide.
|
2013-01-28 14:26:09 +00:00
|
|
|
*/
|
2017-04-17 15:48:28 +00:00
|
|
|
sk_sp<GrFragmentProcessor> createPMToUPMEffect(sk_sp<GrFragmentProcessor>,
|
|
|
|
bool useConfigConversionEffect);
|
|
|
|
sk_sp<GrFragmentProcessor> createUPMToPMEffect(sk_sp<GrFragmentProcessor>,
|
|
|
|
bool useConfigConversionEffect);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if createPMtoUPMEffect and createUPMToPMEffect will succeed for non-sRGB 8888
|
|
|
|
* configs. In other words, did we find a pair of round-trip preserving conversion effects?
|
|
|
|
*/
|
|
|
|
bool validPMUPMConversionExists();
|
2012-08-27 12:53:13 +00:00
|
|
|
|
2015-04-10 14:01:30 +00:00
|
|
|
/**
|
|
|
|
* A callback similar to the above for use by the TextBlobCache
|
|
|
|
* TODO move textblob draw calls below context so we can use the call above.
|
|
|
|
*/
|
|
|
|
static void TextBlobCacheOverBudgetCB(void* data);
|
|
|
|
|
2013-09-09 13:38:37 +00:00
|
|
|
typedef SkRefCnt INHERITED;
|
2011-02-22 20:59:41 +00:00
|
|
|
};
|
|
|
|
|
2016-03-11 14:46:33 +00:00
|
|
|
/**
|
|
|
|
* Can be used to perform actions related to the generating GrContext in a thread safe manner. The
|
|
|
|
* proxy does not access the 3D API (e.g. OpenGL) that backs the generating GrContext.
|
|
|
|
*/
|
|
|
|
class GrContextThreadSafeProxy : public SkRefCnt {
|
|
|
|
private:
|
2016-10-27 16:30:08 +00:00
|
|
|
GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t uniqueID)
|
|
|
|
: fCaps(std::move(caps))
|
2016-03-11 14:46:33 +00:00
|
|
|
, fContextUniqueID(uniqueID) {}
|
|
|
|
|
2016-10-27 16:30:08 +00:00
|
|
|
sk_sp<const GrCaps> fCaps;
|
|
|
|
uint32_t fContextUniqueID;
|
2016-03-11 14:46:33 +00:00
|
|
|
|
|
|
|
friend class GrContext;
|
|
|
|
friend class SkImage;
|
|
|
|
|
|
|
|
typedef SkRefCnt INHERITED;
|
|
|
|
};
|
|
|
|
|
2011-02-22 20:59:41 +00:00
|
|
|
#endif
|