Construct mipmaps for internal YUVA planes
Bug: skia:7901 Change-Id: I4d42ad752b18cc1cfbbb5d41eafc499c0541858b Reviewed-on: https://skia-review.googlesource.com/c/169242 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
dcc9d0668c
commit
f542cabaf7
@ -98,11 +98,10 @@ std::unique_ptr<GrFragmentProcessor> GrYUVAImageTextureMaker::createFragmentProc
|
||||
filterOrNullForBicubic);
|
||||
}
|
||||
|
||||
// Check to see if the client has given us pre-mipped textures
|
||||
// Check to see if the client has given us pre-mipped textures or we can generate them
|
||||
// If not, fall back to bilerp
|
||||
// TODO: investigate flattening the image and generating miplevels
|
||||
GrSamplerState::Filter filter = *filterOrNullForBicubic;
|
||||
if (GrSamplerState::Filter::kMipMap == filter && !fImage->canBeMipmapped(fContext)) {
|
||||
if (GrSamplerState::Filter::kMipMap == filter && !fImage->setupMipmapsForPlanes()) {
|
||||
filter = GrSamplerState::Filter::kBilerp;
|
||||
}
|
||||
|
||||
@ -110,4 +109,3 @@ std::unique_ptr<GrFragmentProcessor> GrYUVAImageTextureMaker::createFragmentProc
|
||||
fImage->fYUVColorSpace, filter);
|
||||
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ SkImageInfo SkImage_GpuYUVA::onImageInfo() const {
|
||||
fAlphaType, fColorSpace);
|
||||
}
|
||||
|
||||
bool SkImage_GpuYUVA::canBeMipmapped(GrContext* context) const {
|
||||
bool SkImage_GpuYUVA::setupMipmapsForPlanes() const {
|
||||
int numTextures;
|
||||
if (!SkYUVAIndex::AreValidIndices(fYUVAIndices, &numTextures)) {
|
||||
return false;
|
||||
@ -69,7 +69,11 @@ bool SkImage_GpuYUVA::canBeMipmapped(GrContext* context) const {
|
||||
fProxies[i].get(),
|
||||
GrSamplerState::Filter::kMipMap,
|
||||
©Params)) {
|
||||
return false;
|
||||
auto mippedProxy = GrCopyBaseMipMapToTextureProxy(fContext.get(), fProxies[i].get());
|
||||
if (!mippedProxy) {
|
||||
return false;
|
||||
}
|
||||
fProxies[i] = mippedProxy;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool canBeMipmapped(GrContext* context) const;
|
||||
bool setupMipmapsForPlanes() const;
|
||||
|
||||
// Returns a ref-ed texture proxy with miplevels
|
||||
sk_sp<GrTextureProxy> asMippedTextureProxyRef() const;
|
||||
@ -112,7 +112,7 @@ public:
|
||||
private:
|
||||
// This array will usually only be sparsely populated.
|
||||
// The actual non-null fields are dictated by the 'fYUVAIndices' indices
|
||||
sk_sp<GrTextureProxy> fProxies[4];
|
||||
mutable sk_sp<GrTextureProxy> fProxies[4];
|
||||
SkYUVAIndex fYUVAIndices[4];
|
||||
// This is only allocated when the image needs to be flattened rather than
|
||||
// using the separate YUVA planes. From thence forth we will only use the
|
||||
|
Loading…
Reference in New Issue
Block a user