diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrContext.h | 9 | ||||
-rw-r--r-- | include/gpu/GrProcessorUnitTest.h | 13 | ||||
-rw-r--r-- | include/private/GrSurfaceProxy.h | 20 |
3 files changed, 38 insertions, 4 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 7e8d4e8ad7..4fe3e72b5f 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -430,10 +430,11 @@ private: * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. Otherwise, they * return NULL. They also can perform a swizzle as part of the draw. */ - sk_sp<GrFragmentProcessor> createPMToUPMEffect(GrTexture*, const GrSwizzle&, - const SkMatrix&) const; - sk_sp<GrFragmentProcessor> createUPMToPMEffect(GrTexture*, const GrSwizzle&, - const SkMatrix&) const; + sk_sp<GrFragmentProcessor> createPMToUPMEffect(GrTexture*, const GrSwizzle&, const SkMatrix&); + sk_sp<GrFragmentProcessor> createPMToUPMEffect(sk_sp<GrTextureProxy>, const GrSwizzle&, + const SkMatrix&); + sk_sp<GrFragmentProcessor> createUPMToPMEffect(sk_sp<GrTextureProxy>, const GrSwizzle&, + const SkMatrix&); /** Called before either of the above two functions to determine the appropriate fragment processors for conversions. */ void testPMConversionsIfNecessary(uint32_t flags); diff --git a/include/gpu/GrProcessorUnitTest.h b/include/gpu/GrProcessorUnitTest.h index 0826e3d653..49f26fdb9b 100644 --- a/include/gpu/GrProcessorUnitTest.h +++ b/include/gpu/GrProcessorUnitTest.h @@ -8,6 +8,7 @@ #ifndef GrProcessorUnitTest_DEFINED #define GrProcessorUnitTest_DEFINED +#include "../private/GrTextureProxy.h" #include "../private/SkTArray.h" #include "GrTestUtils.h" #include "SkTypes.h" @@ -53,12 +54,24 @@ struct GrProcessorTestData { , fRenderTargetContext(renderTargetContext) { fTextures[0] = textures[0]; fTextures[1] = textures[1]; + + fProxies[0] = GrSurfaceProxy::MakeWrapped(sk_ref_sp(textures[0])); + fProxies[1] = GrSurfaceProxy::MakeWrapped(sk_ref_sp(textures[1])); } SkRandom* fRandom; GrContext* fContext; const GrCaps* fCaps; const GrRenderTargetContext* fRenderTargetContext; GrTexture* fTextures[2]; + + GrContext* context() { return fContext; } + GrTexture* texture(int index) { return fTextures[index]; } + sk_sp<GrTextureProxy> textureProxy(int index) { + return sk_ref_sp(fProxies[index]->asTextureProxy()); + } + +private: + sk_sp<GrSurfaceProxy> fProxies[2]; }; #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index 9363b8280b..6f2a751239 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -17,6 +17,7 @@ class GrCaps; class GrRenderTargetOpList; class GrRenderTargetProxy; class GrSurfaceContext; +class GrSurfaceProxyPriv; class GrTextureOpList; class GrTextureProvider; class GrTextureProxy; @@ -98,6 +99,14 @@ protected: fPendingWrites = 0; } + bool internalHasPendingIO() const { + if (fTarget) { + return fTarget->internalHasPendingIO(); + } + + return SkToBool(fPendingWrites | fPendingReads); + } + // For deferred proxies this will be null. For wrapped proxies it will point to the // wrapped resource. GrSurface* fTarget; @@ -285,6 +294,10 @@ public: SkDEBUGCODE(void validate(GrContext*) const;) + // Provides access to functions that aren't part of the public API. + GrSurfaceProxyPriv priv(); + const GrSurfaceProxyPriv priv() const; + protected: // Deferred version GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted) @@ -301,6 +314,13 @@ protected: virtual ~GrSurfaceProxy(); + friend class GrSurfaceProxyPriv; + + // Methods made available via GrSurfaceProxyPriv + bool hasPendingIO() const { + return this->internalHasPendingIO(); + } + // For wrapped resources, 'fDesc' will always be filled in from the wrapped resource. const GrSurfaceDesc fDesc; const SkBackingFit fFit; // always exact for wrapped resources |