diff options
author | bsalomon <bsalomon@google.com> | 2016-01-12 13:29:26 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-12 13:29:26 -0800 |
commit | 7f9b2e4a45775e8cdd3f98260a66c0c6e1840550 (patch) | |
tree | 2634c3fe68d98ece6e9a30a4db7a251303c587ca /src/gpu/gl/GrGLCaps.cpp | |
parent | 87a721b2465c9ccfa191ce9f5012f92be7731fbc (diff) |
Swizzle shader output and blend when using GL_RED to implement kAlpha_8_GrPixelConfig
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1584473002
Review URL: https://codereview.chromium.org/1584473002
Diffstat (limited to 'src/gpu/gl/GrGLCaps.cpp')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 5605babcec..678c62abb8 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -1548,6 +1548,19 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa } } + // Shader output swizzles will default to RGBA. When we've use GL_RED instead of GL_ALPHA to + // implement kAlpha_8_GrPixelConfig we need to swizzle the shader outputs so the alpha channel + // gets written to the single component. + if (this->textureRedSupport()) { + for (int i = 0; i < kGrPixelConfigCnt; ++i) { + GrPixelConfig config = static_cast<GrPixelConfig>(i); + if (GrPixelConfigIsAlphaOnly(config) && + fConfigTable[i].fFormats.fBaseInternalFormat == GR_GL_RED) { + glslCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA(); + } + } + } + #ifdef SK_DEBUG // Make sure we initialized everything. ConfigInfo defaultEntry; |