Add workaround for Gallium TexImage internalFormat for Alpha8

Bug: skia:
Change-Id: I1e243d8c58b533bcbbc446d189d76fda5c61b3fb
Reviewed-on: https://skia-review.googlesource.com/64067
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2017-10-26 15:15:47 -04:00 committed by Skia Commit-Bot
parent ec56f277ff
commit 8713b88332

View File

@ -2142,6 +2142,14 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
fConfigTable[i].fFormats.fSizedInternalFormat :
fConfigTable[i].fFormats.fBaseInternalFormat;
}
// Gallium llvmpipe renderer on ES 3.0 does not have R8 so we use Alpha for
// kAlpha_8_GrPixelConfig. Alpha8 is not a valid signed internal format so we must use the base
// internal format for that config when doing TexImage calls.
if(kGalliumLLVM_GrGLRenderer == ctxInfo.renderer()) {
fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fInternalFormatTexImage =
fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat;
}
// OpenGL ES 2.0 + GL_EXT_sRGB allows GL_SRGB_ALPHA to be specified as the <format>
// param to Tex(Sub)Image. ES 2.0 requires the <internalFormat> and <format> params to match.
// Thus, on ES 2.0 we will use GL_SRGB_ALPHA as the <format> param.