aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-07-30 13:13:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-30 19:32:13 +0000
commit7226c232d73356a37ec8cfef0ed55147e68dd2fd (patch)
tree47559e4a5994b5cffc5382e9bb230f49b6c04cd7 /include
parent3ebd354730ea9590bf233deccfc24982ffe48a98 (diff)
Make GrTextureProxy store a GrTextureType.
Removes flag indicating rectangle or external as its now redundant. Bug: skia: Change-Id: Ia475b557390e7a6b0f19f6e189cf8c27090e397c Reviewed-on: https://skia-review.googlesource.com/144346 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrSurface.h8
-rw-r--r--include/private/GrTextureProxy.h18
-rw-r--r--include/private/GrTypesPriv.h25
3 files changed, 20 insertions, 31 deletions
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 3a7294b26e..a93cacf501 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -63,14 +63,6 @@ public:
GrMipMapped, bool useNextPow2 = false);
protected:
- void setIsGLTextureRectangleOrExternal() {
- SkASSERT(this->asTexture());
- fSurfaceFlags |= GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal;
- }
- bool isGLTextureRectangleOrExternal() const {
- return fSurfaceFlags & GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal;
- }
-
void setHasMixedSamples() {
SkASSERT(this->asRenderTarget());
fSurfaceFlags |= GrInternalSurfaceFlags::kMixedSampled;
diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h
index fc7f1c54a7..38469547d1 100644
--- a/include/private/GrTextureProxy.h
+++ b/include/private/GrTextureProxy.h
@@ -72,12 +72,12 @@ protected:
friend class GrTextureProxyPriv;
// Deferred version - when constructed with data the origin is always kTopLeft.
- GrTextureProxy(const GrSurfaceDesc& srcDesc, GrMipMapped, SkBackingFit, SkBudgeted,
- const void* srcData, size_t srcRowBytes, GrInternalSurfaceFlags);
+ GrTextureProxy(const GrSurfaceDesc& srcDesc, GrMipMapped, GrTextureType, SkBackingFit,
+ SkBudgeted, const void* srcData, size_t srcRowBytes, GrInternalSurfaceFlags);
// Deferred version - no data.
- GrTextureProxy(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:
@@ -90,7 +90,7 @@ 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 GrSurfaceDesc& desc,
- GrSurfaceOrigin, GrMipMapped, SkBackingFit, SkBudgeted,
+ GrSurfaceOrigin, GrMipMapped, GrTextureType, SkBackingFit, SkBudgeted,
GrInternalSurfaceFlags);
// Wrapped version
@@ -100,15 +100,9 @@ protected:
sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
- void setIsGLTextureRectangleOrExternal() {
- fSurfaceFlags |= GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal;
- }
- bool isGLTextureRectangleOrExternal() const {
- return fSurfaceFlags & GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal;
- }
-
private:
GrMipMapped fMipMapped;
+ GrTextureType fTextureType;
GrUniqueKey fUniqueKey;
GrProxyProvider* fProxyProvider; // only set when fUniqueKey is valid
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index db25236e3d..ef6fa54841 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -503,6 +503,20 @@ static inline GrSLType GrSLCombinedSamplerTypeForTextureType(GrTextureType type)
return kTexture2DSampler_GrSLType;
}
+/** Rectangle and external textures ony support the clamp wrap mode and do not support MIP maps. */
+static inline bool GrTextureTypeHasRestrictedSampling(GrTextureType type) {
+ switch (type) {
+ case GrTextureType::k2D:
+ return false;
+ case GrTextureType::kRectangle:
+ return true;
+ case GrTextureType::kExternal:
+ return true;
+ }
+ SK_ABORT("Unexpected texture type");
+ return false;
+}
+
static inline bool GrSLTypeIsCombinedSamplerType(GrSLType type) {
switch (type) {
case kTexture2DSampler_GrSLType:
@@ -851,17 +865,6 @@ enum class GrInternalSurfaceFlags {
kSurfaceMask = kNoPendingIO,
- // Texture-only flags
-
- // This flag is for GL only. It says that the GL texture we will use has a target which is
- // either GL_TEXTURE_RECTANGLE or GL_GL_TEXTURE_EXTERNAL. We use this information to make
- // decisions about various rendering capabilites (e.g. is clamp the only supported wrap mode).
- // Note: Ganesh does not internally create these types of textures so they will only occur on
- // resources passed into Ganesh.
- kIsGLTextureRectangleOrExternal = 1 << 1,
-
- kTextureMask = kIsGLTextureRectangleOrExternal,
-
// RT-only
// For internal resources: