diff options
author | 2014-12-12 05:58:06 -0800 | |
---|---|---|
committer | 2014-12-12 05:58:06 -0800 | |
commit | a60b2ead80c5442f35fb9109380ead98865e61be (patch) | |
tree | 4b01c193561810cb136b28dba344b7fb0186f745 /src/gpu/gl | |
parent | b5f4961b30c99afa15775d63df6b605aaecdced8 (diff) |
Fix float and half float support on mobile.
It's unclear what params should be used for half float alpha
rendertargets, so they are disabled for the moment.
Review URL: https://codereview.chromium.org/799593002
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 19 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 12 |
2 files changed, 20 insertions, 11 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index ea34a0046d..8b26282968 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -470,21 +470,28 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { } if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) { - fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true; if (kGL_GrGLStandard == standard) { + fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true; fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = true; } else { - // for now we don't support float point MSAA on ES + if (ctxInfo.hasExtension("GL_EXT_color_buffer_float")) { + fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true; + } else { + fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = false; + } + // for now we don't support floating point MSAA on ES fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false; } } if (this->isConfigTexturable(kAlpha_half_GrPixelConfig)) { - fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true; if (kGL_GrGLStandard == standard) { + fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true; fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = true; } else { - // for now we don't support float point MSAA on ES + // in theory, check for "GL_EXT_color_buffer_half_float" + // for now we don't support half float alpha render target on ES + fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = false; fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false; } } @@ -620,7 +627,7 @@ void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G bool hasFPTextures = version >= GR_GL_VER(3, 1); if (!hasFPTextures) { hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") || - (ctxInfo.hasExtension("OES_texture_float_linear") && + (ctxInfo.hasExtension("GL_OES_texture_float_linear") && ctxInfo.hasExtension("GL_OES_texture_float")); } fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures; @@ -633,7 +640,7 @@ void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G bool hasHalfFPTextures = version >= GR_GL_VER(3, 1); if (!hasHalfFPTextures) { hasHalfFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") || - (ctxInfo.hasExtension("OES_texture_half_float_linear") && + (ctxInfo.hasExtension("GL_OES_texture_half_float_linear") && ctxInfo.hasExtension("GL_OES_texture_half_float")); } fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures && fTextureRedSupport; diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 7db6abd6b6..c6cdbfab84 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -2246,16 +2246,18 @@ bool GrGpuGL::configToGLFormats(GrPixelConfig config, break; case kAlpha_half_GrPixelConfig: - if (this->glCaps().textureRedSupport()) { + if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() < GR_GL_VER(3, 1)) { + *internalFormat = GR_GL_ALPHA; + *externalFormat = GR_GL_ALPHA; + *externalType = GR_GL_HALF_FLOAT_OES; + } else if (this->glCaps().textureRedSupport()) { *internalFormat = GR_GL_R16F; *externalFormat = GR_GL_RED; - *externalType = (kGLES_GrGLStandard == this->glStandard()) ? GR_GL_HALF_FLOAT - : GR_GL_HALF_FLOAT_OES; + *externalType = GR_GL_HALF_FLOAT; } else { *internalFormat = GR_GL_ALPHA16F; *externalFormat = GR_GL_ALPHA; - *externalType = (kGLES_GrGLStandard == this->glStandard()) ? GR_GL_HALF_FLOAT - : GR_GL_HALF_FLOAT_OES; + *externalType = GR_GL_HALF_FLOAT; } break; |