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 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 case kASTC_12x12_GrPixelConfig: | 2238 case kASTC_12x12_GrPixelConfig: |
2239 *internalFormat = GR_GL_COMPRESSED_RGBA_ASTC_12x12; | 2239 *internalFormat = GR_GL_COMPRESSED_RGBA_ASTC_12x12; |
2240 break; | 2240 break; |
2241 | 2241 |
2242 case kRGBA_float_GrPixelConfig: | 2242 case kRGBA_float_GrPixelConfig: |
2243 *internalFormat = GR_GL_RGBA32F; | 2243 *internalFormat = GR_GL_RGBA32F; |
2244 *externalFormat = GR_GL_RGBA; | 2244 *externalFormat = GR_GL_RGBA; |
2245 *externalType = GR_GL_FLOAT; | 2245 *externalType = GR_GL_FLOAT; |
2246 break; | 2246 break; |
2247 | 2247 |
| 2248 case kAlpha_half_GrPixelConfig: |
| 2249 if (this->glCaps().textureRedSupport()) { |
| 2250 *internalFormat = GR_GL_R16F; |
| 2251 *externalFormat = GR_GL_RED; |
| 2252 *externalType = (kGLES_GrGLStandard == this->glStandard()) ? GR_
GL_HALF_FLOAT |
| 2253 : GR_
GL_HALF_FLOAT_OES; |
| 2254 } else { |
| 2255 *internalFormat = GR_GL_ALPHA16F; |
| 2256 *externalFormat = GR_GL_ALPHA; |
| 2257 *externalType = (kGLES_GrGLStandard == this->glStandard()) ? GR_
GL_HALF_FLOAT |
| 2258 : GR_
GL_HALF_FLOAT_OES; |
| 2259 } |
| 2260 break; |
| 2261 |
2248 default: | 2262 default: |
2249 return false; | 2263 return false; |
2250 } | 2264 } |
2251 return true; | 2265 return true; |
2252 } | 2266 } |
2253 | 2267 |
2254 void GrGpuGL::setTextureUnit(int unit) { | 2268 void GrGpuGL::setTextureUnit(int unit) { |
2255 SkASSERT(unit >= 0 && unit < fHWBoundTextureUniqueIDs.count()); | 2269 SkASSERT(unit >= 0 && unit < fHWBoundTextureUniqueIDs.count()); |
2256 if (unit != fHWActiveTextureUnitIdx) { | 2270 if (unit != fHWActiveTextureUnitIdx) { |
2257 GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + unit)); | 2271 GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + unit)); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2573 this->setVertexArrayID(gpu, 0); | 2587 this->setVertexArrayID(gpu, 0); |
2574 } | 2588 } |
2575 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2589 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2576 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2590 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2577 fDefaultVertexArrayAttribState.resize(attrCount); | 2591 fDefaultVertexArrayAttribState.resize(attrCount); |
2578 } | 2592 } |
2579 attribState = &fDefaultVertexArrayAttribState; | 2593 attribState = &fDefaultVertexArrayAttribState; |
2580 } | 2594 } |
2581 return attribState; | 2595 return attribState; |
2582 } | 2596 } |
OLD | NEW |