aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-12-16 13:32:27 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-16 13:32:28 -0800
commite1869ca25fe7e9f2426cc81cbb24295e5014abee (patch)
tree2082cd5f9cebe5f4d5f304cb37a3f7bc1f459234
parentd95263c60e1c3b9e337d777d6f3cf286c1dc43f6 (diff)
Revert using sized formats for everything except ES 2.0.
Temporary fix for WritePixels test on Nexus 5/Nexus 7-2013. Review URL: https://codereview.chromium.org/794273005
-rw-r--r--src/gpu/gl/GrGpuGL.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 1fea77a096..3cb9ac5ff8 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -558,10 +558,17 @@ bool GrGLGpu::uploadTexData(const GrSurfaceDesc& desc,
GrGLenum externalFormat = 0x0; // suppress warning
GrGLenum externalType = 0x0; // suppress warning
- // glTexStorage requires sized internal formats on both desktop and ES.
- // ES2 requires an unsized format for glTexImage. On ES3 and desktop we default to sized.
- bool useSizedFormat = useTexStorage || kGL_GrGLStandard == this->glStandard() ||
- this->glVersion() >= GR_GL_VER(3, 0);
+ // glTexStorage requires sized internal formats on both desktop and ES. ES2 requires an unsized
+ // format for glTexImage, unlike ES3 and desktop. However, we allow the driver to decide the
+ // size of the internal format whenever possible and so only use a sized internal format when
+ // using texture storage.
+ bool useSizedFormat = useTexStorage;
+ // Many versions of the ES3 drivers on various platforms will not accept GL_RED in
+ // glTexImage2D for the internal format but will accept GL_R8.
+ if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_VER(3, 0) &&
+ kAlpha_8_GrPixelConfig == dataConfig) {
+ useSizedFormat = true;
+ }
if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat,
&externalFormat, &externalType)) {
return false;