aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSurfaceProxy.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-03-16 16:47:25 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-19 12:21:05 +0000
commitfe0253f8bb64857df088d5ff54e2b5b66b102b46 (patch)
tree0d540ceaf02a992228dd713ccfee9fef413f7b3b /src/gpu/GrSurfaceProxy.cpp
parent4410d7ff757268792dd5f842d585c514cc80a5fb (diff)
Alter GrSurface/GrSurfaceProxy flags to prepare for GrTexture/GrTextureProxy -specific flags
This CL: moves GrRenderTarget::fFlags to GrSurface::fSurfaceFlags adds a GrInternalSurfaceFlags type and uses it for GrSurfaceProxy::fSurfaceFlags The goal of this is to provide a location where GrTexture/GrTextureProxy-specific flags (i.e., isExternal & isRectangle) can be stored. Change-Id: I8df7b79036a6853dd378ff6cf10d4b37c60dd511 Reviewed-on: https://skia-review.googlesource.com/114796 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrSurfaceProxy.cpp')
-rw-r--r--src/gpu/GrSurfaceProxy.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 76414b5945..a49251f337 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -15,6 +15,7 @@
#include "GrOpList.h"
#include "GrProxyProvider.h"
#include "GrSurfaceContext.h"
+#include "GrSurfacePriv.h"
#include "GrTexturePriv.h"
#include "GrTextureRenderTargetProxy.h"
@@ -49,14 +50,14 @@ static bool is_valid_non_lazy(const GrSurfaceDesc& desc) {
// Lazy-callback version
GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback, LazyInstantiationType lazyType,
const GrSurfaceDesc& desc, GrSurfaceOrigin origin, SkBackingFit fit,
- SkBudgeted budgeted, uint32_t flags)
+ SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
: fConfig(desc.fConfig)
, fWidth(desc.fWidth)
, fHeight(desc.fHeight)
, fOrigin(origin)
, fFit(fit)
, fBudgeted(budgeted)
- , fFlags(flags)
+ , fSurfaceFlags(surfaceFlags)
, fLazyInstantiateCallback(std::move(callback))
, fLazyInstantiationType(lazyType)
, fNeedsClear(SkToBool(desc.fFlags & kPerformInitialClear_GrSurfaceFlag))
@@ -79,7 +80,7 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin,
, fOrigin(origin)
, fFit(fit)
, fBudgeted(fTarget->resourcePriv().isBudgeted())
- , fFlags(0)
+ , fSurfaceFlags(fTarget->surfacePriv().flags())
, fUniqueID(fTarget->uniqueID()) // Note: converting from unique resource ID to a proxy ID!
, fNeedsClear(false)
, fGpuMemorySize(kInvalidGpuMemorySize)
@@ -117,11 +118,11 @@ bool GrSurfaceProxyPriv::AttachStencilIfNeeded(GrResourceProvider* resourceProvi
sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(
GrResourceProvider* resourceProvider,
int sampleCnt, bool needsStencil,
- GrSurfaceFlags flags, GrMipMapped mipMapped) const {
+ GrSurfaceDescFlags descFlags, GrMipMapped mipMapped) const {
SkASSERT(GrSurfaceProxy::LazyState::kNot == this->lazyInstantiationState());
SkASSERT(!fTarget);
GrSurfaceDesc desc;
- desc.fFlags = flags;
+ desc.fFlags = descFlags;
if (fNeedsClear) {
desc.fFlags |= kPerformInitialClear_GrSurfaceFlag;
}
@@ -130,6 +131,11 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(
desc.fConfig = fConfig;
desc.fSampleCnt = sampleCnt;
+ GrResourceProvider::Flags resourceProviderFlags = GrResourceProvider::kNone_Flag;
+ if (fSurfaceFlags & GrInternalSurfaceFlags::kNoPendingIO) {
+ resourceProviderFlags = GrResourceProvider::kNoPendingIO_Flag;
+ }
+
sk_sp<GrSurface> surface;
if (GrMipMapped::kYes == mipMapped) {
SkASSERT(SkBackingFit::kExact == fFit);
@@ -155,9 +161,9 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(
}
} else {
if (SkBackingFit::kApprox == fFit) {
- surface = resourceProvider->createApproxTexture(desc, fFlags);
+ surface = resourceProvider->createApproxTexture(desc, resourceProviderFlags);
} else {
- surface = resourceProvider->createTexture(desc, fBudgeted, fFlags);
+ surface = resourceProvider->createTexture(desc, fBudgeted, resourceProviderFlags);
}
}
if (!surface) {
@@ -192,8 +198,8 @@ void GrSurfaceProxy::assign(sk_sp<GrSurface> surface) {
}
bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
- bool needsStencil, GrSurfaceFlags flags, GrMipMapped mipMapped,
- const GrUniqueKey* uniqueKey) {
+ bool needsStencil, GrSurfaceDescFlags descFlags,
+ GrMipMapped mipMapped, const GrUniqueKey* uniqueKey) {
SkASSERT(LazyState::kNot == this->lazyInstantiationState());
if (fTarget) {
if (uniqueKey) {
@@ -203,7 +209,7 @@ bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int s
}
sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, sampleCnt, needsStencil,
- flags, mipMapped);
+ descFlags, mipMapped);
if (!surface) {
return false;
}
@@ -215,6 +221,11 @@ bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int s
}
this->assign(std::move(surface));
+
+ // Check that our a priori computation matched the ultimate reality
+ SkASSERT((fSurfaceFlags & ~GrInternalSurfaceFlags::kNoPendingIO) ==
+ fTarget->surfacePriv().flags());
+
return true;
}