| 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 "GrGLNameAllocator.h" | 10 #include "GrGLNameAllocator.h" |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 } | 632 } |
| 633 dst += trimRowBytes; | 633 dst += trimRowBytes; |
| 634 } | 634 } |
| 635 // now point data to our copied version | 635 // now point data to our copied version |
| 636 data = tempStorage.get(); | 636 data = tempStorage.get(); |
| 637 } | 637 } |
| 638 } | 638 } |
| 639 if (glFlipY) { | 639 if (glFlipY) { |
| 640 GL_CALL(PixelStorei(GR_GL_UNPACK_FLIP_Y, GR_GL_TRUE)); | 640 GL_CALL(PixelStorei(GR_GL_UNPACK_FLIP_Y, GR_GL_TRUE)); |
| 641 } | 641 } |
| 642 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, static_cast<GrGLint>(bpp))); | 642 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, |
| 643 static_cast<GrGLint>(GrUnpackAlignment(dataConfig)))); |
| 643 } | 644 } |
| 644 bool succeeded = true; | 645 bool succeeded = true; |
| 645 if (isNewTexture && | 646 if (isNewTexture && |
| 646 0 == left && 0 == top && | 647 0 == left && 0 == top && |
| 647 desc.fWidth == width && desc.fHeight == height) { | 648 desc.fWidth == width && desc.fHeight == height) { |
| 648 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); | 649 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); |
| 649 if (useTexStorage) { | 650 if (useTexStorage) { |
| 650 // We never resize or change formats of textures. | 651 // We never resize or change formats of textures. |
| 651 GL_ALLOC_CALL(this->glInterface(), | 652 GL_ALLOC_CALL(this->glInterface(), |
| 652 TexStorage2D(GR_GL_TEXTURE_2D, | 653 TexStorage2D(GR_GL_TEXTURE_2D, |
| (...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2690 *internalFormat = GR_GL_COMPRESSED_RED_RGTC1; | 2691 *internalFormat = GR_GL_COMPRESSED_RED_RGTC1; |
| 2691 break; | 2692 break; |
| 2692 case GrGLCaps::k3DC_LATCAlias: | 2693 case GrGLCaps::k3DC_LATCAlias: |
| 2693 *internalFormat = GR_GL_COMPRESSED_3DC_X; | 2694 *internalFormat = GR_GL_COMPRESSED_3DC_X; |
| 2694 break; | 2695 break; |
| 2695 } | 2696 } |
| 2696 break; | 2697 break; |
| 2697 case kR11_EAC_GrPixelConfig: | 2698 case kR11_EAC_GrPixelConfig: |
| 2698 *internalFormat = GR_GL_COMPRESSED_R11; | 2699 *internalFormat = GR_GL_COMPRESSED_R11; |
| 2699 break; | 2700 break; |
| 2701 case kRGBA_float_GrPixelConfig: |
| 2702 *internalFormat = GR_GL_RGBA32F; |
| 2703 *externalFormat = GR_GL_RGBA; |
| 2704 *externalType = GR_GL_FLOAT; |
| 2705 break; |
| 2700 default: | 2706 default: |
| 2701 return false; | 2707 return false; |
| 2702 } | 2708 } |
| 2703 return true; | 2709 return true; |
| 2704 } | 2710 } |
| 2705 | 2711 |
| 2706 void GrGpuGL::setTextureUnit(int unit) { | 2712 void GrGpuGL::setTextureUnit(int unit) { |
| 2707 SkASSERT(unit >= 0 && unit < fHWBoundTextures.count()); | 2713 SkASSERT(unit >= 0 && unit < fHWBoundTextures.count()); |
| 2708 if (unit != fHWActiveTextureUnitIdx) { | 2714 if (unit != fHWActiveTextureUnitIdx) { |
| 2709 GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + unit)); | 2715 GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + unit)); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3018 this->setVertexArrayID(gpu, 0); | 3024 this->setVertexArrayID(gpu, 0); |
| 3019 } | 3025 } |
| 3020 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3026 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 3021 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3027 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 3022 fDefaultVertexArrayAttribState.resize(attrCount); | 3028 fDefaultVertexArrayAttribState.resize(attrCount); |
| 3023 } | 3029 } |
| 3024 attribState = &fDefaultVertexArrayAttribState; | 3030 attribState = &fDefaultVertexArrayAttribState; |
| 3025 } | 3031 } |
| 3026 return attribState; | 3032 return attribState; |
| 3027 } | 3033 } |
| OLD | NEW |