aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-08-29 14:46:43 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-30 11:30:32 +0000
commitfb4a20c7f54110d6c43dee4b78801c163ad6c8f3 (patch)
tree47c075f8a37b9d9e1b1c7504ccd539020d0dd399
parent73fa972d0bd9de7cb801323495b5d1fabd31b24f (diff)
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>
-rw-r--r--include/gpu/GrTypes.h9
-rw-r--r--src/gpu/GrBackendTextureImageGenerator.cpp1
-rw-r--r--src/gpu/GrContext.cpp7
-rw-r--r--src/gpu/GrGpu.cpp1
-rw-r--r--src/gpu/GrPipeline.cpp1
-rw-r--r--src/gpu/GrResourceProvider.cpp5
-rw-r--r--src/gpu/GrSurfaceProxy.cpp4
-rw-r--r--src/gpu/GrTexture.cpp2
-rw-r--r--src/gpu/gl/GrGLGpu.h2
-rw-r--r--src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp12
-rw-r--r--src/image/SkImage_Gpu.cpp1
-rw-r--r--tests/ProxyConversionTest.cpp1
-rw-r--r--tests/ResourceAllocatorTest.cpp1
13 files changed, 9 insertions, 38 deletions
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 7401fa49ee..4839e9a121 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -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.
*/
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 22cdec395a..712ebb8bb1 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -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
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 907f82c51b..decb0edd6f 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -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;
}
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index f99dce4e97..f42e5383b4 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -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;
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 52cb709522..d07dd08624 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -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);
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 9f3c8cd2da..4f5f503c8c 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -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);
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 739fa6c481..5918830bf8 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -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);
}
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 8e79a699fc..63e00a2def 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -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,
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 6f2e5d30c5..ba9afbca26 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -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();
}
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index afbfa09a62..7e6b8f771c 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -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() {
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 8c2dfa0cec..d5dc4a2e32 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -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;
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index 9f5801cd47..2a6222cf9b 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -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());
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index ffe7e35861..fb9ac542ca 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -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);