| Index: src/gpu/gl/GrGLCaps.cpp
|
| diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
|
| index 1d25a2ca2f47eba5fcf1d4362387f9467983b1c4..389690fab84b4728b75b92291d14242f1ae14fc6 100644
|
| --- a/src/gpu/gl/GrGLCaps.cpp
|
| +++ b/src/gpu/gl/GrGLCaps.cpp
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "GrGLCaps.h"
|
|
|
| +#include "GrContextOptions.h"
|
| #include "GrGLContext.h"
|
| #include "glsl/GrGLSLCaps.h"
|
| #include "SkTSearch.h"
|
| @@ -491,6 +492,8 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
| this->initConfigTexturableTable(ctxInfo, gli, srgbSupport);
|
| this->initConfigRenderableTable(ctxInfo, srgbSupport);
|
| this->initShaderPrecisionTable(ctxInfo, gli, glslCaps);
|
| + // Requires fTexutreSwizzleSupport and fTextureRedSupport to be set before this point.
|
| + this->initConfigSwizzleTable(glslCaps);
|
|
|
| this->applyOptionsOverrides(contextOptions);
|
| glslCaps->applyOptionsOverrides(contextOptions);
|
| @@ -1280,6 +1283,36 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo,
|
| }
|
| }
|
|
|
| +void GrGLCaps::initConfigSwizzleTable(GrGLSLCaps* glslCaps) {
|
| + glslCaps->fMustSwizzleInShader = !this->textureSwizzleSupport();
|
|
|
| + glslCaps->fConfigSwizzle[kUnknown_GrPixelConfig] = nullptr;
|
| + if (fTextureRedSupport) {
|
| + glslCaps->fConfigSwizzle[kAlpha_8_GrPixelConfig] = "rrrr";
|
| + glslCaps->fConfigSwizzle[kAlpha_half_GrPixelConfig] = "rrrr";
|
| + } else {
|
| + glslCaps->fConfigSwizzle[kAlpha_8_GrPixelConfig] = "aaaa";
|
| + glslCaps->fConfigSwizzle[kAlpha_half_GrPixelConfig] = "aaaa";
|
| + }
|
| + glslCaps->fConfigSwizzle[kIndex_8_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kRGB_565_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kRGBA_4444_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kRGBA_8888_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kBGRA_8888_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kSRGBA_8888_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kETC1_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kLATC_GrPixelConfig] = "rrrr";
|
| + glslCaps->fConfigSwizzle[kR11_EAC_GrPixelConfig] = "rrrr";
|
| + glslCaps->fConfigSwizzle[kASTC_12x12_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kRGBA_float_GrPixelConfig] = "rgba";
|
| + glslCaps->fConfigSwizzle[kRGBA_half_GrPixelConfig] = "rgba";
|
| +
|
| +}
|
| +
|
| +void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {
|
| + if (options.fUseShaderSwizzling) {
|
| + fTextureSwizzleSupport = false;
|
| + }
|
| +}
|
|
|
|
|
|
|