aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-25 15:48:30 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-25 21:23:28 +0000
commit757914d26b337b04cf270875bce28d7d1e2407de (patch)
tree7c47dffdcbc62d476cdbacbc34b7bfb24410fcaf /include
parentb2cd1d7b442b689ff74409029defbf505c044b2c (diff)
Switch GrConfigConversionEffect over to taking GrTextureProxies
Change-Id: Ic8be773e210e1ac05dcb9aad6c89dcd63e9e4ba2 Reviewed-on: https://skia-review.googlesource.com/7521 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrContext.h9
-rw-r--r--include/gpu/GrProcessorUnitTest.h13
-rw-r--r--include/private/GrSurfaceProxy.h20
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