aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-05-02 15:06:47 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-02 21:34:58 +0000
commitb73a9f8b9609c09c25405c16d277c977fdea8c07 (patch)
tree2a5b464adf4ed0e1a2d870b1a22f85ab1cba73be /include
parent90864a21c4ab6c7da3c6d671cf85a97373578243 (diff)
Add internal grsurface flag to track if using gl rectangle or external texture.
Bug: skia: Change-Id: I84963833bbc3ae957c919a19f6e78fce2c9de7ef Reviewed-on: https://skia-review.googlesource.com/125294 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrSurface.h11
-rw-r--r--include/private/GrTextureProxy.h12
-rw-r--r--include/private/GrTypesPriv.h29
3 files changed, 31 insertions, 21 deletions
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 4ddc5d14cc..f3771a74e2 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -71,11 +71,16 @@ protected:
return fSurfaceFlags & GrInternalSurfaceFlags::kDoesNotSupportMipMaps;
}
- void setIsClampOnly() {
+ void setIsGLTextureRectangleOrExternal() {
SkASSERT(this->asTexture());
- fSurfaceFlags |= GrInternalSurfaceFlags::kIsClampOnly;
+ fSurfaceFlags |= GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal;
+ // If we are a GL rectangle or external texture, it also means that we do not support
+ // generating mip maps.
+ this->setDoesNotSupportMipMaps();
+ }
+ bool isGLTextureRectangleOrExternal() const {
+ return fSurfaceFlags & GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal;
}
- bool isClampOnly() const { return fSurfaceFlags & GrInternalSurfaceFlags::kIsClampOnly; }
void setHasMixedSamples() {
SkASSERT(this->asRenderTarget());
diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h
index b9373a55f8..8bbdbf2959 100644
--- a/include/private/GrTextureProxy.h
+++ b/include/private/GrTextureProxy.h
@@ -107,11 +107,15 @@ protected:
return fSurfaceFlags & GrInternalSurfaceFlags::kDoesNotSupportMipMaps;
}
- void setIsClampOnly() {
- fSurfaceFlags |= GrInternalSurfaceFlags::kIsClampOnly;
+ void setIsGLTextureRectangleOrExternal() {
+ fSurfaceFlags |= GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal;
+ // If we are a GL rectangle or external texture, it also means that we do not support
+ // generating mip maps.
+ this->setDoesNotSupportMipMaps();
+ }
+ bool isGLTextureRectangleOrExternal() const {
+ return fSurfaceFlags & GrInternalSurfaceFlags::kIsGLTextureRectangleOrExternal;
}
- bool isClampOnly() const { return fSurfaceFlags & GrInternalSurfaceFlags::kIsClampOnly; }
-
private:
GrMipMapped fMipMapped;
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index e0f31fa5f9..84461836f0 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -859,12 +859,12 @@ enum GrAccessPattern {
// Flags shared between the GrSurface & GrSurfaceProxy class hierarchies
enum class GrInternalSurfaceFlags {
- kNone = 0,
+ kNone = 0,
// Surface-level
- kNoPendingIO = 1 << 0,
+ kNoPendingIO = 1 << 0,
- kSurfaceMask = kNoPendingIO,
+ kSurfaceMask = kNoPendingIO,
// Texture-only flags
@@ -872,15 +872,16 @@ enum class GrInternalSurfaceFlags {
// external and rectangle textures). Note that Ganesh does not internally
// create resources with this limitation - this flag will only appear on resources passed
// into Ganesh.
- kDoesNotSupportMipMaps = 1 << 1,
+ kDoesNotSupportMipMaps = 1 << 1,
- // This flag is set when the internal texture target only supports the clamp wrap mode (e.g.,
- // external and rectangle textures). Note that Ganesh does not internally
- // create resources with this limitation - this flag will only appear on resources passed
- // into Ganesh.
- kIsClampOnly = 1 << 2,
+ // 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 << 2,
- kTextureMask = kDoesNotSupportMipMaps | kIsClampOnly,
+ kTextureMask = kDoesNotSupportMipMaps | kIsGLTextureRectangleOrExternal,
// RT-only
@@ -890,19 +891,19 @@ enum class GrInternalSurfaceFlags {
// this is disabled for FBO0
// but, otherwise, is enabled whenever MSAA is enabled and GrCaps reports mixed samples
// are supported
- kMixedSampled = 1 << 3,
+ kMixedSampled = 1 << 3,
// For internal resources:
// this is enabled whenever GrCaps reports window rect support
// For wrapped resources1
// this is disabled for FBO0
// but, otherwise, is enabled whenever GrCaps reports window rect support
- kWindowRectsSupport = 1 << 4,
+ kWindowRectsSupport = 1 << 4,
// This flag is for use with GL only. It tells us that the internal render target wraps FBO 0.
- kGLRTFBOIDIs0 = 1 << 5,
+ kGLRTFBOIDIs0 = 1 << 5,
- kRenderTargetMask = kMixedSampled | kWindowRectsSupport | kGLRTFBOIDIs0,
+ kRenderTargetMask = kMixedSampled | kWindowRectsSupport | kGLRTFBOIDIs0,
};
GR_MAKE_BITFIELD_CLASS_OPS(GrInternalSurfaceFlags)