GrContext option to prevent GPU based YUV -> RGB
Rob and I spent a long time debugging why this wasn't working for Flutter - doing the more complex operations on the loading thread produces a blank texture when it's used later on the drawing thread. Limiting ourselves to just creating and uploading RGBA data fixes that. We need to debug what's going wrong, but in the meantime, this lets Flutter use Skia APIs to manage GPU uploading and lifetime of texture-backed images, while still doing those uploads on their IO thread. BUG=skia: Change-Id: Ibf5c37f2439814544beab8c93c2a646f7a9e779d Reviewed-on: https://skia-review.googlesource.com/8443 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
431815dcfb
commit
46da1cc9f2
@ -394,6 +394,7 @@ private:
|
||||
GrAtlasGlyphCache* fAtlasGlyphCache;
|
||||
std::unique_ptr<GrTextBlobCache> fTextBlobCache;
|
||||
|
||||
bool fDisableGpuYUVConversion;
|
||||
bool fDidTestPMConversions;
|
||||
int fPMToUPMConversion;
|
||||
int fUPMToPMConversion;
|
||||
|
@ -85,6 +85,12 @@ struct GrContextOptions {
|
||||
* sRGB support.
|
||||
*/
|
||||
bool fRequireDecodeDisableForSRGB = true;
|
||||
|
||||
/**
|
||||
* If true, the GPU will not be used to perform YUV -> RGB conversion when generating
|
||||
* textures from codec-backed images.
|
||||
*/
|
||||
bool fDisableGpuYUVConversion = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrContext.h"
|
||||
#include "GrContextPriv.h"
|
||||
#include "GrGpuResourcePriv.h"
|
||||
#include "GrImageTextureMaker.h"
|
||||
#include "GrResourceKey.h"
|
||||
@ -569,7 +570,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& ori
|
||||
#endif
|
||||
|
||||
// 4. Ask the generator to return YUV planes, which the GPU can convert
|
||||
{
|
||||
if (!ctx->contextPriv().disableGpuYUVConversion()) {
|
||||
ScopedGenerator generator(fSharedGenerator);
|
||||
Generator_GrYUVProvider provider(generator);
|
||||
sk_sp<GrTexture> tex = provider.refAsTexture(ctx, desc, true);
|
||||
|
@ -91,6 +91,7 @@ void GrContext::initCommon(const GrContextOptions& options) {
|
||||
fResourceCache = new GrResourceCache(fCaps);
|
||||
fResourceProvider = new GrResourceProvider(fGpu, fResourceCache, &fSingleOwner);
|
||||
|
||||
fDisableGpuYUVConversion = options.fDisableGpuYUVConversion;
|
||||
fDidTestPMConversions = false;
|
||||
|
||||
GrRenderTargetOpList::Options rtOpListOptions;
|
||||
|
@ -57,6 +57,8 @@ public:
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* = nullptr);
|
||||
|
||||
bool disableGpuYUVConversion() const { return fContext->fDisableGpuYUVConversion; }
|
||||
|
||||
private:
|
||||
explicit GrContextPriv(GrContext* context) : fContext(context) {}
|
||||
GrContextPriv(const GrContextPriv&) {} // unimpl
|
||||
|
Loading…
Reference in New Issue
Block a user