OLD | NEW |
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 Loading... |
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 (kGLES_GrGLStandard == this->glStandard() && this->glVersion() <
GR_GL_VER(3, 1)) { |
| 2246 *internalFormat = GR_GL_ALPHA; |
| 2247 *externalFormat = GR_GL_ALPHA; |
| 2248 *externalType = GR_GL_HALF_FLOAT_OES; |
| 2249 } else if (this->glCaps().textureRedSupport()) { |
2246 *internalFormat = GR_GL_R16F; | 2250 *internalFormat = GR_GL_R16F; |
2247 *externalFormat = GR_GL_RED; | 2251 *externalFormat = GR_GL_RED; |
2248 *externalType = (kGLES_GrGLStandard == this->glStandard()) ? GR_
GL_HALF_FLOAT | 2252 *externalType = GR_GL_HALF_FLOAT; |
2249 : GR_
GL_HALF_FLOAT_OES; | |
2250 } else { | 2253 } else { |
2251 *internalFormat = GR_GL_ALPHA16F; | 2254 *internalFormat = GR_GL_ALPHA16F; |
2252 *externalFormat = GR_GL_ALPHA; | 2255 *externalFormat = GR_GL_ALPHA; |
2253 *externalType = (kGLES_GrGLStandard == this->glStandard()) ? GR_
GL_HALF_FLOAT | 2256 *externalType = GR_GL_HALF_FLOAT; |
2254 : GR_
GL_HALF_FLOAT_OES; | |
2255 } | 2257 } |
2256 break; | 2258 break; |
2257 | 2259 |
2258 default: | 2260 default: |
2259 return false; | 2261 return false; |
2260 } | 2262 } |
2261 return true; | 2263 return true; |
2262 } | 2264 } |
2263 | 2265 |
2264 void GrGpuGL::setTextureUnit(int unit) { | 2266 void GrGpuGL::setTextureUnit(int unit) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 this->setVertexArrayID(gpu, 0); | 2585 this->setVertexArrayID(gpu, 0); |
2584 } | 2586 } |
2585 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2587 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2586 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2588 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2587 fDefaultVertexArrayAttribState.resize(attrCount); | 2589 fDefaultVertexArrayAttribState.resize(attrCount); |
2588 } | 2590 } |
2589 attribState = &fDefaultVertexArrayAttribState; | 2591 attribState = &fDefaultVertexArrayAttribState; |
2590 } | 2592 } |
2591 return attribState; | 2593 return attribState; |
2592 } | 2594 } |
OLD | NEW |