Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1300)

Unified Diff: src/gpu/gl/GrGLCaps.cpp

Issue 1584473002: Swizzle shader output and blend when using GL_RED to implement kAlpha_8_GrPixelConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@hideformats
Patch Set: Address comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrSwizzle.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLCaps.cpp
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 5605babcec8f9cd7cf12d5a865bd85f4ee8e343e..678c62abb82c92ebc62d20e5e21ea6b6d5198e37 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;
« no previous file with comments | « src/gpu/GrSwizzle.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698