Remove window rects flag from GrInternalSurfaceFlags.

This flag is annoying to set correctly when writing test code.
Fortunately it has become redundant with the "is GL FBO 0" flag.

Change-Id: Ifd88292d2d6ea05bfe0d269e853baff857e70bfe
Reviewed-on: https://skia-review.googlesource.com/c/178929
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2018-12-18 12:03:07 -05:00 committed by Skia Commit-Bot
parent fb5f43b09f
commit 34a2030d0a
9 changed files with 3 additions and 51 deletions

View File

@ -78,14 +78,6 @@ protected:
}
bool hasMixedSamples() const { return fSurfaceFlags & GrInternalSurfaceFlags::kMixedSampled; }
void setSupportsWindowRects() {
SkASSERT(this->asRenderTarget());
fSurfaceFlags |= GrInternalSurfaceFlags::kWindowRectsSupport;
}
bool supportsWindowRects() const {
return fSurfaceFlags & GrInternalSurfaceFlags::kWindowRectsSupport;
}
void setGLRTFBOIDIs0() {
SkASSERT(this->asRenderTarget());
fSurfaceFlags |= GrInternalSurfaceFlags::kGLRTFBOIDIs0;

View File

@ -94,13 +94,6 @@ private:
}
bool hasMixedSamples() const { return fSurfaceFlags & GrInternalSurfaceFlags::kMixedSampled; }
void setSupportsWindowRects() {
fSurfaceFlags |= GrInternalSurfaceFlags::kWindowRectsSupport;
}
bool supportsWindowRects() const {
return fSurfaceFlags & GrInternalSurfaceFlags::kWindowRectsSupport;
}
void setGLRTFBOIDIs0() {
fSurfaceFlags |= GrInternalSurfaceFlags::kGLRTFBOIDIs0;
}

View File

@ -851,17 +851,10 @@ enum class GrInternalSurfaceFlags {
// are supported
kMixedSampled = 1 << 2,
// 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 << 3,
// This flag is for use with GL only. It tells us that the internal render target wraps FBO 0.
kGLRTFBOIDIs0 = 1 << 4,
kGLRTFBOIDIs0 = 1 << 3,
kRenderTargetMask = kMixedSampled | kWindowRectsSupport | kGLRTFBOIDIs0,
kRenderTargetMask = kMixedSampled | kGLRTFBOIDIs0,
};
GR_MAKE_BITFIELD_CLASS_OPS(GrInternalSurfaceFlags)

View File

@ -132,10 +132,6 @@ bool SkDeferredDisplayListRecorder::init() {
// In GL, FBO 0 never supports mixed samples
surfaceFlags |= GrInternalSurfaceFlags::kMixedSampled;
}
if (fContext->contextPriv().caps()->maxWindowRectangles() > 0 && !usesGLFBO0) {
// In GL, FBO 0 never supports window rectangles
surfaceFlags |= GrInternalSurfaceFlags::kWindowRectsSupport;
}
if (usesGLFBO0) {
surfaceFlags |= GrInternalSurfaceFlags::kGLRTFBOIDIs0;
}

View File

@ -221,9 +221,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImag
if (fCaps->usesMixedSamples() && sampleCnt > 1) {
surfaceFlags |= GrInternalSurfaceFlags::kMixedSampled;
}
if (fCaps->maxWindowRectangles() > 0) {
surfaceFlags |= GrInternalSurfaceFlags::kWindowRectsSupport;
}
}
GrSurfaceDesc desc;
@ -572,9 +569,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&&
if (SkToBool(surfaceFlags & GrInternalSurfaceFlags::kMixedSampled)) {
SkASSERT(fCaps->usesMixedSamples() && desc.fSampleCnt > 1);
}
if (SkToBool(surfaceFlags & GrInternalSurfaceFlags::kWindowRectsSupport)) {
SkASSERT(fCaps->maxWindowRectangles() > 0);
}
}
#endif
@ -603,9 +597,6 @@ sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
if (SkToBool(surfaceFlags & GrInternalSurfaceFlags::kMixedSampled)) {
SkASSERT(fCaps->usesMixedSamples() && desc.fSampleCnt > 1);
}
if (SkToBool(surfaceFlags & GrInternalSurfaceFlags::kWindowRectsSupport)) {
SkASSERT(fCaps->maxWindowRectangles() > 0);
}
#endif
using LazyInstantiationType = GrSurfaceProxy::LazyInstantiationType;
@ -633,9 +624,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallbac
GrInternalSurfaceFlags surfaceFlags = GrInternalSurfaceFlags::kNoPendingIO;
if (Renderable::kYes == renderable) {
desc.fFlags = kRenderTarget_GrSurfaceFlag;
if (caps.maxWindowRectangles() > 0) {
surfaceFlags |= GrInternalSurfaceFlags::kWindowRectsSupport;
}
}
desc.fWidth = -1;
desc.fHeight = -1;

View File

@ -25,7 +25,6 @@ GrRenderTarget::GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc,
, fStencilAttachment(stencil) {
SkASSERT(desc.fFlags & kRenderTarget_GrSurfaceFlag);
SkASSERT(!this->hasMixedSamples() || fSampleCnt > 1);
SkASSERT(!this->supportsWindowRects() || gpu->caps()->maxWindowRectangles() > 0);
fResolveRect = SkRectPriv::MakeILargestInverted();
}

View File

@ -31,9 +31,6 @@ GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrBackendForm
if (caps.usesMixedSamples() && fSampleCnt > 1) {
this->setHasMixedSamples();
}
if (caps.maxWindowRectangles() > 0) {
this->setSupportsWindowRects();
}
}
// Lazy-callback version
@ -57,7 +54,7 @@ GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin
}
int GrRenderTargetProxy::maxWindowRectangles(const GrCaps& caps) const {
return this->supportsWindowRects() ? caps.maxWindowRectangles() : 0;
return this->glRTFBOIDIs0() ? 0 : caps.maxWindowRectangles();
}
bool GrRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider) {

View File

@ -44,9 +44,6 @@ inline void GrGLRenderTarget::setFlags(const GrGLCaps& glCaps, const IDDesc& idD
SkASSERT(glCaps.usesMixedSamples() && idDesc.fRTFBOID); // FBO 0 can't be mixed sampled.
this->setHasMixedSamples();
}
if (glCaps.maxWindowRectangles() > 0 && idDesc.fRTFBOID) {
this->setSupportsWindowRects();
}
if (!idDesc.fRTFBOID) {
this->setGLRTFBOIDIs0();
}

View File

@ -314,9 +314,6 @@ sk_sp<GrSurfaceProxy> make_lazy(GrProxyProvider* proxyProvider, const GrCaps* ca
auto lazyType = deinstantiate ? GrSurfaceProxy::LazyInstantiationType ::kDeinstantiate
: GrSurfaceProxy::LazyInstantiationType ::kSingleUse;
GrInternalSurfaceFlags flags = GrInternalSurfaceFlags::kNone;
if (p.fIsRT && caps->maxWindowRectangles() > 0) {
flags = GrInternalSurfaceFlags::kWindowRectsSupport;
}
return proxyProvider->createLazyProxy(callback, format, desc, p.fOrigin, GrMipMapped::kNo,
flags, p.fFit, SkBudgeted::kNo, lazyType);
}