aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGreg Daniel <egdaniel@google.com>2018-11-14 15:28:10 +0000
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2018-11-14 15:28:15 +0000
commitd7157b2ccf53febde957a2c229e5f59fbd4f5cf2 (patch)
tree2dc4bdf616308735d37dbeecca87279b1082b1f2 /include
parent9341952756ce94f7ba2b1faab5bfc94b5a8d3839 (diff)
downloadskqp-d7157b2ccf53febde957a2c229e5f59fbd4f5cf2.tar.gz
Revert "Reland "Have a GrBackendFormat be stored on gpu proxies.""
This reverts commit 2f9a5ea639925f38785f4d3a0af237822007cfd6. Reason for revert: breaking fuchsia Original change's description: > Reland "Have a GrBackendFormat be stored on gpu proxies." > > This reverts commit 919c9e77c3492af766ff5982acda76ee49da3168. > > Reason for revert: Flutter change has landed and fixed memory issue. > > Original change's description: > > Revert "Have a GrBackendFormat be stored on gpu proxies." > > > > This reverts commit 51b1c12bbc2fa3f8d4faa29ad19c6f3cb34837ce. > > > > Reason for revert: reverting till flutter gets to 1.1 to fix build issues. > > > > Original change's description: > > > Have a GrBackendFormat be stored on gpu proxies. > > > > > > Bug: skia: > > > Change-Id: Iaf1fb24ab29a61d44e5fa59a5e0867ed02dcda90 > > > Reviewed-on: https://skia-review.googlesource.com/c/168021 > > > Reviewed-by: Brian Osman <brianosman@google.com> > > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > > > TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com > > > > Change-Id: I574fdc084ef5994596c51fb0d60423b5dc01b885 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: chromium:903701 chromium:903756 > > Reviewed-on: https://skia-review.googlesource.com/c/169835 > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > Reviewed-by: Greg Daniel <egdaniel@google.com> > > TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com > > Change-Id: Ifd9b6b8e194af9fb9258fa626644e76e6ecf090d > Bug: chromium:903701 chromium:903756 > Reviewed-on: https://skia-review.googlesource.com/c/170104 > Commit-Queue: Greg Daniel <egdaniel@google.com> > Reviewed-by: Greg Daniel <egdaniel@google.com> > Reviewed-by: Brian Osman <brianosman@google.com> TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com Change-Id: Ia0556355e5775b2100901b7bfa37f97bb6ccd90f No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:903701 chromium:903756 Reviewed-on: https://skia-review.googlesource.com/c/171002 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrBackendSurface.h12
-rw-r--r--include/gpu/GrSurface.h4
-rw-r--r--include/private/GrRenderTargetProxy.h8
-rw-r--r--include/private/GrSurfaceProxy.h20
-rw-r--r--include/private/GrTextureProxy.h18
5 files changed, 26 insertions, 36 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h
index 1de6fb0414..3f40ce2feb 100644
--- a/include/gpu/GrBackendSurface.h
+++ b/include/gpu/GrBackendSurface.h
@@ -61,8 +61,7 @@ public:
return GrBackendFormat(config);
}
- GrBackendApi backend() const { return fBackend; }
- GrTextureType textureType() const { return fTextureType; }
+ GrBackendApi backend() const {return fBackend; }
// If the backend API is GL, these return a pointer to the format and target. Otherwise
// it returns nullptr.
@@ -83,9 +82,6 @@ public:
// it returns nullptr.
const GrPixelConfig* getMockFormat() const;
- // If possible, copies the GrBackendFormat and forces the texture type to be Texture2D
- GrBackendFormat makeTexture2D() const;
-
// Returns true if the backend format has been initialized.
bool isValid() const { return fValid; }
@@ -104,14 +100,16 @@ private:
bool fValid;
union {
- GrGLenum fGLFormat; // the sized, internal format of the GL resource
+ struct {
+ GrGLenum fTarget; // GL_TEXTURE_2D, GL_TEXTURE_EXTERNAL or GL_TEXTURE_RECTANGLE
+ GrGLenum fFormat; // the sized, internal format of the GL resource
+ } fGL;
VkFormat fVkFormat;
#ifdef SK_METAL
GrMTLPixelFormat fMtlFormat;
#endif
GrPixelConfig fMockFormat;
};
- GrTextureType fTextureType;
};
class SK_API GrBackendTexture {
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index bcd854f11e..a93cacf501 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -9,7 +9,6 @@
#define GrSurface_DEFINED
#include "GrTypes.h"
-#include "GrBackendSurface.h"
#include "GrGpuResource.h"
#include "SkImageInfo.h"
#include "SkRect.h"
@@ -43,8 +42,6 @@ public:
*/
GrPixelConfig config() const { return fConfig; }
- virtual GrBackendFormat backendFormat() const = 0;
-
/**
* @return the texture associated with the surface, may be null.
*/
@@ -106,6 +103,7 @@ protected:
~GrSurface() override {}
+
void onRelease() override;
void onAbandon() override;
diff --git a/include/private/GrRenderTargetProxy.h b/include/private/GrRenderTargetProxy.h
index 1f5b79fdd1..d74be14605 100644
--- a/include/private/GrRenderTargetProxy.h
+++ b/include/private/GrRenderTargetProxy.h
@@ -66,8 +66,8 @@ protected:
friend class GrRenderTargetProxyPriv;
// Deferred version
- GrRenderTargetProxy(const GrCaps&, const GrBackendFormat&, const GrSurfaceDesc&,
- GrSurfaceOrigin, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
+ GrRenderTargetProxy(const GrCaps&, const GrSurfaceDesc&, GrSurfaceOrigin, SkBackingFit,
+ SkBudgeted, GrInternalSurfaceFlags);
// Lazy-callback version
// There are two main use cases for lazily-instantiated proxies:
@@ -80,8 +80,8 @@ protected:
// The minimal knowledge version is used for CCPR where we are generating an atlas but we do not
// know the final size until flush time.
GrRenderTargetProxy(LazyInstantiateCallback&&, LazyInstantiationType lazyType,
- const GrBackendFormat&, const GrSurfaceDesc&, GrSurfaceOrigin,
- SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
+ const GrSurfaceDesc&, GrSurfaceOrigin, SkBackingFit, SkBudgeted,
+ GrInternalSurfaceFlags);
// Wrapped version
GrRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 887400a60c..980f983e83 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -9,12 +9,12 @@
#define GrSurfaceProxy_DEFINED
#include "../private/SkNoncopyable.h"
-#include "GrBackendSurface.h"
#include "GrGpuResource.h"
#include "GrSurface.h"
#include "SkRect.h"
+class GrBackendTexture;
class GrCaps;
class GrOpList;
class GrProxyProvider;
@@ -265,10 +265,6 @@ public:
return fOrigin;
}
- const GrBackendFormat& backendFormat() const { return fFormat; }
-
- GrTextureType textureType() const { return fFormat.textureType(); }
-
class UniqueID {
public:
static UniqueID InvalidID() {
@@ -417,10 +413,9 @@ public:
protected:
// Deferred version
- GrSurfaceProxy(const GrBackendFormat& format, const GrSurfaceDesc& desc,
- GrSurfaceOrigin origin, SkBackingFit fit,
+ GrSurfaceProxy(const GrSurfaceDesc& desc, GrSurfaceOrigin origin, SkBackingFit fit,
SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
- : GrSurfaceProxy(nullptr, LazyInstantiationType::kSingleUse, format, desc, origin, fit,
+ : GrSurfaceProxy(nullptr, LazyInstantiationType::kSingleUse, desc, origin, fit,
budgeted, surfaceFlags) {
// Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources
}
@@ -429,8 +424,8 @@ protected:
// Lazy-callback version
GrSurfaceProxy(LazyInstantiateCallback&&, LazyInstantiationType,
- const GrBackendFormat& format, const GrSurfaceDesc&, GrSurfaceOrigin,
- SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
+ const GrSurfaceDesc&, GrSurfaceOrigin, SkBackingFit,
+ SkBudgeted, GrInternalSurfaceFlags);
// Wrapped version
GrSurfaceProxy(sk_sp<GrSurface>, GrSurfaceOrigin, SkBackingFit);
@@ -472,9 +467,8 @@ protected:
GrInternalSurfaceFlags fSurfaceFlags;
private:
- // For wrapped resources, 'fFormat', 'fConfig', 'fWidth', 'fHeight', and 'fOrigin; will always
- // be filled in from the wrapped resource.
- GrBackendFormat fFormat;
+ // For wrapped resources, 'fConfig', 'fWidth', 'fHeight', and 'fOrigin; will always be filled in
+ // from the wrapped resource.
GrPixelConfig fConfig;
int fWidth;
int fHeight;
diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h
index cdfd07ac56..124c5f9010 100644
--- a/include/private/GrTextureProxy.h
+++ b/include/private/GrTextureProxy.h
@@ -40,10 +40,9 @@ public:
// been instantiated or not.
GrMipMapped proxyMipMapped() const { return fMipMapped; }
+ GrTextureType textureType() const { return fTextureType; }
/** If true then the texture does not support MIP maps and only supports clamp wrap mode. */
- bool hasRestrictedSampling() const {
- return GrTextureTypeHasRestrictedSampling(this->textureType());
- }
+ bool hasRestrictedSampling() const { return GrTextureTypeHasRestrictedSampling(fTextureType); }
/**
* Return the texture proxy's unique key. It will be invalid if the proxy doesn't have one.
*/
@@ -80,12 +79,12 @@ protected:
friend class GrTextureProxyPriv;
// Deferred version - when constructed with data the origin is always kTopLeft.
- GrTextureProxy(const GrBackendFormat&, const GrSurfaceDesc& srcDesc, GrMipMapped, SkBackingFit,
+ GrTextureProxy(const GrSurfaceDesc& srcDesc, GrMipMapped, GrTextureType, SkBackingFit,
SkBudgeted, const void* srcData, size_t srcRowBytes, GrInternalSurfaceFlags);
// Deferred version - no data.
- GrTextureProxy(const GrBackendFormat&, const GrSurfaceDesc& srcDesc, GrSurfaceOrigin,
- GrMipMapped, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
+ GrTextureProxy(const GrSurfaceDesc& srcDesc, GrSurfaceOrigin, GrMipMapped, GrTextureType,
+ SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
// Lazy-callback version
// There are two main use cases for lazily-instantiated proxies:
@@ -97,9 +96,9 @@ protected:
//
// The minimal knowledge version is used for CCPR where we are generating an atlas but we do not
// know the final size until flush time.
- GrTextureProxy(LazyInstantiateCallback&&, LazyInstantiationType, const GrBackendFormat&,
- const GrSurfaceDesc& desc, GrSurfaceOrigin, GrMipMapped, SkBackingFit,
- SkBudgeted, GrInternalSurfaceFlags);
+ GrTextureProxy(LazyInstantiateCallback&&, LazyInstantiationType, const GrSurfaceDesc& desc,
+ GrSurfaceOrigin, GrMipMapped, GrTextureType, SkBackingFit, SkBudgeted,
+ GrInternalSurfaceFlags);
// Wrapped version
GrTextureProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
@@ -118,6 +117,7 @@ private:
// address of other types, leading to this problem.
GrMipMapped fMipMapped;
+ GrTextureType fTextureType;
GrUniqueKey fUniqueKey;
GrProxyProvider* fProxyProvider; // only set when fUniqueKey is valid