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 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 *internalFormat = GR_GL_COMPRESSED_RGBA_ASTC_12x12; | 2377 *internalFormat = GR_GL_COMPRESSED_RGBA_ASTC_12x12; |
2378 break; | 2378 break; |
2379 | 2379 |
2380 case kRGBA_float_GrPixelConfig: | 2380 case kRGBA_float_GrPixelConfig: |
2381 *internalFormat = GR_GL_RGBA32F; | 2381 *internalFormat = GR_GL_RGBA32F; |
2382 *externalFormat = GR_GL_RGBA; | 2382 *externalFormat = GR_GL_RGBA; |
2383 *externalType = GR_GL_FLOAT; | 2383 *externalType = GR_GL_FLOAT; |
2384 break; | 2384 break; |
2385 | 2385 |
2386 case kAlpha_half_GrPixelConfig: | 2386 case kAlpha_half_GrPixelConfig: |
2387 if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() <
GR_GL_VER(3, 1)) { | 2387 if (this->glCaps().textureRedSupport()) { |
2388 *internalFormat = GR_GL_ALPHA; | 2388 if (getSizedInternalFormat) { |
| 2389 *internalFormat = GR_GL_R16F; |
| 2390 } else { |
| 2391 *internalFormat = GR_GL_RED; |
| 2392 } |
| 2393 *externalFormat = GR_GL_RED; |
| 2394 } else { |
| 2395 if (getSizedInternalFormat) { |
| 2396 *internalFormat = GR_GL_ALPHA16F; |
| 2397 } else { |
| 2398 *internalFormat = GR_GL_ALPHA; |
| 2399 } |
2389 *externalFormat = GR_GL_ALPHA; | 2400 *externalFormat = GR_GL_ALPHA; |
2390 *externalType = GR_GL_HALF_FLOAT_OES; | 2401 } |
2391 } else if (this->glCaps().textureRedSupport()) { | 2402 if (kGL_GrGLStandard == this->glStandard() || this->glVersion() >= G
R_GL_VER(3, 0)) { |
2392 *internalFormat = GR_GL_R16F; | |
2393 *externalFormat = GR_GL_RED; | |
2394 *externalType = GR_GL_HALF_FLOAT; | 2403 *externalType = GR_GL_HALF_FLOAT; |
2395 } else { | 2404 } else { |
2396 *internalFormat = GR_GL_ALPHA16F; | 2405 *externalType = GR_GL_HALF_FLOAT_OES; |
2397 *externalFormat = GR_GL_ALPHA; | |
2398 *externalType = GR_GL_HALF_FLOAT; | |
2399 } | 2406 } |
2400 break; | 2407 break; |
2401 | 2408 |
2402 default: | 2409 default: |
2403 return false; | 2410 return false; |
2404 } | 2411 } |
2405 return true; | 2412 return true; |
2406 } | 2413 } |
2407 | 2414 |
2408 void GrGLGpu::setTextureUnit(int unit) { | 2415 void GrGLGpu::setTextureUnit(int unit) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 this->setVertexArrayID(gpu, 0); | 2734 this->setVertexArrayID(gpu, 0); |
2728 } | 2735 } |
2729 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2736 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2730 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2737 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2731 fDefaultVertexArrayAttribState.resize(attrCount); | 2738 fDefaultVertexArrayAttribState.resize(attrCount); |
2732 } | 2739 } |
2733 attribState = &fDefaultVertexArrayAttribState; | 2740 attribState = &fDefaultVertexArrayAttribState; |
2734 } | 2741 } |
2735 return attribState; | 2742 return attribState; |
2736 } | 2743 } |
OLD | NEW |