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:
parent
73fa972d0b
commit
fb4a20c7f5
@ -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
|
* 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 (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
|
* the origin.
|
||||||
* to BottomLeft.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum GrSurfaceOrigin {
|
enum GrSurfaceOrigin {
|
||||||
kDefault_GrSurfaceOrigin, // DEPRECATED; to be removed
|
|
||||||
kTopLeft_GrSurfaceOrigin,
|
kTopLeft_GrSurfaceOrigin,
|
||||||
kBottomLeft_GrSurfaceOrigin,
|
kBottomLeft_GrSurfaceOrigin,
|
||||||
};
|
};
|
||||||
@ -592,7 +590,7 @@ struct GrMipLevel {
|
|||||||
struct GrSurfaceDesc {
|
struct GrSurfaceDesc {
|
||||||
GrSurfaceDesc()
|
GrSurfaceDesc()
|
||||||
: fFlags(kNone_GrSurfaceFlags)
|
: fFlags(kNone_GrSurfaceFlags)
|
||||||
, fOrigin(kDefault_GrSurfaceOrigin)
|
, fOrigin(kTopLeft_GrSurfaceOrigin)
|
||||||
, fWidth(0)
|
, fWidth(0)
|
||||||
, fHeight(0)
|
, fHeight(0)
|
||||||
, fConfig(kUnknown_GrPixelConfig)
|
, fConfig(kUnknown_GrPixelConfig)
|
||||||
@ -622,9 +620,6 @@ struct GrSurfaceDesc {
|
|||||||
bool fIsMipMapped; //!< Indicates if the texture has mipmaps
|
bool fIsMipMapped; //!< Indicates if the texture has mipmaps
|
||||||
};
|
};
|
||||||
|
|
||||||
// Legacy alias
|
|
||||||
typedef GrSurfaceDesc GrTextureDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clips are composed from these objects.
|
* Clips are composed from these objects.
|
||||||
*/
|
*/
|
||||||
|
@ -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
|
// 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
|
// 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
|
// always make a wrapped copy, where the release proc informs us that the context is done
|
||||||
|
@ -759,7 +759,6 @@ sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackend
|
|||||||
sk_sp<SkColorSpace> colorSpace) {
|
sk_sp<SkColorSpace> colorSpace) {
|
||||||
ASSERT_SINGLE_OWNER_PRIV
|
ASSERT_SINGLE_OWNER_PRIV
|
||||||
|
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != origin);
|
|
||||||
sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTexture(tex));
|
sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTexture(tex));
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -781,8 +780,6 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
|
|||||||
const SkSurfaceProps* props) {
|
const SkSurfaceProps* props) {
|
||||||
ASSERT_SINGLE_OWNER_PRIV
|
ASSERT_SINGLE_OWNER_PRIV
|
||||||
|
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != origin);
|
|
||||||
|
|
||||||
sk_sp<GrSurface> surface(
|
sk_sp<GrSurface> surface(
|
||||||
fContext->resourceProvider()->wrapRenderableBackendTexture(tex, sampleCnt));
|
fContext->resourceProvider()->wrapRenderableBackendTexture(tex, sampleCnt));
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
@ -805,7 +802,6 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC
|
|||||||
const SkSurfaceProps* surfaceProps) {
|
const SkSurfaceProps* surfaceProps) {
|
||||||
ASSERT_SINGLE_OWNER_PRIV
|
ASSERT_SINGLE_OWNER_PRIV
|
||||||
|
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != origin);
|
|
||||||
sk_sp<GrRenderTarget> rt(fContext->resourceProvider()->wrapBackendRenderTarget(backendRT));
|
sk_sp<GrRenderTarget> rt(fContext->resourceProvider()->wrapBackendRenderTarget(backendRT));
|
||||||
if (!rt) {
|
if (!rt) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -829,7 +825,6 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend
|
|||||||
const SkSurfaceProps* surfaceProps) {
|
const SkSurfaceProps* surfaceProps) {
|
||||||
ASSERT_SINGLE_OWNER_PRIV
|
ASSERT_SINGLE_OWNER_PRIV
|
||||||
|
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != origin);
|
|
||||||
sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTextureAsRenderTarget(
|
sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTextureAsRenderTarget(
|
||||||
tex,
|
tex,
|
||||||
sampleCnt));
|
sampleCnt));
|
||||||
@ -894,8 +889,6 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
|
|||||||
GrSurfaceOrigin origin,
|
GrSurfaceOrigin origin,
|
||||||
const SkSurfaceProps* surfaceProps,
|
const SkSurfaceProps* surfaceProps,
|
||||||
SkBudgeted budgeted) {
|
SkBudgeted budgeted) {
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != origin);
|
|
||||||
|
|
||||||
if (this->abandoned()) {
|
if (this->abandoned()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,6 @@ sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, SkBudgeted
|
|||||||
desc.fSampleCnt = caps->getSampleCount(desc.fSampleCnt, desc.fConfig);
|
desc.fSampleCnt = caps->getSampleCount(desc.fSampleCnt, desc.fConfig);
|
||||||
// Attempt to catch un- or wrongly initialized sample counts.
|
// Attempt to catch un- or wrongly initialized sample counts.
|
||||||
SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
|
SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
|
|
||||||
|
|
||||||
if (mipLevelCount && (desc.fFlags & kPerformInitialClear_GrSurfaceFlag)) {
|
if (mipLevelCount && (desc.fFlags & kPerformInitialClear_GrSurfaceFlag)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
GrPipeline::GrPipeline(const InitArgs& args, GrProcessorSet&& processors,
|
GrPipeline::GrPipeline(const InitArgs& args, GrProcessorSet&& processors,
|
||||||
GrAppliedClip&& appliedClip) {
|
GrAppliedClip&& appliedClip) {
|
||||||
SkASSERT(args.fProxy);
|
SkASSERT(args.fProxy);
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != args.fProxy->origin());
|
|
||||||
SkASSERT(processors.isFinalized());
|
SkASSERT(processors.isFinalized());
|
||||||
|
|
||||||
fProxy.reset(args.fProxy);
|
fProxy.reset(args.fProxy);
|
||||||
|
@ -98,8 +98,6 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, Sk
|
|||||||
|
|
||||||
sk_sp<GrTexture> GrResourceProvider::getExactScratch(const GrSurfaceDesc& desc,
|
sk_sp<GrTexture> GrResourceProvider::getExactScratch(const GrSurfaceDesc& desc,
|
||||||
SkBudgeted budgeted, uint32_t flags) {
|
SkBudgeted budgeted, uint32_t flags) {
|
||||||
SkASSERT(desc.fOrigin != kDefault_GrSurfaceOrigin);
|
|
||||||
|
|
||||||
flags |= kExact_Flag | kNoCreate_Flag;
|
flags |= kExact_Flag | kNoCreate_Flag;
|
||||||
sk_sp<GrTexture> tex(this->refScratchTexture(desc, flags));
|
sk_sp<GrTexture> tex(this->refScratchTexture(desc, flags));
|
||||||
if (tex && SkBudgeted::kNo == budgeted) {
|
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,
|
sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
|
||||||
uint32_t flags) {
|
uint32_t flags) {
|
||||||
ASSERT_SINGLE_OWNER
|
ASSERT_SINGLE_OWNER
|
||||||
SkASSERT(desc.fOrigin != kDefault_GrSurfaceOrigin);
|
|
||||||
|
|
||||||
if (this->isAbandoned()) {
|
if (this->isAbandoned()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -183,7 +180,6 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& de
|
|||||||
uint32_t flags) {
|
uint32_t flags) {
|
||||||
ASSERT_SINGLE_OWNER
|
ASSERT_SINGLE_OWNER
|
||||||
SkASSERT(0 == flags || kNoPendingIO_Flag == flags);
|
SkASSERT(0 == flags || kNoPendingIO_Flag == flags);
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
|
|
||||||
|
|
||||||
if (this->isAbandoned()) {
|
if (this->isAbandoned()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -201,7 +197,6 @@ sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& inDe
|
|||||||
ASSERT_SINGLE_OWNER
|
ASSERT_SINGLE_OWNER
|
||||||
SkASSERT(!this->isAbandoned());
|
SkASSERT(!this->isAbandoned());
|
||||||
SkASSERT(validate_desc(inDesc, *fCaps));
|
SkASSERT(validate_desc(inDesc, *fCaps));
|
||||||
SkASSERT(inDesc.fOrigin != kDefault_GrSurfaceOrigin);
|
|
||||||
|
|
||||||
SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);
|
SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin,
|
|||||||
, fNeedsClear(false)
|
, fNeedsClear(false)
|
||||||
, fGpuMemorySize(kInvalidGpuMemorySize)
|
, fGpuMemorySize(kInvalidGpuMemorySize)
|
||||||
, fLastOpList(nullptr) {
|
, fLastOpList(nullptr) {
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GrSurfaceProxy::~GrSurfaceProxy() {
|
GrSurfaceProxy::~GrSurfaceProxy() {
|
||||||
@ -64,7 +63,6 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(
|
|||||||
int sampleCnt, bool needsStencil,
|
int sampleCnt, bool needsStencil,
|
||||||
GrSurfaceFlags flags, bool isMipMapped,
|
GrSurfaceFlags flags, bool isMipMapped,
|
||||||
SkDestinationSurfaceColorMode mipColorMode) const {
|
SkDestinationSurfaceColorMode mipColorMode) const {
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
|
|
||||||
|
|
||||||
GrSurfaceDesc desc;
|
GrSurfaceDesc desc;
|
||||||
desc.fFlags = flags;
|
desc.fFlags = flags;
|
||||||
@ -207,7 +205,6 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceP
|
|||||||
SkBudgeted budgeted,
|
SkBudgeted budgeted,
|
||||||
uint32_t flags) {
|
uint32_t flags) {
|
||||||
SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags);
|
SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags);
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
|
|
||||||
|
|
||||||
const GrCaps* caps = resourceProvider->caps();
|
const GrCaps* caps = resourceProvider->caps();
|
||||||
|
|
||||||
@ -302,7 +299,6 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(
|
|||||||
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
|
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
|
||||||
GrBackendTexture& backendTex,
|
GrBackendTexture& backendTex,
|
||||||
GrSurfaceOrigin origin) {
|
GrSurfaceOrigin origin) {
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != origin);
|
|
||||||
sk_sp<GrTexture> tex(context->resourceProvider()->wrapBackendTexture(backendTex));
|
sk_sp<GrTexture> tex(context->resourceProvider()->wrapBackendTexture(backendTex));
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(tex), origin);
|
return GrSurfaceProxy::MakeWrapped(std::move(tex), origin);
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,6 @@ void GrTexturePriv::ComputeScratchKey(GrPixelConfig config, int width, int heigh
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) {
|
void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) {
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
|
|
||||||
|
|
||||||
// Note: the fOrigin field is not used in the scratch key
|
// Note: the fOrigin field is not used in the scratch key
|
||||||
return ComputeScratchKey(desc.fConfig, desc.fWidth, desc.fHeight,
|
return ComputeScratchKey(desc.fConfig, desc.fWidth, desc.fHeight,
|
||||||
SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag), desc.fSampleCnt,
|
SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag), desc.fSampleCnt,
|
||||||
|
@ -450,7 +450,7 @@ private:
|
|||||||
void invalidate() { fRTOrigin = kInvalidSurfaceOrigin; }
|
void invalidate() { fRTOrigin = kInvalidSurfaceOrigin; }
|
||||||
bool knownDisabled() const { return this->valid() && !fWindowState.enabled(); }
|
bool knownDisabled() const { return this->valid() && !fWindowState.enabled(); }
|
||||||
void setDisabled() {
|
void setDisabled() {
|
||||||
fRTOrigin = kDefault_GrSurfaceOrigin;
|
fRTOrigin = kTopLeft_GrSurfaceOrigin;
|
||||||
fWindowState.setDisabled();
|
fWindowState.setDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ static const char* specific_layout_qualifier_name(GrBlendEquation equation) {
|
|||||||
|
|
||||||
uint8_t GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(GrSurfaceOrigin origin) {
|
uint8_t GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(GrSurfaceOrigin origin) {
|
||||||
SkASSERT(kTopLeft_GrSurfaceOrigin == origin || kBottomLeft_GrSurfaceOrigin == origin);
|
SkASSERT(kTopLeft_GrSurfaceOrigin == origin || kBottomLeft_GrSurfaceOrigin == origin);
|
||||||
return origin;
|
return origin + 1;
|
||||||
|
|
||||||
GR_STATIC_ASSERT(1 == kTopLeft_GrSurfaceOrigin);
|
GR_STATIC_ASSERT(0 == kTopLeft_GrSurfaceOrigin);
|
||||||
GR_STATIC_ASSERT(2 == kBottomLeft_GrSurfaceOrigin);
|
GR_STATIC_ASSERT(1 == kBottomLeft_GrSurfaceOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
GrGLSLFragmentShaderBuilder::GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program)
|
GrGLSLFragmentShaderBuilder::GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program)
|
||||||
@ -272,10 +272,10 @@ const char* GrGLSLFragmentShaderBuilder::getSecondaryColorOutputName() const {
|
|||||||
|
|
||||||
GrSurfaceOrigin GrGLSLFragmentShaderBuilder::getSurfaceOrigin() const {
|
GrSurfaceOrigin GrGLSLFragmentShaderBuilder::getSurfaceOrigin() const {
|
||||||
SkASSERT(fProgramBuilder->header().fSurfaceOriginKey);
|
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(0 == kTopLeft_GrSurfaceOrigin);
|
||||||
GR_STATIC_ASSERT(2 == kBottomLeft_GrSurfaceOrigin);
|
GR_STATIC_ASSERT(1 == kBottomLeft_GrSurfaceOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLSLFragmentShaderBuilder::onFinalize() {
|
void GrGLSLFragmentShaderBuilder::onFinalize() {
|
||||||
|
@ -266,7 +266,6 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != origin);
|
|
||||||
sk_sp<GrTexture> tex = ctx->resourceProvider()->wrapBackendTexture(backendTex, ownership);
|
sk_sp<GrTexture> tex = ctx->resourceProvider()->wrapBackendTexture(backendTex, ownership);
|
||||||
if (!tex) {
|
if (!tex) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -26,7 +26,6 @@ static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrResourceProvider* provider,
|
|||||||
GrBackendRenderTarget backendRT(desc.fWidth, desc.fHeight, desc.fSampleCnt, 8,
|
GrBackendRenderTarget backendRT(desc.fWidth, desc.fHeight, desc.fSampleCnt, 8,
|
||||||
desc.fConfig, fboInfo);
|
desc.fConfig, fboInfo);
|
||||||
|
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
|
|
||||||
sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT));
|
sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT));
|
||||||
SkASSERT(!defaultFBO->asTexture());
|
SkASSERT(!defaultFBO->asTexture());
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams&
|
|||||||
p.fConfig,
|
p.fConfig,
|
||||||
*backendTexHandle);
|
*backendTexHandle);
|
||||||
|
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != p.fOrigin);
|
|
||||||
sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex,
|
sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex,
|
||||||
kBorrow_GrWrapOwnership);
|
kBorrow_GrWrapOwnership);
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin);
|
return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin);
|
||||||
|
Loading…
Reference in New Issue
Block a user