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

Side by Side Diff: src/gpu/gl/GrGpuGL.cpp

Issue 799593002: Fix float and half float support on mobile. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 *internalFormat = GR_GL_COMPRESSED_RGBA_ASTC_12x12; 2235 *internalFormat = GR_GL_COMPRESSED_RGBA_ASTC_12x12;
2236 break; 2236 break;
2237 2237
2238 case kRGBA_float_GrPixelConfig: 2238 case kRGBA_float_GrPixelConfig:
2239 *internalFormat = GR_GL_RGBA32F; 2239 *internalFormat = GR_GL_RGBA32F;
2240 *externalFormat = GR_GL_RGBA; 2240 *externalFormat = GR_GL_RGBA;
2241 *externalType = GR_GL_FLOAT; 2241 *externalType = GR_GL_FLOAT;
2242 break; 2242 break;
2243 2243
2244 case kAlpha_half_GrPixelConfig: 2244 case kAlpha_half_GrPixelConfig:
2245 if (this->glCaps().textureRedSupport()) { 2245 if (this->glStandard() == kGL_GrGLStandard) {
2246 *internalFormat = GR_GL_R16F; 2246 if (this->glCaps().textureRedSupport()) {
2247 *externalFormat = GR_GL_RED; 2247 *internalFormat = GR_GL_R16F;
2248 *externalType = (kGLES_GrGLStandard == this->glStandard()) ? GR_ GL_HALF_FLOAT 2248 *externalFormat = GR_GL_RED;
2249 : GR_ GL_HALF_FLOAT_OES; 2249 } else {
2250 *internalFormat = GR_GL_ALPHA16F;
2251 *externalFormat = GR_GL_ALPHA;
2252 }
2253 *externalType = GR_GL_HALF_FLOAT;
2250 } else { 2254 } else {
2251 *internalFormat = GR_GL_ALPHA16F; 2255 *internalFormat = GR_GL_ALPHA;
2252 *externalFormat = GR_GL_ALPHA; 2256 *externalFormat = GR_GL_ALPHA;
2253 *externalType = (kGLES_GrGLStandard == this->glStandard()) ? GR_ GL_HALF_FLOAT 2257 *externalType = GR_GL_HALF_FLOAT_OES;
2254 : GR_ GL_HALF_FLOAT_OES;
2255 } 2258 }
2256 break; 2259 break;
2257 2260
2258 default: 2261 default:
2259 return false; 2262 return false;
2260 } 2263 }
2261 return true; 2264 return true;
2262 } 2265 }
2263 2266
2264 void GrGpuGL::setTextureUnit(int unit) { 2267 void GrGpuGL::setTextureUnit(int unit) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 this->setVertexArrayID(gpu, 0); 2586 this->setVertexArrayID(gpu, 0);
2584 } 2587 }
2585 int attrCount = gpu->glCaps().maxVertexAttributes(); 2588 int attrCount = gpu->glCaps().maxVertexAttributes();
2586 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2589 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2587 fDefaultVertexArrayAttribState.resize(attrCount); 2590 fDefaultVertexArrayAttribState.resize(attrCount);
2588 } 2591 }
2589 attribState = &fDefaultVertexArrayAttribState; 2592 attribState = &fDefaultVertexArrayAttribState;
2590 } 2593 }
2591 return attribState; 2594 return attribState;
2592 } 2595 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698