Rename GrTexture/Proxy/Priv mip map members/functions
Change-Id: Ib55cab0ef76ced165d1936e7d084edc7fa579c55 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304737 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
7f0129d424
commit
8c82a87a6b
@ -50,7 +50,7 @@ public:
|
||||
|
||||
uint32_t fSwizzleKey;
|
||||
GrGLint fBaseMipMapLevel;
|
||||
GrGLint fMaxMipMapLevel;
|
||||
GrGLint fMaxMipmapLevel;
|
||||
};
|
||||
|
||||
void invalidate();
|
||||
|
@ -124,7 +124,7 @@ GrSurfaceProxyView SkPictureImageGenerator::onGenerateTexture(GrRecordingContext
|
||||
const GrSurfaceProxyView* view = as_IB(image)->view(ctx);
|
||||
SkASSERT(view);
|
||||
SkASSERT(mipMapped == GrMipmapped::kNo ||
|
||||
view->asTextureProxy()->mipMapped() == GrMipmapped::kYes);
|
||||
view->asTextureProxy()->mipmapped() == GrMipmapped::kYes);
|
||||
return *view;
|
||||
}
|
||||
#endif
|
||||
|
@ -210,7 +210,7 @@ GrSurfaceProxyView GrBackendTextureImageGenerator::onGenerateTexture(
|
||||
|
||||
if (texGenPolicy == GrImageTexGenPolicy::kDraw && origin.isZero() &&
|
||||
info.dimensions() == fBackendTexture.dimensions() &&
|
||||
(mipMapped == GrMipmapped::kNo || proxy->mipMapped() == GrMipmapped::kYes)) {
|
||||
(mipMapped == GrMipmapped::kNo || proxy->mipmapped() == GrMipmapped::kYes)) {
|
||||
// If the caller wants the entire texture and we have the correct mip support, we're done
|
||||
return GrSurfaceProxyView(std::move(proxy), fSurfaceOrigin, readSwizzle);
|
||||
} else {
|
||||
|
@ -70,7 +70,7 @@ GrSurfaceProxyView GrBitmapTextureMaker::refOriginalTextureProxyView(GrMipmapped
|
||||
if (proxy) {
|
||||
swizzle = this->context()->priv().caps()->getReadSwizzle(proxy->backendFormat(),
|
||||
this->colorType());
|
||||
if (mipMapped == GrMipmapped::kNo || proxy->mipMapped() == GrMipmapped::kYes) {
|
||||
if (mipMapped == GrMipmapped::kNo || proxy->mipmapped() == GrMipmapped::kYes) {
|
||||
return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ GrSurfaceProxyView GrBitmapTextureMaker::refOriginalTextureProxyView(GrMipmapped
|
||||
if (proxy) {
|
||||
swizzle = this->context()->priv().caps()->getReadSwizzle(proxy->backendFormat(),
|
||||
this->colorType());
|
||||
SkASSERT(mipMapped == GrMipmapped::kNo || proxy->mipMapped() == GrMipmapped::kYes);
|
||||
SkASSERT(mipMapped == GrMipmapped::kNo || proxy->mipmapped() == GrMipmapped::kYes);
|
||||
if (fKey.isValid()) {
|
||||
installKey(proxy.get());
|
||||
}
|
||||
@ -102,7 +102,7 @@ GrSurfaceProxyView GrBitmapTextureMaker::refOriginalTextureProxyView(GrMipmapped
|
||||
|
||||
if (proxy) {
|
||||
SkASSERT(mipMapped == GrMipmapped::kYes);
|
||||
SkASSERT(proxy->mipMapped() == GrMipmapped::kNo);
|
||||
SkASSERT(proxy->mipmapped() == GrMipmapped::kNo);
|
||||
SkASSERT(fKey.isValid());
|
||||
// We need a mipped proxy, but we found a proxy earlier that wasn't mipped. Thus we generate
|
||||
// a new mipped surface and copy the original proxy into the base layer. We will then let
|
||||
|
@ -278,7 +278,7 @@ bool GrDrawingManager::flush(
|
||||
}
|
||||
if (GrMipmapped::kYes == mipMapped) {
|
||||
// The onFlush callback is responsible for regenerating mips if needed.
|
||||
SkASSERT(p->asTextureProxy() && !p->asTextureProxy()->mipMapsAreDirty());
|
||||
SkASSERT(p->asTextureProxy() && !p->asTextureProxy()->mipmapsAreDirty());
|
||||
}
|
||||
});
|
||||
#endif
|
||||
@ -513,10 +513,10 @@ static void resolve_and_mipmap(GrGpu* gpu, GrSurfaceProxy* proxy) {
|
||||
// (This special case is exercised by the ReimportImageTextureWithMipLevels test.)
|
||||
// FIXME: It may be more ideal to plumb down a "we're going to steal the backends" flag.
|
||||
if (auto* textureProxy = proxy->asTextureProxy()) {
|
||||
if (textureProxy->mipMapsAreDirty()) {
|
||||
if (textureProxy->mipmapsAreDirty()) {
|
||||
SkASSERT(textureProxy->peekTexture());
|
||||
gpu->regenerateMipMapLevels(textureProxy->peekTexture());
|
||||
textureProxy->markMipMapsClean();
|
||||
textureProxy->markMipmapsClean();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -656,8 +656,8 @@ void GrDrawingManager::copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList>
|
||||
ddl->characterization().origin());
|
||||
}
|
||||
GrTextureProxy* newTextureProxy = newDest->asTextureProxy();
|
||||
if (newTextureProxy && GrMipmapped::kYes == newTextureProxy->mipMapped()) {
|
||||
newTextureProxy->markMipMapsDirty();
|
||||
if (newTextureProxy && GrMipmapped::kYes == newTextureProxy->mipmapped()) {
|
||||
newTextureProxy->markMipmapsDirty();
|
||||
}
|
||||
|
||||
this->addDDLTarget(newDest, ddl->priv().targetProxy());
|
||||
|
@ -159,7 +159,7 @@ sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
|
||||
auto tex = this->createTextureCommon(dimensions, format, renderable, renderTargetSampleCnt,
|
||||
budgeted, isProtected, mipLevelCount, levelClearMask);
|
||||
if (tex && mipMapped == GrMipmapped::kYes && levelClearMask) {
|
||||
tex->texturePriv().markMipMapsClean();
|
||||
tex->texturePriv().markMipmapsClean();
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
@ -215,7 +215,7 @@ sk_sp<GrTexture> GrGpu::createTexture(SkISize dimensions,
|
||||
markMipLevelsClean = true;
|
||||
}
|
||||
if (markMipLevelsClean) {
|
||||
tex->texturePriv().markMipMapsClean();
|
||||
tex->texturePriv().markMipmapsClean();
|
||||
}
|
||||
}
|
||||
return tex;
|
||||
@ -552,8 +552,8 @@ bool GrGpu::regenerateMipMapLevels(GrTexture* texture) {
|
||||
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
|
||||
SkASSERT(texture);
|
||||
SkASSERT(this->caps()->mipmapSupport());
|
||||
SkASSERT(texture->texturePriv().mipMapped() == GrMipmapped::kYes);
|
||||
if (!texture->texturePriv().mipMapsAreDirty()) {
|
||||
SkASSERT(texture->texturePriv().mipmapped() == GrMipmapped::kYes);
|
||||
if (!texture->texturePriv().mipmapsAreDirty()) {
|
||||
// This can happen when the proxy expects mipmaps to be dirty, but they are not dirty on the
|
||||
// actual target. This may be caused by things that the drawingManager could not predict,
|
||||
// i.e., ops that don't draw anything, aborting a draw for exceptional circumstances, etc.
|
||||
@ -564,7 +564,7 @@ bool GrGpu::regenerateMipMapLevels(GrTexture* texture) {
|
||||
return false;
|
||||
}
|
||||
if (this->onRegenerateMipMapLevels(texture)) {
|
||||
texture->texturePriv().markMipMapsClean();
|
||||
texture->texturePriv().markMipmapsClean();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -589,7 +589,7 @@ void GrGpu::didWriteToSurface(GrSurface* surface, GrSurfaceOrigin origin, const
|
||||
if (nullptr == bounds || !bounds->isEmpty()) {
|
||||
GrTexture* texture = surface->asTexture();
|
||||
if (texture && 1 == mipLevels) {
|
||||
texture->texturePriv().markMipMapsDirty();
|
||||
texture->texturePriv().markMipmapsDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ void GrOpsRenderPass::bindTextures(const GrPrimitiveProcessor& primProc,
|
||||
(tex->width() != 1 || tex->height() != 1)) {
|
||||
// There are some cases where we might be given a non-mipmapped texture with a mipmap
|
||||
// filter. See skbug.com/7094.
|
||||
SkASSERT(tex->texturePriv().mipMapped() != GrMipmapped::kYes ||
|
||||
!tex->texturePriv().mipMapsAreDirty());
|
||||
SkASSERT(tex->texturePriv().mipmapped() != GrMipmapped::kYes ||
|
||||
!tex->texturePriv().mipmapsAreDirty());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -47,8 +47,8 @@ void GrProgramInfo::checkMSAAAndMIPSAreResolved() const {
|
||||
(tex->width() != 1 || tex->height() != 1)) {
|
||||
// There are some cases where we might be given a non-mipmapped texture with a
|
||||
// mipmap filter. See skbug.com/7094.
|
||||
SkASSERT(tex->texturePriv().mipMapped() != GrMipmapped::kYes ||
|
||||
!tex->texturePriv().mipMapsAreDirty());
|
||||
SkASSERT(tex->texturePriv().mipmapped() != GrMipmapped::kYes ||
|
||||
!tex->texturePriv().mipmapsAreDirty());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -370,9 +370,9 @@ inline GrAAType GrRenderTargetContext::chooseAAType(GrAA aa) {
|
||||
return (this->numSamples() > 1) ? GrAAType::kMSAA : GrAAType::kCoverage;
|
||||
}
|
||||
|
||||
GrMipmapped GrRenderTargetContext::mipMapped() const {
|
||||
GrMipmapped GrRenderTargetContext::mipmapped() const {
|
||||
if (const GrTextureProxy* proxy = this->asTextureProxy()) {
|
||||
return proxy->mipMapped();
|
||||
return proxy->mipmapped();
|
||||
}
|
||||
return GrMipmapped::kNo;
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ public:
|
||||
int numSamples() const { return this->asRenderTargetProxy()->numSamples(); }
|
||||
const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
|
||||
bool wrapsVkSecondaryCB() const { return this->asRenderTargetProxy()->wrapsVkSecondaryCB(); }
|
||||
GrMipmapped mipMapped() const;
|
||||
GrMipmapped mipmapped() const;
|
||||
|
||||
// TODO: See if it makes sense for this to return a const& instead and require the callers to
|
||||
// make a copy (which refs the proxy) if needed.
|
||||
|
@ -72,8 +72,8 @@ void GrRenderTask::makeClosed(const GrCaps& caps) {
|
||||
this->target(0).origin());
|
||||
}
|
||||
GrTextureProxy* textureProxy = this->target(0).asTextureProxy();
|
||||
if (textureProxy && GrMipmapped::kYes == textureProxy->mipMapped()) {
|
||||
textureProxy->markMipMapsDirty();
|
||||
if (textureProxy && GrMipmapped::kYes == textureProxy->mipmapped()) {
|
||||
textureProxy->markMipmapsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,11 +161,11 @@ void GrRenderTask::addDependency(GrDrawingManager* drawingMgr, GrSurfaceProxy* d
|
||||
GrTextureProxy* textureProxy = dependedOn->asTextureProxy();
|
||||
if (GrMipmapped::kYes == mipMapped) {
|
||||
SkASSERT(textureProxy);
|
||||
if (GrMipmapped::kYes != textureProxy->mipMapped()) {
|
||||
if (GrMipmapped::kYes != textureProxy->mipmapped()) {
|
||||
// There are some cases where we might be given a non-mipmapped texture with a mipmap
|
||||
// filter. See skbug.com/7094.
|
||||
mipMapped = GrMipmapped::kNo;
|
||||
} else if (textureProxy->mipMapsAreDirty()) {
|
||||
} else if (textureProxy->mipmapsAreDirty()) {
|
||||
resolveFlags |= GrSurfaceProxy::ResolveFlags::kMipMaps;
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,7 @@ void GrRenderTask::addDependency(GrDrawingManager* drawingMgr, GrSurfaceProxy* d
|
||||
SkASSERT(!renderTargetProxy->isMSAADirty());
|
||||
}
|
||||
if (textureProxy) {
|
||||
SkASSERT(!textureProxy->mipMapsAreDirty());
|
||||
SkASSERT(!textureProxy->mipmapsAreDirty());
|
||||
}
|
||||
SkASSERT(drawingMgr->getLastRenderTask(dependedOn) == fTextureResolveTask);
|
||||
#endif
|
||||
|
@ -209,7 +209,7 @@ void GrSurfaceProxy::computeScratchKey(const GrCaps& caps, GrScratchKey* key) co
|
||||
const GrTextureProxy* tp = this->asTextureProxy();
|
||||
GrMipmapped mipMapped = GrMipmapped::kNo;
|
||||
if (tp) {
|
||||
mipMapped = tp->mipMapped();
|
||||
mipMapped = tp->mipmapped();
|
||||
}
|
||||
|
||||
GrTexturePriv::ComputeScratchKey(caps, this->backendFormat(), this->backingStoreDimensions(),
|
||||
|
@ -22,21 +22,21 @@
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#endif
|
||||
|
||||
void GrTexture::markMipMapsDirty() {
|
||||
if (GrMipmapStatus::kValid == fMipMapsStatus) {
|
||||
fMipMapsStatus = GrMipmapStatus::kDirty;
|
||||
void GrTexture::markMipmapsDirty() {
|
||||
if (GrMipmapStatus::kValid == fMipmapStatus) {
|
||||
fMipmapStatus = GrMipmapStatus::kDirty;
|
||||
}
|
||||
}
|
||||
|
||||
void GrTexture::markMipMapsClean() {
|
||||
SkASSERT(GrMipmapStatus::kNotAllocated != fMipMapsStatus);
|
||||
fMipMapsStatus = GrMipmapStatus::kValid;
|
||||
void GrTexture::markMipmapsClean() {
|
||||
SkASSERT(GrMipmapStatus::kNotAllocated != fMipmapStatus);
|
||||
fMipmapStatus = GrMipmapStatus::kValid;
|
||||
}
|
||||
|
||||
size_t GrTexture::onGpuMemorySize() const {
|
||||
const GrCaps& caps = *this->getGpu()->caps();
|
||||
return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(), 1,
|
||||
this->texturePriv().mipMapped());
|
||||
this->texturePriv().mipmapped());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -47,11 +47,11 @@ GrTexture::GrTexture(GrGpu* gpu,
|
||||
GrMipmapStatus mipmapStatus)
|
||||
: INHERITED(gpu, dimensions, isProtected)
|
||||
, fTextureType(textureType)
|
||||
, fMipMapsStatus(mipmapStatus) {
|
||||
if (GrMipmapStatus::kNotAllocated == fMipMapsStatus) {
|
||||
fMaxMipMapLevel = 0;
|
||||
, fMipmapStatus(mipmapStatus) {
|
||||
if (fMipmapStatus == GrMipmapStatus::kNotAllocated) {
|
||||
fMaxMipmapLevel = 0;
|
||||
} else {
|
||||
fMaxMipMapLevel = SkMipmap::ComputeLevelCount(this->width(), this->height());
|
||||
fMaxMipmapLevel = SkMipmap::ComputeLevelCount(this->width(), this->height());
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ void GrTexture::computeScratchKey(GrScratchKey* key) const {
|
||||
auto isProtected = this->isProtected() ? GrProtected::kYes : GrProtected::kNo;
|
||||
GrTexturePriv::ComputeScratchKey(*this->getGpu()->caps(), this->backendFormat(),
|
||||
this->dimensions(), renderable, sampleCount,
|
||||
this->texturePriv().mipMapped(), isProtected, key);
|
||||
this->texturePriv().mipmapped(), isProtected, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,12 +89,12 @@ protected:
|
||||
|
||||
private:
|
||||
size_t onGpuMemorySize() const override;
|
||||
void markMipMapsDirty();
|
||||
void markMipMapsClean();
|
||||
void markMipmapsDirty();
|
||||
void markMipmapsClean();
|
||||
|
||||
GrTextureType fTextureType;
|
||||
GrMipmapStatus fMipMapsStatus;
|
||||
int fMaxMipMapLevel;
|
||||
GrMipmapStatus fMipmapStatus;
|
||||
int fMaxMipmapLevel;
|
||||
friend class GrTexturePriv;
|
||||
friend class GrTextureResource;
|
||||
|
||||
|
@ -60,7 +60,7 @@ GrSurfaceProxyView GrTextureAdjuster::onView(GrMipmapped mipMapped) {
|
||||
|
||||
GrTextureProxy* texProxy = fOriginal.asTextureProxy();
|
||||
SkASSERT(texProxy);
|
||||
if (mipMapped == GrMipmapped::kNo || texProxy->mipMapped() == GrMipmapped::kYes) {
|
||||
if (mipMapped == GrMipmapped::kNo || texProxy->mipmapped() == GrMipmapped::kYes) {
|
||||
return fOriginal;
|
||||
}
|
||||
|
||||
|
@ -18,27 +18,27 @@
|
||||
implemented privately in GrTexture with a inline public method here). */
|
||||
class GrTexturePriv {
|
||||
public:
|
||||
void markMipMapsDirty() {
|
||||
fTexture->markMipMapsDirty();
|
||||
void markMipmapsDirty() {
|
||||
fTexture->markMipmapsDirty();
|
||||
}
|
||||
|
||||
void markMipMapsClean() {
|
||||
fTexture->markMipMapsClean();
|
||||
void markMipmapsClean() {
|
||||
fTexture->markMipmapsClean();
|
||||
}
|
||||
|
||||
GrMipmapStatus mipmapStatus() const { return fTexture->fMipMapsStatus; }
|
||||
GrMipmapStatus mipmapStatus() const { return fTexture->fMipmapStatus; }
|
||||
|
||||
bool mipMapsAreDirty() const { return GrMipmapStatus::kValid != this->mipmapStatus(); }
|
||||
bool mipmapsAreDirty() const { return GrMipmapStatus::kValid != this->mipmapStatus(); }
|
||||
|
||||
GrMipmapped mipMapped() const {
|
||||
GrMipmapped mipmapped() const {
|
||||
if (GrMipmapStatus::kNotAllocated != this->mipmapStatus()) {
|
||||
return GrMipmapped::kYes;
|
||||
}
|
||||
return GrMipmapped::kNo;
|
||||
}
|
||||
|
||||
int maxMipMapLevel() const {
|
||||
return fTexture->fMaxMipMapLevel;
|
||||
int maxMipmapLevel() const {
|
||||
return fTexture->fMaxMipmapLevel;
|
||||
}
|
||||
|
||||
GrTextureType textureType() const { return fTexture->fTextureType; }
|
||||
|
@ -97,7 +97,7 @@ GrSurfaceProxyView GrTextureProducer::view(GrMipmapped mipMapped) {
|
||||
// Check to make sure if we requested MIPs that the returned texture has MIP maps or the format
|
||||
// is not copyable.
|
||||
SkASSERT(!result || mipMapped == GrMipmapped::kNo ||
|
||||
result.asTextureProxy()->mipMapped() == GrMipmapped::kYes ||
|
||||
result.asTextureProxy()->mipmapped() == GrMipmapped::kYes ||
|
||||
!caps->isFormatCopyable(result.proxy()->backendFormat()));
|
||||
return result;
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ GrTextureProxy::GrTextureProxy(const GrBackendFormat& format,
|
||||
GrDDLProvider creatingProvider)
|
||||
: INHERITED(format, dimensions, fit, budgeted, isProtected, surfaceFlags, useAllocator)
|
||||
, fMipmapped(mipMapped)
|
||||
, fMipMapsStatus(mipmapStatus)
|
||||
SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
|
||||
, fMipmapStatus(mipmapStatus)
|
||||
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
|
||||
, fCreatingProvider(creatingProvider)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {
|
||||
@ -51,8 +51,8 @@ GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback,
|
||||
: INHERITED(std::move(callback), format, dimensions, fit, budgeted, isProtected,
|
||||
surfaceFlags, useAllocator)
|
||||
, fMipmapped(mipMapped)
|
||||
, fMipMapsStatus(mipmapStatus)
|
||||
SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
|
||||
, fMipmapStatus(mipmapStatus)
|
||||
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
|
||||
, fCreatingProvider(creatingProvider)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {
|
||||
@ -64,9 +64,9 @@ GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf,
|
||||
UseAllocator useAllocator,
|
||||
GrDDLProvider creatingProvider)
|
||||
: INHERITED(std::move(surf), SkBackingFit::kExact, useAllocator)
|
||||
, fMipmapped(fTarget->asTexture()->texturePriv().mipMapped())
|
||||
, fMipMapsStatus(fTarget->asTexture()->texturePriv().mipmapStatus())
|
||||
SkDEBUGCODE(, fInitialMipMapsStatus(fMipMapsStatus))
|
||||
, fMipmapped(fTarget->asTexture()->texturePriv().mipmapped())
|
||||
, fMipmapStatus(fTarget->asTexture()->texturePriv().mipmapStatus())
|
||||
SkDEBUGCODE(, fInitialMipmapStatus(fMipmapStatus))
|
||||
, fCreatingProvider(creatingProvider)
|
||||
, fProxyProvider(nullptr)
|
||||
, fDeferredUploader(nullptr) {
|
||||
@ -135,16 +135,16 @@ void GrTextureProxyPriv::resetDeferredUploader() {
|
||||
fTextureProxy->fDeferredUploader.reset();
|
||||
}
|
||||
|
||||
GrMipmapped GrTextureProxy::mipMapped() const {
|
||||
GrMipmapped GrTextureProxy::mipmapped() const {
|
||||
if (this->isInstantiated()) {
|
||||
return this->peekTexture()->texturePriv().mipMapped();
|
||||
return this->peekTexture()->texturePriv().mipmapped();
|
||||
}
|
||||
return fMipmapped;
|
||||
}
|
||||
|
||||
size_t GrTextureProxy::onUninstantiatedGpuMemorySize(const GrCaps& caps) const {
|
||||
return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(), 1,
|
||||
this->proxyMipMapped(), !this->priv().isExact());
|
||||
this->proxyMipmapped(), !this->priv().isExact());
|
||||
}
|
||||
|
||||
GrSamplerState::Filter GrTextureProxy::HighestFilterMode(GrTextureType textureType) {
|
||||
@ -209,8 +209,8 @@ void GrTextureProxy::onValidateSurface(const GrSurface* surface) {
|
||||
// Anything that is checked here should be duplicated in GrTextureRenderTargetProxy's version
|
||||
SkASSERT(surface->asTexture());
|
||||
// It is possible to fulfill a non-mipmapped proxy with a mipmapped texture.
|
||||
SkASSERT(GrMipmapped::kNo == this->proxyMipMapped() ||
|
||||
GrMipmapped::kYes == surface->asTexture()->texturePriv().mipMapped());
|
||||
SkASSERT(GrMipmapped::kNo == this->proxyMipmapped() ||
|
||||
GrMipmapped::kYes == surface->asTexture()->texturePriv().mipmapped());
|
||||
|
||||
SkASSERT(surface->asTexture()->texturePriv().textureType() == this->textureType());
|
||||
|
||||
|
@ -31,25 +31,25 @@ public:
|
||||
// claim to not need mips at creation time, but the instantiation happens to give us a mipped
|
||||
// target. In that case we should use that for our benefit to avoid possible copies/mip
|
||||
// generation later.
|
||||
GrMipmapped mipMapped() const;
|
||||
GrMipmapped mipmapped() const;
|
||||
|
||||
bool mipMapsAreDirty() const {
|
||||
bool mipmapsAreDirty() const {
|
||||
SkASSERT((GrMipmapped::kNo == fMipmapped) ==
|
||||
(GrMipmapStatus::kNotAllocated == fMipMapsStatus));
|
||||
return GrMipmapped::kYes == fMipmapped && GrMipmapStatus::kValid != fMipMapsStatus;
|
||||
(GrMipmapStatus::kNotAllocated == fMipmapStatus));
|
||||
return GrMipmapped::kYes == fMipmapped && GrMipmapStatus::kValid != fMipmapStatus;
|
||||
}
|
||||
void markMipMapsDirty() {
|
||||
void markMipmapsDirty() {
|
||||
SkASSERT(GrMipmapped::kYes == fMipmapped);
|
||||
fMipMapsStatus = GrMipmapStatus::kDirty;
|
||||
fMipmapStatus = GrMipmapStatus::kDirty;
|
||||
}
|
||||
void markMipMapsClean() {
|
||||
void markMipmapsClean() {
|
||||
SkASSERT(GrMipmapped::kYes == fMipmapped);
|
||||
fMipMapsStatus = GrMipmapStatus::kValid;
|
||||
fMipmapStatus = GrMipmapStatus::kValid;
|
||||
}
|
||||
|
||||
// Returns the GrMipmapped value of the proxy from creation time regardless of whether it has
|
||||
// been instantiated or not.
|
||||
GrMipmapped proxyMipMapped() const { return fMipmapped; }
|
||||
GrMipmapped proxyMipmapped() const { return fMipmapped; }
|
||||
|
||||
GrTextureType textureType() const { return this->backendFormat().textureType(); }
|
||||
|
||||
@ -170,14 +170,14 @@ private:
|
||||
// This tracks the mipmap status at the proxy level and is thus somewhat distinct from the
|
||||
// backing GrTexture's mipmap status. In particular, this status is used to determine when
|
||||
// mipmap levels need to be explicitly regenerated during the execution of a DAG of opsTasks.
|
||||
GrMipmapStatus fMipMapsStatus;
|
||||
GrMipmapStatus fMipmapStatus;
|
||||
// TEMPORARY: We are in the process of moving GrMipmapStatus from the texture to the proxy.
|
||||
// We track the fInitialMipMapsStatus here so we can assert that the proxy did indeed expect
|
||||
// We track the fInitialMipmapStatus here so we can assert that the proxy did indeed expect
|
||||
// the correct mipmap status immediately after instantiation.
|
||||
//
|
||||
// NOTE: fMipMapsStatus may no longer be equal to fInitialMipMapsStatus by the time the texture
|
||||
// NOTE: fMipmapStatus may no longer be equal to fInitialMipmapStatus by the time the texture
|
||||
// is instantiated, since it tracks mipmaps in the time frame in which the DAG is being built.
|
||||
SkDEBUGCODE(const GrMipmapStatus fInitialMipMapsStatus;)
|
||||
SkDEBUGCODE(const GrMipmapStatus fInitialMipmapStatus;)
|
||||
|
||||
bool fSyncTargetKey = true; // Should target's unique key be sync'ed with ours.
|
||||
|
||||
|
@ -113,7 +113,7 @@ size_t GrTextureRenderTargetProxy::onUninstantiatedGpuMemorySize(const GrCaps& c
|
||||
|
||||
// TODO: do we have enough information to improve this worst case estimate?
|
||||
return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
|
||||
colorSamplesPerPixel, this->proxyMipMapped(),
|
||||
colorSamplesPerPixel, this->proxyMipmapped(),
|
||||
!this->priv().isExact());
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ bool GrTextureRenderTargetProxy::instantiate(GrResourceProvider* resourceProvide
|
||||
const GrUniqueKey& key = this->getUniqueKey();
|
||||
|
||||
if (!this->instantiateImpl(resourceProvider, this->numSamples(), GrRenderable::kYes,
|
||||
this->mipMapped(), key.isValid() ? &key : nullptr)) {
|
||||
this->mipmapped(), key.isValid() ? &key : nullptr)) {
|
||||
return false;
|
||||
}
|
||||
if (key.isValid()) {
|
||||
@ -141,7 +141,7 @@ bool GrTextureRenderTargetProxy::instantiate(GrResourceProvider* resourceProvide
|
||||
sk_sp<GrSurface> GrTextureRenderTargetProxy::createSurface(
|
||||
GrResourceProvider* resourceProvider) const {
|
||||
sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, this->numSamples(),
|
||||
GrRenderable::kYes, this->mipMapped());
|
||||
GrRenderable::kYes, this->mipmapped());
|
||||
if (!surface) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -165,7 +165,7 @@ GrSurfaceProxy::LazySurfaceDesc GrTextureRenderTargetProxy::callbackDesc() const
|
||||
dims,
|
||||
fit,
|
||||
GrRenderable::kYes,
|
||||
this->mipMapped(),
|
||||
this->mipmapped(),
|
||||
this->numSamples(),
|
||||
this->backendFormat(),
|
||||
this->isProtected(),
|
||||
@ -177,8 +177,8 @@ GrSurfaceProxy::LazySurfaceDesc GrTextureRenderTargetProxy::callbackDesc() const
|
||||
void GrTextureRenderTargetProxy::onValidateSurface(const GrSurface* surface) {
|
||||
// Anything checked here should also be checking the GrTextureProxy version
|
||||
SkASSERT(surface->asTexture());
|
||||
SkASSERT(GrMipmapped::kNo == this->proxyMipMapped() ||
|
||||
GrMipmapped::kYes == surface->asTexture()->texturePriv().mipMapped());
|
||||
SkASSERT(GrMipmapped::kNo == this->proxyMipmapped() ||
|
||||
GrMipmapped::kYes == surface->asTexture()->texturePriv().mipmapped());
|
||||
|
||||
// Anything checked here should also be checking the GrRenderTargetProxy version
|
||||
SkASSERT(surface->asRenderTarget());
|
||||
|
@ -37,9 +37,9 @@ void GrTextureResolveRenderTask::addProxy(GrDrawingManager* drawingMgr,
|
||||
|
||||
if (GrSurfaceProxy::ResolveFlags::kMipMaps & flags) {
|
||||
GrTextureProxy* textureProxy = proxy->asTextureProxy();
|
||||
SkASSERT(GrMipmapped::kYes == textureProxy->mipMapped());
|
||||
SkASSERT(textureProxy->mipMapsAreDirty());
|
||||
textureProxy->markMipMapsClean();
|
||||
SkASSERT(GrMipmapped::kYes == textureProxy->mipmapped());
|
||||
SkASSERT(textureProxy->mipmapsAreDirty());
|
||||
textureProxy->markMipmapsClean();
|
||||
}
|
||||
|
||||
// Add the proxy as a dependency: We will read the existing contents of this texture while
|
||||
@ -81,9 +81,9 @@ bool GrTextureResolveRenderTask::onExecute(GrOpFlushState* flushState) {
|
||||
if (GrSurfaceProxy::ResolveFlags::kMipMaps & resolve.fFlags) {
|
||||
// peekTexture might be null if there was an instantiation error.
|
||||
GrTexture* texture = this->target(i).proxy()->peekTexture();
|
||||
if (texture && texture->texturePriv().mipMapsAreDirty()) {
|
||||
if (texture && texture->texturePriv().mipmapsAreDirty()) {
|
||||
flushState->gpu()->regenerateMipMapLevels(texture);
|
||||
SkASSERT(!texture->texturePriv().mipMapsAreDirty());
|
||||
SkASSERT(!texture->texturePriv().mipmapsAreDirty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ void SkGpuDevice::replaceRenderTargetContext(SkSurface::ContentChangeMode mode)
|
||||
fRenderTargetContext->numSamples(),
|
||||
fRenderTargetContext->origin(),
|
||||
&this->surfaceProps(),
|
||||
fRenderTargetContext->mipMapped());
|
||||
fRenderTargetContext->mipmapped());
|
||||
if (!newRTC) {
|
||||
return;
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ bool GrD3DGpu::onWritePixels(GrSurface* surface, int left, int top, int width, i
|
||||
// Need to change the resource state to COPY_DEST in order to upload to it
|
||||
d3dTex->setResourceState(this, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
|
||||
SkASSERT(mipLevelCount <= d3dTex->texturePriv().maxMipMapLevel() + 1);
|
||||
SkASSERT(mipLevelCount <= d3dTex->texturePriv().maxMipmapLevel() + 1);
|
||||
success = this->uploadToTexture(d3dTex, left, top, width, height, srcColorType, texels,
|
||||
mipLevelCount);
|
||||
|
||||
@ -635,7 +635,7 @@ bool GrD3DGpu::uploadToTexture(GrD3DTexture* tex, int left, int top, int width,
|
||||
|
||||
// We assume that if the texture has mip levels, we either upload to all the levels or just the
|
||||
// first.
|
||||
SkASSERT(1 == mipLevelCount || mipLevelCount == (tex->texturePriv().maxMipMapLevel() + 1));
|
||||
SkASSERT(1 == mipLevelCount || mipLevelCount == (tex->texturePriv().maxMipmapLevel() + 1));
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return false;
|
||||
@ -713,7 +713,7 @@ bool GrD3DGpu::uploadToTexture(GrD3DTexture* tex, int left, int top, int width,
|
||||
placedFootprints.get(), left, top);
|
||||
|
||||
if (mipLevelCount < (int)desc.MipLevels) {
|
||||
tex->texturePriv().markMipMapsDirty();
|
||||
tex->texturePriv().markMipmapsDirty();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -181,5 +181,5 @@ size_t GrD3DTextureRenderTarget::onGpuMemorySize() const {
|
||||
const GrCaps& caps = *this->getGpu()->caps();
|
||||
return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
|
||||
numColorSamples, // TODO: this still correct?
|
||||
this->texturePriv().mipMapped());
|
||||
this->texturePriv().mipmapped());
|
||||
}
|
||||
|
@ -30,5 +30,5 @@ size_t GrDawnTextureRenderTarget::onGpuMemorySize() const {
|
||||
const GrCaps& caps = *this->getGpu()->caps();
|
||||
return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
|
||||
1, // FIXME: for MSAA
|
||||
this->texturePriv().mipMapped());
|
||||
this->texturePriv().mipmapped());
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ std::unique_ptr<GrFragmentProcessor> GrTextureEffect::TestCreate(GrProcessorTest
|
||||
GrTest::TestWrapModes(testData->fRandom, wrapModes);
|
||||
|
||||
Filter filter;
|
||||
if (view.asTextureProxy()->mipMapped() == GrMipmapped::kYes) {
|
||||
if (view.asTextureProxy()->mipmapped() == GrMipmapped::kYes) {
|
||||
switch (testData->fRandom->nextULessThan(3)) {
|
||||
case 0:
|
||||
filter = Filter::kNearest;
|
||||
|
@ -2576,7 +2576,7 @@ void GrGLGpu::bindTexture(int unitIdx, GrSamplerState samplerState, const GrSwiz
|
||||
|
||||
if (samplerState.filter() == GrSamplerState::Filter::kMipMap) {
|
||||
if (!this->caps()->mipmapSupport() ||
|
||||
texture->texturePriv().mipMapped() == GrMipmapped::kNo) {
|
||||
texture->texturePriv().mipmapped() == GrMipmapped::kNo) {
|
||||
samplerState.setFilterMode(GrSamplerState::Filter::kLinear);
|
||||
}
|
||||
}
|
||||
@ -2584,7 +2584,7 @@ void GrGLGpu::bindTexture(int unitIdx, GrSamplerState samplerState, const GrSwiz
|
||||
#ifdef SK_DEBUG
|
||||
// We were supposed to ensure MipMaps were up-to-date before getting here.
|
||||
if (samplerState.filter() == GrSamplerState::Filter::kMipMap) {
|
||||
SkASSERT(!texture->texturePriv().mipMapsAreDirty());
|
||||
SkASSERT(!texture->texturePriv().mipmapsAreDirty());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2661,7 +2661,7 @@ void GrGLGpu::bindTexture(int unitIdx, GrSamplerState samplerState, const GrSwiz
|
||||
}
|
||||
GrGLTextureParameters::NonsamplerState newNonsamplerState;
|
||||
newNonsamplerState.fBaseMipMapLevel = 0;
|
||||
newNonsamplerState.fMaxMipMapLevel = texture->texturePriv().maxMipMapLevel();
|
||||
newNonsamplerState.fMaxMipmapLevel = texture->texturePriv().maxMipmapLevel();
|
||||
|
||||
const GrGLTextureParameters::NonsamplerState& oldNonsamplerState =
|
||||
texture->parameters()->nonsamplerState();
|
||||
@ -2693,10 +2693,10 @@ void GrGLGpu::bindTexture(int unitIdx, GrSamplerState samplerState, const GrSwiz
|
||||
GL_CALL(TexParameteri(target, GR_GL_TEXTURE_BASE_LEVEL,
|
||||
newNonsamplerState.fBaseMipMapLevel));
|
||||
}
|
||||
if (newNonsamplerState.fMaxMipMapLevel != oldNonsamplerState.fMaxMipMapLevel) {
|
||||
if (newNonsamplerState.fMaxMipmapLevel != oldNonsamplerState.fMaxMipmapLevel) {
|
||||
this->setTextureUnit(unitIdx);
|
||||
GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LEVEL,
|
||||
newNonsamplerState.fMaxMipMapLevel));
|
||||
newNonsamplerState.fMaxMipmapLevel));
|
||||
}
|
||||
}
|
||||
texture->parameters()->set(samplerStateToRecord, newNonsamplerState,
|
||||
@ -3411,7 +3411,7 @@ bool GrGLGpu::onRegenerateMipMapLevels(GrTexture* texture) {
|
||||
int width = texture->width();
|
||||
int height = texture->height();
|
||||
int levelCount = SkMipmap::ComputeLevelCount(width, height) + 1;
|
||||
SkASSERT(levelCount == texture->texturePriv().maxMipMapLevel() + 1);
|
||||
SkASSERT(levelCount == texture->texturePriv().maxMipmapLevel() + 1);
|
||||
|
||||
// Create (if necessary), then bind temporary FBO:
|
||||
if (0 == fTempDstFBOID) {
|
||||
@ -3638,7 +3638,7 @@ bool GrGLGpu::onUpdateBackendTexture(const GrBackendTexture& backendTexture,
|
||||
GL_CALL(TexParameteri(info.fTarget, GR_GL_TEXTURE_BASE_LEVEL, 0));
|
||||
nonsamplerState.fBaseMipMapLevel = 0;
|
||||
}
|
||||
if (params->nonsamplerState().fMaxMipMapLevel != (numMipLevels - 1)) {
|
||||
if (params->nonsamplerState().fMaxMipmapLevel != (numMipLevels - 1)) {
|
||||
GL_CALL(TexParameteri(info.fTarget, GR_GL_TEXTURE_MAX_LEVEL, numMipLevels - 1));
|
||||
nonsamplerState.fBaseMipMapLevel = numMipLevels - 1;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ GrBackendTexture GrGLTexture::getBackendTexture() const {
|
||||
info.fTarget = target_from_texture_type(this->texturePriv().textureType());
|
||||
info.fID = fID;
|
||||
info.fFormat = GrGLFormatToEnum(fFormat);
|
||||
return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipMapped(), info,
|
||||
return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipmapped(), info,
|
||||
fParameters);
|
||||
}
|
||||
|
||||
|
@ -73,5 +73,5 @@ sk_sp<GrGLTextureRenderTarget> GrGLTextureRenderTarget::MakeWrapped(
|
||||
size_t GrGLTextureRenderTarget::onGpuMemorySize() const {
|
||||
const GrCaps& caps = *this->getGpu()->caps();
|
||||
return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
|
||||
this->numSamplesOwnedPerPixel(), this->texturePriv().mipMapped());
|
||||
this->numSamplesOwnedPerPixel(), this->texturePriv().mipmapped());
|
||||
}
|
||||
|
@ -32,12 +32,12 @@ void GrGLTextureParameters::SamplerOverriddenState::invalidate() {
|
||||
|
||||
GrGLTextureParameters::NonsamplerState::NonsamplerState()
|
||||
// These are the OpenGL defaults.
|
||||
: fSwizzleKey(GrSwizzle::RGBA().asKey()), fBaseMipMapLevel(0), fMaxMipMapLevel(1000) {}
|
||||
: fSwizzleKey(GrSwizzle::RGBA().asKey()), fBaseMipMapLevel(0), fMaxMipmapLevel(1000) {}
|
||||
|
||||
void GrGLTextureParameters::NonsamplerState::invalidate() {
|
||||
fSwizzleKey = ~0U;
|
||||
fBaseMipMapLevel = ~0;
|
||||
fMaxMipMapLevel = ~0;
|
||||
fMaxMipmapLevel = ~0;
|
||||
}
|
||||
|
||||
void GrGLTextureParameters::invalidate() {
|
||||
|
@ -55,7 +55,7 @@ private:
|
||||
}
|
||||
void markRenderTargetDirty() {
|
||||
if (auto* tex = fRenderTarget->asTexture()) {
|
||||
tex->texturePriv().markMipMapsDirty();
|
||||
tex->texturePriv().markMipmapsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
~GrMockTexture() override {}
|
||||
|
||||
GrBackendTexture getBackendTexture() const override {
|
||||
return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipMapped(),
|
||||
return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipmapped(),
|
||||
fInfo);
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ private:
|
||||
}
|
||||
const GrCaps& caps = *this->getGpu()->caps();
|
||||
return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
|
||||
numColorSamples, this->texturePriv().mipMapped());
|
||||
numColorSamples, this->texturePriv().mipmapped());
|
||||
}
|
||||
|
||||
// This avoids an inherits via dominance warning on MSVC.
|
||||
|
@ -237,7 +237,7 @@ bool GrMtlGpu::uploadToTexture(GrMtlTexture* tex, int left, int top, int width,
|
||||
|
||||
// We assume that if the texture has mip levels, we either upload to all the levels or just the
|
||||
// first.
|
||||
SkASSERT(1 == mipLevelCount || mipLevelCount == (tex->texturePriv().maxMipMapLevel() + 1));
|
||||
SkASSERT(1 == mipLevelCount || mipLevelCount == (tex->texturePriv().maxMipmapLevel() + 1));
|
||||
|
||||
if (!check_max_blit_width(width)) {
|
||||
return false;
|
||||
@ -316,7 +316,7 @@ bool GrMtlGpu::uploadToTexture(GrMtlTexture* tex, int left, int top, int width,
|
||||
#endif
|
||||
|
||||
if (mipLevelCount < (int) tex->mtlTexture().mipmapLevelCount) {
|
||||
tex->texturePriv().markMipMapsDirty();
|
||||
tex->texturePriv().markMipmapsDirty();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -403,7 +403,7 @@ bool GrMtlGpu::clearTexture(GrMtlTexture* tex, size_t bpp, uint32_t levelMask) {
|
||||
}
|
||||
|
||||
if (mipLevelCount < (int) tex->mtlTexture().mipmapLevelCount) {
|
||||
tex->texturePriv().markMipMapsDirty();
|
||||
tex->texturePriv().markMipmapsDirty();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -466,7 +466,7 @@ bool GrVkGpu::onWritePixels(GrSurface* surface, int left, int top, int width, in
|
||||
success = this->uploadTexDataLinear(vkTex, left, top, width, height, srcColorType,
|
||||
texels[0].fPixels, texels[0].fRowBytes);
|
||||
} else {
|
||||
SkASSERT(mipLevelCount <= vkTex->texturePriv().maxMipMapLevel() + 1);
|
||||
SkASSERT(mipLevelCount <= vkTex->texturePriv().maxMipmapLevel() + 1);
|
||||
success = this->uploadTexDataOptimal(vkTex, left, top, width, height, srcColorType, texels,
|
||||
mipLevelCount);
|
||||
}
|
||||
@ -544,7 +544,7 @@ bool GrVkGpu::onTransferPixelsTo(GrTexture* texture, int left, int top, int widt
|
||||
1,
|
||||
®ion);
|
||||
|
||||
vkTex->texturePriv().markMipMapsDirty();
|
||||
vkTex->texturePriv().markMipmapsDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -784,7 +784,7 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, int left, int top, int widt
|
||||
|
||||
// We assume that if the texture has mip levels, we either upload to all the levels or just the
|
||||
// first.
|
||||
SkASSERT(1 == mipLevelCount || mipLevelCount == (tex->texturePriv().maxMipMapLevel() + 1));
|
||||
SkASSERT(1 == mipLevelCount || mipLevelCount == (tex->texturePriv().maxMipmapLevel() + 1));
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return false;
|
||||
@ -952,7 +952,7 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, int left, int top, int widt
|
||||
SkIPoint::Make(left, top)));
|
||||
}
|
||||
if (1 == mipLevelCount) {
|
||||
tex->texturePriv().markMipMapsDirty();
|
||||
tex->texturePriv().markMipmapsDirty();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -255,5 +255,5 @@ size_t GrVkTextureRenderTarget::onGpuMemorySize() const {
|
||||
const GrCaps& caps = *this->getGpu()->caps();
|
||||
return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
|
||||
numColorSamples, // TODO: this still correct?
|
||||
this->texturePriv().mipMapped());
|
||||
this->texturePriv().mipmapped());
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ sk_sp<SkImage> SkImage::makeTextureImage(GrContext* context,
|
||||
const GrSurfaceProxyView* view = as_IB(this)->view(direct);
|
||||
SkASSERT(view && view->asTextureProxy());
|
||||
|
||||
if (mipMapped == GrMipmapped::kNo || view->asTextureProxy()->mipMapped() == mipMapped ||
|
||||
if (mipMapped == GrMipmapped::kNo || view->asTextureProxy()->mipmapped() == mipMapped ||
|
||||
!direct->priv().caps()->mipmapSupport()) {
|
||||
return sk_ref_sp(const_cast<SkImage*>(this));
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ bool SkImage_GpuYUVA::setupMipmapsForPlanes(GrRecordingContext* context) const {
|
||||
}
|
||||
for (int i = 0; i < fNumViews; ++i) {
|
||||
auto* t = fViews[i].asTextureProxy();
|
||||
if (t->mipMapped() == GrMipmapped::kNo && (t->width() > 1 || t->height() > 1)) {
|
||||
if (t->mipmapped() == GrMipmapped::kNo && (t->width() > 1 || t->height() > 1)) {
|
||||
if (!(newViews[i] = GrCopyBaseMipMapToView(context, fViews[i]))) {
|
||||
return false;
|
||||
}
|
||||
@ -187,7 +187,7 @@ void SkImage_GpuYUVA::flattenToRGB(GrRecordingContext* context) const {
|
||||
GrSurfaceProxyView SkImage_GpuYUVA::refMippedView(GrRecordingContext* context) const {
|
||||
// if invalid or already has miplevels
|
||||
this->flattenToRGB(context);
|
||||
if (!fRGBView || fRGBView.asTextureProxy()->mipMapped() == GrMipmapped::kYes) {
|
||||
if (!fRGBView || fRGBView.asTextureProxy()->mipmapped() == GrMipmapped::kYes) {
|
||||
return fRGBView;
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ GrSurfaceProxyView SkImage_Lazy::lockTextureProxyView(GrRecordingContext* ctx,
|
||||
GrSwizzle swizzle = caps->getReadSwizzle(proxy->backendFormat(), ct);
|
||||
GrSurfaceProxyView view(std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle);
|
||||
if (mipMapped == GrMipmapped::kNo ||
|
||||
view.asTextureProxy()->mipMapped() == GrMipmapped::kYes) {
|
||||
view.asTextureProxy()->mipmapped() == GrMipmapped::kYes) {
|
||||
return view;
|
||||
} else {
|
||||
// We need a mipped proxy, but we found a cached proxy that wasn't mipped. Thus we
|
||||
|
@ -120,7 +120,7 @@ sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(const SkIRect* subset) {
|
||||
// want to ever retarget the SkSurface at another buffer we create. Force a copy now to
|
||||
// avoid copy-on-write.
|
||||
auto rect = subset ? *subset : SkIRect::MakeSize(rtc->dimensions());
|
||||
srcView = GrSurfaceProxyView::Copy(context, std::move(srcView), rtc->mipMapped(), rect,
|
||||
srcView = GrSurfaceProxyView::Copy(context, std::move(srcView), rtc->mipmapped(), rect,
|
||||
SkBackingFit::kExact, budgeted);
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ bool SkSurface_Gpu::onCharacterize(SkSurfaceCharacterization* characterization)
|
||||
|
||||
size_t maxResourceBytes = direct->getResourceCacheLimit();
|
||||
|
||||
bool mipmapped = rtc->asTextureProxy() ? GrMipmapped::kYes == rtc->asTextureProxy()->mipMapped()
|
||||
bool mipmapped = rtc->asTextureProxy() ? GrMipmapped::kYes == rtc->asTextureProxy()->mipmapped()
|
||||
: false;
|
||||
|
||||
SkColorType ct = GrColorTypeToSkColorType(rtc->colorInfo().colorType());
|
||||
@ -310,7 +310,7 @@ bool SkSurface_Gpu::onIsCompatible(const SkSurfaceCharacterization& characteriza
|
||||
}
|
||||
|
||||
if (characterization.isMipMapped() &&
|
||||
GrMipmapped::kNo == rtc->asTextureProxy()->mipMapped()) {
|
||||
GrMipmapped::kNo == rtc->asTextureProxy()->mipmapped()) {
|
||||
// Fail if the DDL's surface was mipmapped but the replay surface is not.
|
||||
// Allow drawing to proceed if the DDL was not mipmapped but the replay surface is.
|
||||
return false;
|
||||
|
@ -116,9 +116,9 @@ void test_wrapping(GrDirectContext* dContext,
|
||||
GrTextureProxy* proxy = ib->peekProxy();
|
||||
REPORTER_ASSERT(reporter, proxy);
|
||||
|
||||
REPORTER_ASSERT(reporter, mipMapped == proxy->proxyMipMapped());
|
||||
REPORTER_ASSERT(reporter, mipMapped == proxy->proxyMipmapped());
|
||||
REPORTER_ASSERT(reporter, proxy->isInstantiated());
|
||||
REPORTER_ASSERT(reporter, mipMapped == proxy->mipMapped());
|
||||
REPORTER_ASSERT(reporter, mipMapped == proxy->mipmapped());
|
||||
|
||||
REPORTER_ASSERT(reporter, initialCount+1 == cache->getResourceCount());
|
||||
}
|
||||
|
@ -1197,7 +1197,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLTextureFlagsTest, reporter, ctxInfo) {
|
||||
|
||||
GrTextureProxy* backingProxy = ((SkImage_GpuBase*) image.get())->peekProxy();
|
||||
|
||||
REPORTER_ASSERT(reporter, backingProxy->mipMapped() == mipMapped);
|
||||
REPORTER_ASSERT(reporter, backingProxy->mipmapped() == mipMapped);
|
||||
if (GR_GL_TEXTURE_2D == target) {
|
||||
REPORTER_ASSERT(reporter, !backingProxy->hasRestrictedSampling());
|
||||
} else {
|
||||
|
@ -181,8 +181,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
|
||||
}
|
||||
|
||||
GrTextureProxy* proxy = surfaceContext->asTextureProxy();
|
||||
REPORTER_ASSERT(reporter, proxy->mipMapped() == GrMipmapped::kNo);
|
||||
REPORTER_ASSERT(reporter, proxy->peekTexture()->texturePriv().mipMapped() == GrMipmapped::kNo);
|
||||
REPORTER_ASSERT(reporter, proxy->mipmapped() == GrMipmapped::kNo);
|
||||
REPORTER_ASSERT(reporter, proxy->peekTexture()->texturePriv().mipmapped() == GrMipmapped::kNo);
|
||||
|
||||
REPORTER_ASSERT(reporter, proxy->textureType() == GrTextureType::kExternal);
|
||||
REPORTER_ASSERT(reporter,
|
||||
|
@ -92,14 +92,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) {
|
||||
}
|
||||
|
||||
if (GrMipmapped::kYes == mipMapped) {
|
||||
REPORTER_ASSERT(reporter, GrMipmapped::kYes == texture->texturePriv().mipMapped());
|
||||
REPORTER_ASSERT(reporter, GrMipmapped::kYes == texture->texturePriv().mipmapped());
|
||||
if (GrRenderable::kYes == renderable) {
|
||||
REPORTER_ASSERT(reporter, texture->texturePriv().mipMapsAreDirty());
|
||||
REPORTER_ASSERT(reporter, texture->texturePriv().mipmapsAreDirty());
|
||||
} else {
|
||||
REPORTER_ASSERT(reporter, !texture->texturePriv().mipMapsAreDirty());
|
||||
REPORTER_ASSERT(reporter, !texture->texturePriv().mipmapsAreDirty());
|
||||
}
|
||||
} else {
|
||||
REPORTER_ASSERT(reporter, GrMipmapped::kNo == texture->texturePriv().mipMapped());
|
||||
REPORTER_ASSERT(reporter, GrMipmapped::kNo == texture->texturePriv().mipmapped());
|
||||
}
|
||||
context->deleteBackendTexture(backendTex);
|
||||
}
|
||||
@ -284,11 +284,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
|
||||
}
|
||||
SkGpuDevice* device = ((SkSurface_Gpu*)surface.get())->getDevice();
|
||||
GrTextureProxy* texProxy = device->accessRenderTargetContext()->asTextureProxy();
|
||||
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped());
|
||||
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipmapped());
|
||||
|
||||
texProxy->instantiate(resourceProvider);
|
||||
GrTexture* texture = texProxy->peekTexture();
|
||||
REPORTER_ASSERT(reporter, mipMapped == texture->texturePriv().mipMapped());
|
||||
REPORTER_ASSERT(reporter, mipMapped == texture->texturePriv().mipmapped());
|
||||
|
||||
sk_sp<SkImage> image = surface->makeImageSnapshot();
|
||||
REPORTER_ASSERT(reporter, image);
|
||||
@ -296,11 +296,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn
|
||||
context->deleteBackendTexture(backendTex);
|
||||
}
|
||||
texProxy = as_IB(image)->peekProxy();
|
||||
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped());
|
||||
REPORTER_ASSERT(reporter, mipMapped == texProxy->mipmapped());
|
||||
|
||||
texProxy->instantiate(resourceProvider);
|
||||
texture = texProxy->peekTexture();
|
||||
REPORTER_ASSERT(reporter, mipMapped == texture->texturePriv().mipMapped());
|
||||
REPORTER_ASSERT(reporter, mipMapped == texture->texturePriv().mipmapped());
|
||||
|
||||
// Must flush the context to make sure all the cmds (copies, etc.) from above are sent
|
||||
// to the gpu before we delete the backendHandle.
|
||||
@ -401,7 +401,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
|
||||
// Mark the mipmaps clean to ensure things still work properly when they won't be marked
|
||||
// dirty again until GrRenderTask::makeClosed().
|
||||
mipmapProxy->markMipMapsClean();
|
||||
mipmapProxy->markMipmapsClean();
|
||||
|
||||
auto mipmapRTC = GrRenderTargetContext::Make(
|
||||
context.get(), colorType, nullptr, mipmapProxy, kTopLeft_GrSurfaceOrigin, nullptr);
|
||||
@ -414,7 +414,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
drawingManager->getLastRenderTask(mipmapProxy.get()));
|
||||
|
||||
// Mipmaps don't get marked dirty until makeClosed().
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipMapsAreDirty());
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipmapsAreDirty());
|
||||
|
||||
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
|
||||
GrSurfaceProxyView mipmapView(mipmapProxy, kTopLeft_GrSurfaceOrigin, swizzle);
|
||||
@ -432,7 +432,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
REPORTER_ASSERT(reporter, initialMipmapRegenTask);
|
||||
REPORTER_ASSERT(reporter,
|
||||
initialMipmapRegenTask != mipmapRTC->testingOnly_PeekLastOpsTask());
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipMapsAreDirty());
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipmapsAreDirty());
|
||||
|
||||
// Draw the now-clean mipmap texture into a second target.
|
||||
auto rtc2 = draw_mipmap_into_new_render_target(context.get(), proxyProvider, colorType,
|
||||
@ -442,7 +442,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
// Make sure the mipmap texture still has the same regen task.
|
||||
REPORTER_ASSERT(reporter,
|
||||
drawingManager->getLastRenderTask(mipmapProxy.get()) == initialMipmapRegenTask);
|
||||
SkASSERT(!mipmapProxy->mipMapsAreDirty());
|
||||
SkASSERT(!mipmapProxy->mipmapsAreDirty());
|
||||
|
||||
// Reset everything so we can go again, this time with the first draw not mipmapped.
|
||||
context->flushAndSubmit();
|
||||
@ -461,7 +461,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
mipmapRTCTask.get() == drawingManager->getLastRenderTask(mipmapProxy.get()));
|
||||
|
||||
// Mipmaps don't get marked dirty until makeClosed().
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipMapsAreDirty());
|
||||
REPORTER_ASSERT(reporter, !mipmapProxy->mipmapsAreDirty());
|
||||
|
||||
// Draw the dirty mipmap texture into a render target, but don't do mipmap filtering.
|
||||
rtc1 = draw_mipmap_into_new_render_target(context.get(), proxyProvider, colorType,
|
||||
@ -470,7 +470,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
// Mipmaps should have gotten marked dirty during makeClosed() when adding the dependency.
|
||||
// Since the last draw did not use mips, they will not have been regenerated and should
|
||||
// therefore still be dirty.
|
||||
REPORTER_ASSERT(reporter, mipmapProxy->mipMapsAreDirty());
|
||||
REPORTER_ASSERT(reporter, mipmapProxy->mipmapsAreDirty());
|
||||
|
||||
// Since mips weren't regenerated, the last render task shouldn't have changed.
|
||||
REPORTER_ASSERT(reporter,
|
||||
@ -487,7 +487,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) {
|
||||
auto mipRegenTask2 = drawingManager->getLastRenderTask(mipmapProxy.get());
|
||||
REPORTER_ASSERT(reporter, mipRegenTask2);
|
||||
REPORTER_ASSERT(reporter, mipmapRTCTask.get() != mipRegenTask2);
|
||||
SkASSERT(!mipmapProxy->mipMapsAreDirty());
|
||||
SkASSERT(!mipmapProxy->mipmapsAreDirty());
|
||||
|
||||
// Mip regen tasks don't get added as dependencies until makeClosed().
|
||||
context->flushAndSubmit();
|
||||
|
@ -422,7 +422,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadOnlyTexture, reporter, context_info) {
|
||||
proxy = proxyProvider->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership,
|
||||
GrWrapCacheable::kNo, ioType);
|
||||
context->flushAndSubmit();
|
||||
proxy->peekTexture()->texturePriv().markMipMapsDirty(); // avoids assert in GrGpu.
|
||||
proxy->peekTexture()->texturePriv().markMipmapsDirty(); // avoids assert in GrGpu.
|
||||
auto regenResult =
|
||||
context->priv().getGpu()->regenerateMipMapLevels(proxy->peekTexture());
|
||||
REPORTER_ASSERT(reporter, regenResult == (ioType == kRW_GrIOType));
|
||||
|
@ -24,12 +24,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrTextureMipMapInvalidationTest, reporter, ct
|
||||
auto isMipped = [] (SkSurface* surf) {
|
||||
SkImage_GpuBase* image = static_cast<SkImage_GpuBase*>(as_IB(surf->makeImageSnapshot()));
|
||||
const GrTexture* texture = image->getTexture();
|
||||
return GrMipmapped::kYes == texture->texturePriv().mipMapped();
|
||||
return GrMipmapped::kYes == texture->texturePriv().mipmapped();
|
||||
};
|
||||
|
||||
auto mipsAreDirty = [] (SkSurface* surf) {
|
||||
SkImage_GpuBase* image = static_cast<SkImage_GpuBase*>(as_IB(surf->makeImageSnapshot()));
|
||||
return image->getTexture()->texturePriv().mipMapsAreDirty();
|
||||
return image->getTexture()->texturePriv().mipmapsAreDirty();
|
||||
};
|
||||
|
||||
auto info = SkImageInfo::MakeN32Premul(256, 256);
|
||||
|
@ -422,11 +422,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_makeTextureImage, reporter, contextIn
|
||||
SkASSERT(copyProxy);
|
||||
bool shouldBeMipped =
|
||||
mipMapped == GrMipmapped::kYes && context->priv().caps()->mipmapSupport();
|
||||
if (shouldBeMipped && copyProxy->mipMapped() == GrMipmapped::kNo) {
|
||||
if (shouldBeMipped && copyProxy->mipmapped() == GrMipmapped::kNo) {
|
||||
ERRORF(reporter, "makeTextureImage returned non-mipmapped texture.");
|
||||
continue;
|
||||
}
|
||||
bool origIsMipped = origProxy && origProxy->mipMapped() == GrMipmapped::kYes;
|
||||
bool origIsMipped = origProxy && origProxy->mipmapped() == GrMipmapped::kYes;
|
||||
if (image->isTextureBacked() && (!shouldBeMipped || origIsMipped)) {
|
||||
if (origProxy->underlyingUniqueID() != copyProxy->underlyingUniqueID()) {
|
||||
ERRORF(reporter, "makeTextureImage made unnecessary texture copy.");
|
||||
|
@ -164,8 +164,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SkASSERT(rectProxy->mipMapped() == GrMipmapped::kNo);
|
||||
SkASSERT(rectProxy->peekTexture()->texturePriv().mipMapped() == GrMipmapped::kNo);
|
||||
SkASSERT(rectProxy->mipmapped() == GrMipmapped::kNo);
|
||||
SkASSERT(rectProxy->peekTexture()->texturePriv().mipmapped() == GrMipmapped::kNo);
|
||||
|
||||
SkASSERT(rectProxy->textureType() == GrTextureType::kRectangle);
|
||||
SkASSERT(rectProxy->peekTexture()->texturePriv().textureType() ==
|
||||
|
Loading…
Reference in New Issue
Block a user