Remove kDefault_GrSurfaceOrigin

Change-Id: Ic55d488287add32e5a32b5a77415e16cebf4c1ee
Reviewed-on: https://skia-review.googlesource.com/29120
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Robert Phillips 2017-08-29 14:46:43 -04:00 committed by Skia Commit-Bot
parent 73fa972d0b
commit fb4a20c7f5
13 changed files with 9 additions and 38 deletions

View File

@ -571,12 +571,10 @@ typedef intptr_t GrBackendObject;
/**
* Some textures will be stored such that the upper and left edges of the content meet at the
* the origin (in texture coord space) and for other textures the lower and left edges meet at
* the origin. kDefault_GrSurfaceOrigin sets textures to TopLeft, and render targets
* to BottomLeft.
* the origin.
*/
enum GrSurfaceOrigin {
kDefault_GrSurfaceOrigin, // DEPRECATED; to be removed
kTopLeft_GrSurfaceOrigin,
kBottomLeft_GrSurfaceOrigin,
};
@ -592,7 +590,7 @@ struct GrMipLevel {
struct GrSurfaceDesc {
GrSurfaceDesc()
: fFlags(kNone_GrSurfaceFlags)
, fOrigin(kDefault_GrSurfaceOrigin)
, fOrigin(kTopLeft_GrSurfaceOrigin)
, fWidth(0)
, fHeight(0)
, fConfig(kUnknown_GrPixelConfig)
@ -622,9 +620,6 @@ struct GrSurfaceDesc {
bool fIsMipMapped; //!< Indicates if the texture has mipmaps
};
// Legacy alias
typedef GrSurfaceDesc GrTextureDesc;
/**
* Clips are composed from these objects.
*/

View File

@ -148,7 +148,6 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture(
}
}
SkASSERT(kDefault_GrSurfaceOrigin != fSurfaceOrigin);
// We just gained access to the texture. If we're on the original context, we could use the
// original texture, but we'd have no way of detecting that it's no longer in-use. So we
// always make a wrapped copy, where the release proc informs us that the context is done

View File

@ -759,7 +759,6 @@ sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackend
sk_sp<SkColorSpace> colorSpace) {
ASSERT_SINGLE_OWNER_PRIV
SkASSERT(kDefault_GrSurfaceOrigin != origin);
sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTexture(tex));
if (!surface) {
return nullptr;
@ -781,8 +780,6 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
const SkSurfaceProps* props) {
ASSERT_SINGLE_OWNER_PRIV
SkASSERT(kDefault_GrSurfaceOrigin != origin);
sk_sp<GrSurface> surface(
fContext->resourceProvider()->wrapRenderableBackendTexture(tex, sampleCnt));
if (!surface) {
@ -805,7 +802,6 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC
const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER_PRIV
SkASSERT(kDefault_GrSurfaceOrigin != origin);
sk_sp<GrRenderTarget> rt(fContext->resourceProvider()->wrapBackendRenderTarget(backendRT));
if (!rt) {
return nullptr;
@ -829,7 +825,6 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend
const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER_PRIV
SkASSERT(kDefault_GrSurfaceOrigin != origin);
sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTextureAsRenderTarget(
tex,
sampleCnt));
@ -894,8 +889,6 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
SkASSERT(kDefault_GrSurfaceOrigin != origin);
if (this->abandoned()) {
return nullptr;
}

View File

@ -138,7 +138,6 @@ sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, SkBudgeted
desc.fSampleCnt = caps->getSampleCount(desc.fSampleCnt, desc.fConfig);
// Attempt to catch un- or wrongly initialized sample counts.
SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
if (mipLevelCount && (desc.fFlags & kPerformInitialClear_GrSurfaceFlag)) {
return nullptr;

View File

@ -20,7 +20,6 @@
GrPipeline::GrPipeline(const InitArgs& args, GrProcessorSet&& processors,
GrAppliedClip&& appliedClip) {
SkASSERT(args.fProxy);
SkASSERT(kDefault_GrSurfaceOrigin != args.fProxy->origin());
SkASSERT(processors.isFinalized());
fProxy.reset(args.fProxy);

View File

@ -98,8 +98,6 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, Sk
sk_sp<GrTexture> GrResourceProvider::getExactScratch(const GrSurfaceDesc& desc,
SkBudgeted budgeted, uint32_t flags) {
SkASSERT(desc.fOrigin != kDefault_GrSurfaceOrigin);
flags |= kExact_Flag | kNoCreate_Flag;
sk_sp<GrTexture> tex(this->refScratchTexture(desc, flags));
if (tex && SkBudgeted::kNo == budgeted) {
@ -161,7 +159,6 @@ sk_sp<GrTextureProxy> GrResourceProvider::createTextureProxy(const GrSurfaceDesc
sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
uint32_t flags) {
ASSERT_SINGLE_OWNER
SkASSERT(desc.fOrigin != kDefault_GrSurfaceOrigin);
if (this->isAbandoned()) {
return nullptr;
@ -183,7 +180,6 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& de
uint32_t flags) {
ASSERT_SINGLE_OWNER
SkASSERT(0 == flags || kNoPendingIO_Flag == flags);
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
if (this->isAbandoned()) {
return nullptr;
@ -201,7 +197,6 @@ sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& inDe
ASSERT_SINGLE_OWNER
SkASSERT(!this->isAbandoned());
SkASSERT(validate_desc(inDesc, *fCaps));
SkASSERT(inDesc.fOrigin != kDefault_GrSurfaceOrigin);
SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);

View File

@ -33,7 +33,6 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin,
, fNeedsClear(false)
, fGpuMemorySize(kInvalidGpuMemorySize)
, fLastOpList(nullptr) {
SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
}
GrSurfaceProxy::~GrSurfaceProxy() {
@ -64,7 +63,6 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(
int sampleCnt, bool needsStencil,
GrSurfaceFlags flags, bool isMipMapped,
SkDestinationSurfaceColorMode mipColorMode) const {
SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
GrSurfaceDesc desc;
desc.fFlags = flags;
@ -207,7 +205,6 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceP
SkBudgeted budgeted,
uint32_t flags) {
SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags);
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
const GrCaps* caps = resourceProvider->caps();
@ -302,7 +299,6 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
GrBackendTexture& backendTex,
GrSurfaceOrigin origin) {
SkASSERT(kDefault_GrSurfaceOrigin != origin);
sk_sp<GrTexture> tex(context->resourceProvider()->wrapBackendTexture(backendTex));
return GrSurfaceProxy::MakeWrapped(std::move(tex), origin);
}

View File

@ -88,8 +88,6 @@ void GrTexturePriv::ComputeScratchKey(GrPixelConfig config, int width, int heigh
}
void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) {
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
// Note: the fOrigin field is not used in the scratch key
return ComputeScratchKey(desc.fConfig, desc.fWidth, desc.fHeight,
SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag), desc.fSampleCnt,

View File

@ -450,7 +450,7 @@ private:
void invalidate() { fRTOrigin = kInvalidSurfaceOrigin; }
bool knownDisabled() const { return this->valid() && !fWindowState.enabled(); }
void setDisabled() {
fRTOrigin = kDefault_GrSurfaceOrigin;
fRTOrigin = kTopLeft_GrSurfaceOrigin;
fWindowState.setDisabled();
}

View File

@ -72,10 +72,10 @@ static const char* specific_layout_qualifier_name(GrBlendEquation equation) {
uint8_t GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(GrSurfaceOrigin origin) {
SkASSERT(kTopLeft_GrSurfaceOrigin == origin || kBottomLeft_GrSurfaceOrigin == origin);
return origin;
return origin + 1;
GR_STATIC_ASSERT(1 == kTopLeft_GrSurfaceOrigin);
GR_STATIC_ASSERT(2 == kBottomLeft_GrSurfaceOrigin);
GR_STATIC_ASSERT(0 == kTopLeft_GrSurfaceOrigin);
GR_STATIC_ASSERT(1 == kBottomLeft_GrSurfaceOrigin);
}
GrGLSLFragmentShaderBuilder::GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program)
@ -272,10 +272,10 @@ const char* GrGLSLFragmentShaderBuilder::getSecondaryColorOutputName() const {
GrSurfaceOrigin GrGLSLFragmentShaderBuilder::getSurfaceOrigin() const {
SkASSERT(fProgramBuilder->header().fSurfaceOriginKey);
return static_cast<GrSurfaceOrigin>(fProgramBuilder->header().fSurfaceOriginKey);
return static_cast<GrSurfaceOrigin>(fProgramBuilder->header().fSurfaceOriginKey-1);
GR_STATIC_ASSERT(1 == kTopLeft_GrSurfaceOrigin);
GR_STATIC_ASSERT(2 == kBottomLeft_GrSurfaceOrigin);
GR_STATIC_ASSERT(0 == kTopLeft_GrSurfaceOrigin);
GR_STATIC_ASSERT(1 == kBottomLeft_GrSurfaceOrigin);
}
void GrGLSLFragmentShaderBuilder::onFinalize() {

View File

@ -266,7 +266,6 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx,
return nullptr;
}
SkASSERT(kDefault_GrSurfaceOrigin != origin);
sk_sp<GrTexture> tex = ctx->resourceProvider()->wrapBackendTexture(backendTex, ownership);
if (!tex) {
return nullptr;

View File

@ -26,7 +26,6 @@ static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrResourceProvider* provider,
GrBackendRenderTarget backendRT(desc.fWidth, desc.fHeight, desc.fSampleCnt, 8,
desc.fConfig, fboInfo);
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT));
SkASSERT(!defaultFBO->asTexture());

View File

@ -53,7 +53,6 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams&
p.fConfig,
*backendTexHandle);
SkASSERT(kDefault_GrSurfaceOrigin != p.fOrigin);
sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex,
kBorrow_GrWrapOwnership);
return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin);