aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-03-21 12:13:37 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-21 17:04:18 +0000
commitabf7b763e2c1ba069942dedec914494817fd27a8 (patch)
treec956480efd2273f0371823d3ebf0a3af46c09cab /include
parente65a5cd3fc34ab90743056ace2ef0a3a01bf6346 (diff)
Add texture-specific flags for External & Rectangle textures
For DDLs, Ganesh needs to know about External & Rectangle textures prior to instantiation (or PromiseImage fulfillment). These new flags allow the client to provide this information when the lazyProxy is created. The new texture flags work analogously to the render target flags: GrSurface and GrSurfaceProxy get a new set of accessors for the new flags The new flags are set appropriately on a GrGLTexture when it is created For wrapped texture proxies the flags are just copied off of the GrSurface For lazy-proxies/promise-images the flags are computed up front and passed to the proxy The GrSurfaceProxy/GrSurface flags equivalence is verified in GrSurfaceProxy::assign Change-Id: Ia8e1998aa0a36ce4481bfd9e56be21f990e83148 Reviewed-on: https://skia-review.googlesource.com/114985 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrSurface.h14
-rw-r--r--include/private/GrSurfaceProxy.h14
-rw-r--r--include/private/GrTypesPriv.h22
3 files changed, 44 insertions, 6 deletions
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index ee17d8a45f..5fc365b562 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -63,6 +63,20 @@ public:
GrMipMapped, bool useNextPow2 = false);
protected:
+ void setDoesNotSupportMipMaps() {
+ SkASSERT(this->asTexture());
+ fSurfaceFlags |= GrInternalSurfaceFlags::kDoesNotSupportMipMaps;
+ }
+ bool doesNotSupportMipMaps() const {
+ return fSurfaceFlags & GrInternalSurfaceFlags::kDoesNotSupportMipMaps;
+ }
+
+ void setIsClampOnly() {
+ SkASSERT(this->asTexture());
+ fSurfaceFlags |= GrInternalSurfaceFlags::kIsClampOnly;
+ }
+ bool isClampOnly() const { return fSurfaceFlags & GrInternalSurfaceFlags::kIsClampOnly; }
+
void setHasMixedSamples() {
SkASSERT(this->asRenderTarget());
fSurfaceFlags |= GrInternalSurfaceFlags::kMixedSampled;
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 0b1507969e..3c503faeb8 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -420,6 +420,20 @@ protected:
bool instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt, bool needsStencil,
GrSurfaceDescFlags descFlags, GrMipMapped, const GrUniqueKey*);
+ void setDoesNotSupportMipMaps() {
+ SkASSERT(this->asTextureProxy());
+ fSurfaceFlags |= GrInternalSurfaceFlags::kDoesNotSupportMipMaps;
+ }
+ bool doesNotSupportMipMaps() const {
+ return fSurfaceFlags & GrInternalSurfaceFlags::kDoesNotSupportMipMaps;
+ }
+
+ void setIsClampOnly() {
+ SkASSERT(this->asTextureProxy());
+ fSurfaceFlags |= GrInternalSurfaceFlags::kIsClampOnly;
+ }
+ bool isClampOnly() const { return fSurfaceFlags & GrInternalSurfaceFlags::kIsClampOnly; }
+
void setHasMixedSamples() {
SkASSERT(this->asRenderTargetProxy());
fSurfaceFlags |= GrInternalSurfaceFlags::kMixedSampled;
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index d64c9a328b..69c79ab042 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -672,14 +672,24 @@ 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,
- // Texture-only
+ // Texture-only flags
- /* coming soon */
+ // This flag is set when the internal texture target doesn't support mipmaps (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.
+ 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,
// RT-only
@@ -689,14 +699,14 @@ 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
};
GR_MAKE_BITFIELD_CLASS_OPS(GrInternalSurfaceFlags)