Use GL_R8 rather than GL_RED for glTexImage2D on IMG/ES3. Check for failure of FP creation in SkImageFilter

BUG=skia:2922

Review URL: https://codereview.chromium.org/656853002
This commit is contained in:
bsalomon 2014-10-14 08:40:57 -07:00 committed by Commit bot
parent e070c2bf54
commit b501ecd0d7
2 changed files with 16 additions and 14 deletions

View File

@ -269,18 +269,18 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
bounds.offset(-srcOffset);
SkMatrix matrix(ctx.ctm());
matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
this->asFragmentProcessor(&fp, srcTexture, matrix, bounds);
SkASSERT(fp);
GrPaint paint;
paint.addColorProcessor(fp)->unref();
context->drawRectToRect(paint, dstRect, srcRect);
if (this->asFragmentProcessor(&fp, srcTexture, matrix, bounds)) {
SkASSERT(fp);
GrPaint paint;
paint.addColorProcessor(fp)->unref();
context->drawRectToRect(paint, dstRect, srcRect);
SkAutoTUnref<GrTexture> resultTex(dst.detach());
WrapTexture(resultTex, bounds.width(), bounds.height(), result);
return true;
#else
return false;
SkAutoTUnref<GrTexture> resultTex(dst.detach());
WrapTexture(resultTex, bounds.width(), bounds.height(), result);
return true;
}
#endif
return false;
}
bool SkImageFilter::applyCropRect(const Context& ctx, const SkBitmap& src,

View File

@ -587,11 +587,13 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
// size of the internal format whenever possible and so only use a sized internal format when
// using texture storage.
bool useSizedFormat = useTexStorage;
// At least some versions of the desktop ES3 drivers for NVIDIA won't accept GL_RED in
// At least some versions of the ES3 drivers for NVIDIA and IMG won't accept GL_RED in
// glTexImage2D for the internal format but will accept GL_R8.
if (!useSizedFormat && kNVIDIA_GrGLVendor == this->glContext().vendor() &&
kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_VER(3, 0)) {
useSizedFormat = true;
if (kNVIDIA_GrGLVendor == this->glContext().vendor() ||
kImagination_GrGLVendor == this->glContext().vendor()) {
if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_VER(3, 0)) {
useSizedFormat = true;
}
}
if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat,
&externalFormat, &externalType)) {