diff options
author | 2012-04-30 19:02:08 +0000 | |
---|---|---|
committer | 2012-04-30 19:02:08 +0000 | |
commit | 0048469578b15aae90f1427895ef6186f00ac7bf (patch) | |
tree | fd1e808fb1e6757c27bbfd06322b705f123bfbd6 | |
parent | 8790fc635e5a9f24d1fa6291449efe436324fefd (diff) |
Roll back http://code.google.com/p/skia/source/detail?r=3622 to deal with http://crbug.com/125596 ('M20 windows renderer stability maze')
git-svn-id: http://skia.googlecode.com/svn/trunk@3800 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | gyp/tests.gyp | 1 | ||||
-rw-r--r-- | include/gpu/gl/GrGLDefines.h | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 10 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgram.cpp | 10 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgram.h | 25 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 44 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGLShaders.cpp | 16 |
8 files changed, 24 insertions, 88 deletions
diff --git a/gyp/tests.gyp b/gyp/tests.gyp index 58039ba6c7..aea125a226 100644 --- a/gyp/tests.gyp +++ b/gyp/tests.gyp @@ -59,7 +59,6 @@ '../tests/QuickRejectTest.cpp', '../tests/Reader32Test.cpp', '../tests/ReadPixelsTest.cpp', - '../tests/ReadWriteAlphaTest.cpp', '../tests/RefDictTest.cpp', '../tests/RegionTest.cpp', '../tests/ScalarTest.cpp', diff --git a/include/gpu/gl/GrGLDefines.h b/include/gpu/gl/GrGLDefines.h index 0e03b556f1..af8c2a898b 100644 --- a/include/gpu/gl/GrGLDefines.h +++ b/include/gpu/gl/GrGLDefines.h @@ -300,8 +300,6 @@ #define GR_GL_PALETTE8_RGBA8 0x8B96 #define GR_GL_ALPHA8 0x803C -#define GR_GL_R8 0x8229 - /* PixelType */ /* GL_UNSIGNED_BYTE */ #define GR_GL_UNSIGNED_SHORT_4_4_4_4 0x8033 diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 797abb4d80..d40cf604ac 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -33,7 +33,6 @@ void GrGLCaps::reset() { fPackFlipYSupport = false; fTextureUsageSupport = false; fTexStorageSupport = false; - fTextureRedSupport = false; } GrGLCaps::GrGLCaps(const GrGLCaps& caps) { @@ -59,7 +58,6 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { fPackFlipYSupport = caps.fPackFlipYSupport; fTextureUsageSupport = caps.fTextureUsageSupport; fTexStorageSupport = caps.fTexStorageSupport; - fTextureRedSupport = caps.fTextureRedSupport; return *this; } @@ -137,14 +135,6 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo) { ctxInfo.hasExtension("GL_ARB_texture_storage") || ctxInfo.hasExtension("GL_EXT_texture_storage"); - // ARB_texture_rg is part of OpenGL 3.0 - if (kDesktop_GrGLBinding == binding) { - fTextureRedSupport = version >= GR_GL_VER(3,0) || - ctxInfo.hasExtension("GL_ARB_texture_rg"); - } else { - fTextureRedSupport = ctxInfo.hasExtension("GL_EXT_texture_rg"); - } - this->initFSAASupport(ctxInfo); this->initStencilFormats(ctxInfo); } diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index eb095765c6..c5d1d05007 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -206,9 +206,6 @@ public: /// Is there support for glTexStorage bool texStorageSupport() const { return fTexStorageSupport; } - /// Is there support for GL_RED and GL_R8 - bool textureRedSupport() const { return fTextureRedSupport; } - private: /** * Maintains a bit per GrPixelConfig. It is used to avoid redundantly @@ -276,7 +273,6 @@ private: bool fPackFlipYSupport : 1; bool fTextureUsageSupport : 1; bool fTexStorageSupport : 1; - bool fTextureRedSupport : 1; }; #endif diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 3e1f1d40c2..cb90ac6a72 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -1942,17 +1942,11 @@ void GrGLProgram::genStageCode(const GrGLContextInfo& gl, const char* swizzle = ""; if (desc.fInConfigFlags & StageDesc::kSwapRAndB_InConfigFlag) { GrAssert(!(desc.fInConfigFlags & StageDesc::kSmearAlpha_InConfigFlag)); - GrAssert(!(desc.fInConfigFlags & StageDesc::kSmearRed_InConfigFlag)); swizzle = ".bgra"; } else if (desc.fInConfigFlags & StageDesc::kSmearAlpha_InConfigFlag) { GrAssert(!(desc.fInConfigFlags & kMulByAlphaMask)); - GrAssert(!(desc.fInConfigFlags & StageDesc::kSmearRed_InConfigFlag)); swizzle = ".aaaa"; - } else if (desc.fInConfigFlags & StageDesc::kSmearRed_InConfigFlag) { - GrAssert(!(desc.fInConfigFlags & kMulByAlphaMask)); - GrAssert(!(desc.fInConfigFlags & StageDesc::kSmearAlpha_InConfigFlag)); - swizzle = ".rrrr"; - } + } GrStringBuilder modulate; if (NULL != fsInColor) { @@ -2002,8 +1996,6 @@ void GrGLProgram::genStageCode(const GrGLContextInfo& gl, GrAssert(GrIsPow2(kMulByAlphaMask & desc.fInConfigFlags)); GrAssert(!(desc.fInConfigFlags & StageDesc::kSmearAlpha_InConfigFlag)); - GrAssert(!(desc.fInConfigFlags & - StageDesc::kSmearRed_InConfigFlag)); segments->fFSCode.appendf("\t%s = %s(%s, %s)%s;\n", fsOutColor, texFunc.c_str(), samplerName, sampleCoords.c_str(), diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index 73bfa949a6..91ee95cd93 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -122,7 +122,7 @@ public: described are performed after reading a texel. */ enum InConfigFlags { - kNone_InConfigFlag = 0x00, + kNone_InConfigFlag = 0x0, /** Swap the R and B channels. This is incompatible with @@ -130,24 +130,15 @@ public: the shader using GL_ARB_texture_swizzle if possible rather than setting this flag. */ - kSwapRAndB_InConfigFlag = 0x01, + kSwapRAndB_InConfigFlag = 0x1, /** Smear alpha across all four channels. This is incompatible with - kSwapRAndB, kMulRGBByAlpha* and kSmearRed. It is prefereable - to perform the smear outside the shader using - GL_ARB_texture_swizzle if possible rather than setting this - flag. + kSwapRAndB and kMulRGBByAlpha*. It is prefereable to perform + the smear outside the shader using GL_ARB_texture_swizzle if + possible rather than setting this flag. */ - kSmearAlpha_InConfigFlag = 0x02, - - /** - Smear the red channel across all four channels. This flag is - incompatible with kSwapRAndB, kMulRGBByAlpha*and kSmearAlpha. - It is preferable to use GL_ARB_texture_swizzle instead of this - flag. - */ - kSmearRed_InConfigFlag = 0x04, + kSmearAlpha_InConfigFlag = 0x2, /** Multiply r,g,b by a after texture reads. This flag incompatible @@ -158,8 +149,8 @@ public: of 1/255.0 and the other rounds down. At most one of these flags may be set. */ - kMulRGBByAlpha_RoundUp_InConfigFlag = 0x08, - kMulRGBByAlpha_RoundDown_InConfigFlag = 0x10, + kMulRGBByAlpha_RoundUp_InConfigFlag = 0x4, + kMulRGBByAlpha_RoundDown_InConfigFlag = 0x8, kDummyInConfigFlag, kInConfigBitMask = (kDummyInConfigFlag-1) | diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 3b5fffe7ef..5f8772e6e5 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -322,8 +322,7 @@ void GrGpuGL::fillInConfigRenderableTable() { } } else { // On ES we can only hope for R8 - fConfigRenderSupport[kAlpha_8_GrPixelConfig] = - this->glCaps().textureRedSupport(); + fConfigRenderSupport[kAlpha_8_GrPixelConfig] = false; } if (kDesktop_GrGLBinding != this->glBinding()) { @@ -2044,20 +2043,12 @@ unsigned gr_to_gl_filter(GrSamplerState::Filter filter) { } } -// get_swizzle is only called from this .cpp so it is OK to inline it here -inline const GrGLenum* get_swizzle(GrPixelConfig config, - const GrSamplerState& sampler, - const GrGLCaps& glCaps) { +const GrGLenum* get_swizzle(GrPixelConfig config, + const GrSamplerState& sampler) { if (GrPixelConfigIsAlphaOnly(config)) { - if (glCaps.textureRedSupport()) { - static const GrGLenum gRedSmear[] = { GR_GL_RED, GR_GL_RED, - GR_GL_RED, GR_GL_RED }; - return gRedSmear; - } else { - static const GrGLenum gAlphaSmear[] = { GR_GL_ALPHA, GR_GL_ALPHA, - GR_GL_ALPHA, GR_GL_ALPHA }; - return gAlphaSmear; - } + static const GrGLenum gAlphaSmear[] = { GR_GL_ALPHA, GR_GL_ALPHA, + GR_GL_ALPHA, GR_GL_ALPHA }; + return gAlphaSmear; } else if (sampler.swapsRAndB()) { static const GrGLenum gRedBlueSwap[] = { GR_GL_BLUE, GR_GL_GREEN, GR_GL_RED, GR_GL_ALPHA }; @@ -2137,7 +2128,7 @@ bool GrGpuGL::flushGLStateCommon(GrPrimitiveType type) { newTexParams.fWrapS = wraps[sampler.getWrapX()]; newTexParams.fWrapT = wraps[sampler.getWrapY()]; memcpy(newTexParams.fSwizzleRGBA, - get_swizzle(nextTexture->config(), sampler, this->glCaps()), + get_swizzle(nextTexture->config(), sampler), sizeof(newTexParams.fSwizzleRGBA)); if (setAll || newTexParams.fFilter != oldTexParams.fFilter) { setTextureUnit(s); @@ -2379,25 +2370,14 @@ bool GrGpuGL::configToGLFormats(GrPixelConfig config, } break; case kAlpha_8_GrPixelConfig: - if (this->glCaps().textureRedSupport()) { - *internalFormat = GR_GL_RED; - *externalFormat = GR_GL_RED; - if (getSizedInternalFormat) { - *internalFormat = GR_GL_R8; - } else { - *internalFormat = GR_GL_RED; - } - *externalType = GR_GL_UNSIGNED_BYTE; + *internalFormat = GR_GL_ALPHA; + *externalFormat = GR_GL_ALPHA; + if (getSizedInternalFormat) { + *internalFormat = GR_GL_ALPHA8; } else { *internalFormat = GR_GL_ALPHA; - *externalFormat = GR_GL_ALPHA; - if (getSizedInternalFormat) { - *internalFormat = GR_GL_ALPHA8; - } else { - *internalFormat = GR_GL_ALPHA; - } - *externalType = GR_GL_UNSIGNED_BYTE; } + *externalType = GR_GL_UNSIGNED_BYTE; break; default: return false; diff --git a/src/gpu/gl/GrGpuGLShaders.cpp b/src/gpu/gl/GrGpuGLShaders.cpp index 1fcfbbee2b..88c81ab337 100644 --- a/src/gpu/gl/GrGpuGLShaders.cpp +++ b/src/gpu/gl/GrGpuGLShaders.cpp @@ -181,7 +181,6 @@ bool GrGpuGLShaders::programUnitTest() { StageDesc::kMulRGBByAlpha_RoundUp_InConfigFlag, StageDesc::kMulRGBByAlpha_RoundDown_InConfigFlag, StageDesc::kSmearAlpha_InConfigFlag, - StageDesc::kSmearRed_InConfigFlag, }; GrGLProgram program; ProgramDesc& pdesc = program.fProgramDesc; @@ -277,7 +276,6 @@ bool GrGpuGLShaders::programUnitTest() { static const uint32_t kMulByAlphaMask = StageDesc::kMulRGBByAlpha_RoundUp_InConfigFlag | StageDesc::kMulRGBByAlpha_RoundDown_InConfigFlag; - switch (stage.fFetchMode) { case StageDesc::kSingle_FetchMode: stage.fKernelWidth = 0; @@ -1172,17 +1170,9 @@ void GrGpuGLShaders::buildProgram(GrPrimitiveType type, if (!this->glCaps().textureSwizzleSupport()) { if (GrPixelConfigIsAlphaOnly(texture->config())) { // if we don't have texture swizzle support then - // the shader must smear the single channel after - // reading the texture - if (this->glCaps().textureRedSupport()) { - // we can use R8 textures so use kSmearRed - stage.fInConfigFlags |= - StageDesc::kSmearRed_InConfigFlag; - } else { - // we can use A8 textures so use kSmearAlpha - stage.fInConfigFlags |= - StageDesc::kSmearAlpha_InConfigFlag; - } + // the shader must do an alpha smear after reading + // the texture + stage.fInConfigFlags |= StageDesc::kSmearAlpha_InConfigFlag; } else if (sampler.swapsRAndB()) { stage.fInConfigFlags |= StageDesc::kSwapRAndB_InConfigFlag; } |