aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
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 /src/image
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 'src/image')
-rw-r--r--src/image/SkImage_Gpu.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 9c62c349c8..6342512837 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -28,6 +28,7 @@
#include "GrTexture.h"
#include "GrTexturePriv.h"
#include "GrTextureProxy.h"
+#include "gl/GrGLDefines.h"
#include "effects/GrNonlinearColorSpaceXformEffect.h"
#include "effects/GrYUVtoRGBEffect.h"
#include "SkCanvas.h"
@@ -617,6 +618,17 @@ private:
sk_sp<GrReleaseProcHelper> fDoneHelper;
};
+static GrInternalSurfaceFlags get_flags_from_format(const GrBackendFormat& backendFormat) {
+ if (const GrGLenum* target = backendFormat.getGLTarget()) {
+ if (GR_GL_TEXTURE_RECTANGLE == *target || GR_GL_TEXTURE_EXTERNAL == *target) {
+ return GrInternalSurfaceFlags::kDoesNotSupportMipMaps |
+ GrInternalSurfaceFlags::kIsClampOnly;
+ }
+ }
+
+ return GrInternalSurfaceFlags::kNone;
+}
+
sk_sp<SkImage> SkImage_Gpu::MakePromiseTexture(GrContext* context,
const GrBackendFormat& backendFormat,
int width,
@@ -661,6 +673,8 @@ sk_sp<SkImage> SkImage_Gpu::MakePromiseTexture(GrContext* context,
PromiseImageHelper promiseHelper(textureFulfillProc, textureReleaseProc, promiseDoneProc,
textureContext);
+ GrInternalSurfaceFlags formatFlags = get_flags_from_format(backendFormat);
+
sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
[promiseHelper, config] (GrResourceProvider* resourceProvider) mutable {
if (!resourceProvider) {
@@ -669,7 +683,7 @@ sk_sp<SkImage> SkImage_Gpu::MakePromiseTexture(GrContext* context,
}
return promiseHelper.getTexture(resourceProvider, config);
- }, desc, origin, mipMapped, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact,
+ }, desc, origin, mipMapped, formatFlags, SkBackingFit::kExact,
SkBudgeted::kNo, GrSurfaceProxy::LazyInstantiationType::kUninstantiate);
if (!proxy) {