diff options
author | Brian Osman <brianosman@google.com> | 2017-01-09 15:32:57 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-10 16:20:03 +0000 |
commit | f2956459f707de596dcb2c79a7ee1fa62d599c0d (patch) | |
tree | 4c558c871bd88d8d599162b63864ce7083f58f0e /src/gpu/gl/GrGLCaps.cpp | |
parent | e98234f231d66848e149db683c11b6388e10b233 (diff) |
Add Gray8 pixel config
This is still just linear (non-sRGB), but adding sRGB will
be the next step. I've verified that this is really making
R8 textures when uploading Gray8 bitmaps. Tests pass, and
the all_bitmap_configs GM still renders correctly (unlike
when we just mapped Gray8 to Alpha8).
This adds another pixel config, which could grow our cache
footprint, but the benefits of not using 4bpp for 1bpp data
should outweigh that?
BUG=skia:6110
Change-Id: I4fc4c2479fc25f1d278e174a9bb5b542a0cb184c
Reviewed-on: https://skia-review.googlesource.com/6817
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/gl/GrGLCaps.cpp')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index d3adc28d4c..bd9380cd20 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -1756,6 +1756,39 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; } + if (this->textureRedSupport()) { + fConfigTable[kGray_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RED; + fConfigTable[kGray_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_R8; + fConfigTable[kGray_8_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = + GR_GL_RED; + fConfigTable[kGray_8_GrPixelConfig].fSwizzle = GrSwizzle::RRRA(); + if (texelBufferSupport) { + fConfigTable[kGray_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; + } + } else { + fConfigTable[kGray_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_LUMINANCE; + fConfigTable[kGray_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_LUMINANCE8; + fConfigTable[kGray_8_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = + GR_GL_LUMINANCE; + fConfigTable[kGray_8_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); + } + fConfigTable[kGray_8_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_BYTE; + fConfigTable[kGray_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType; + fConfigTable[kGray_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; +#if 0 // Leaving Gray8 as non-renderable, to keep things simple and match raster + if (this->textureRedSupport() || + (kDesktop_ARB_MSFBOType == this->msFBOType() && + ctxInfo.renderer() != kOSMesa_GrGLRenderer)) { + // desktop ARB extension/3.0+ supports LUMINANCE8 as renderable. + // However, osmesa fails if it used even when GL_ARB_framebuffer_object is present. + // Core profile removes LUMINANCE8 support, but we should have chosen R8 in that case. + fConfigTable[kGray_8_GrPixelConfig].fFlags |= allRenderFlags; + } +#endif + if (texStorageSupported) { + fConfigTable[kGray_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; + } + // Check for [half] floating point texture support // NOTE: We disallow floating point textures on ES devices if linear filtering modes are not // supported. This is for simplicity, but a more granular approach is possible. Coincidentally, |