| 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 height = desc.fHeight; | 711 height = desc.fHeight; |
| 712 } | 712 } |
| 713 #ifdef SK_DEBUG | 713 #ifdef SK_DEBUG |
| 714 else { | 714 else { |
| 715 SkASSERT(height <= desc.fHeight); | 715 SkASSERT(height <= desc.fHeight); |
| 716 } | 716 } |
| 717 #endif | 717 #endif |
| 718 | 718 |
| 719 // Make sure that the width and height that we pass to OpenGL | 719 // Make sure that the width and height that we pass to OpenGL |
| 720 // is a multiple of the block size. | 720 // is a multiple of the block size. |
| 721 int dataSize = GrCompressedFormatDataSize(desc.fConfig, width, height); | 721 size_t dataSize = GrCompressedFormatDataSize(desc.fConfig, width, height); |
| 722 | 722 |
| 723 // We only need the internal format for compressed 2D textures. | 723 // We only need the internal format for compressed 2D textures. |
| 724 GrGLenum internalFormat = 0; | 724 GrGLenum internalFormat = 0; |
| 725 if (!this->configToGLFormats(desc.fConfig, false, &internalFormat, NULL, NUL
L)) { | 725 if (!this->configToGLFormats(desc.fConfig, false, &internalFormat, NULL, NUL
L)) { |
| 726 return false; | 726 return false; |
| 727 } | 727 } |
| 728 | 728 |
| 729 if (isNewTexture) { | 729 if (isNewTexture) { |
| 730 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); | 730 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); |
| 731 GL_ALLOC_CALL(this->glInterface(), | 731 GL_ALLOC_CALL(this->glInterface(), |
| 732 CompressedTexImage2D(GR_GL_TEXTURE_2D, | 732 CompressedTexImage2D(GR_GL_TEXTURE_2D, |
| 733 0, // level | 733 0, // level |
| 734 internalFormat, | 734 internalFormat, |
| 735 width, height, | 735 width, height, |
| 736 0, // border | 736 0, // border |
| 737 dataSize, | 737 SkToInt(dataSize), |
| 738 data)); | 738 data)); |
| 739 GrGLenum error = check_alloc_error(desc, this->glInterface()); | 739 GrGLenum error = check_alloc_error(desc, this->glInterface()); |
| 740 if (error != GR_GL_NO_ERROR) { | 740 if (error != GR_GL_NO_ERROR) { |
| 741 return false; | 741 return false; |
| 742 } | 742 } |
| 743 } else { | 743 } else { |
| 744 // Paletted textures can't be updated. | 744 // Paletted textures can't be updated. |
| 745 if (GR_GL_PALETTE8_RGBA8 == internalFormat) { | 745 if (GR_GL_PALETTE8_RGBA8 == internalFormat) { |
| 746 return false; | 746 return false; |
| 747 } | 747 } |
| 748 GL_CALL(CompressedTexSubImage2D(GR_GL_TEXTURE_2D, | 748 GL_CALL(CompressedTexSubImage2D(GR_GL_TEXTURE_2D, |
| 749 0, // level | 749 0, // level |
| 750 left, top, | 750 left, top, |
| 751 width, height, | 751 width, height, |
| 752 internalFormat, | 752 internalFormat, |
| 753 dataSize, | 753 SkToInt(dataSize), |
| 754 data)); | 754 data)); |
| 755 } | 755 } |
| 756 | 756 |
| 757 return true; | 757 return true; |
| 758 } | 758 } |
| 759 | 759 |
| 760 static bool renderbuffer_storage_msaa(GrGLContext& ctx, | 760 static bool renderbuffer_storage_msaa(GrGLContext& ctx, |
| 761 int sampleCount, | 761 int sampleCount, |
| 762 GrGLenum format, | 762 GrGLenum format, |
| 763 int width, int height) { | 763 int width, int height) { |
| (...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 this->setVertexArrayID(gpu, 0); | 2589 this->setVertexArrayID(gpu, 0); |
| 2590 } | 2590 } |
| 2591 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2591 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2592 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2592 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2593 fDefaultVertexArrayAttribState.resize(attrCount); | 2593 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2594 } | 2594 } |
| 2595 attribState = &fDefaultVertexArrayAttribState; | 2595 attribState = &fDefaultVertexArrayAttribState; |
| 2596 } | 2596 } |
| 2597 return attribState; | 2597 return attribState; |
| 2598 } | 2598 } |
| OLD | NEW |