Chromium Code Reviews| 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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
| 10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 661 | 661 |
| 662 static inline GrGLenum check_alloc_error(const GrSurfaceDesc& desc, | 662 static inline GrGLenum check_alloc_error(const GrSurfaceDesc& desc, |
| 663 const GrGLInterface* interface) { | 663 const GrGLInterface* interface) { |
| 664 if (SkToBool(desc.fFlags & kCheckAllocation_GrSurfaceFlag)) { | 664 if (SkToBool(desc.fFlags & kCheckAllocation_GrSurfaceFlag)) { |
| 665 return GR_GL_GET_ERROR(interface); | 665 return GR_GL_GET_ERROR(interface); |
| 666 } else { | 666 } else { |
| 667 return CHECK_ALLOC_ERROR(interface); | 667 return CHECK_ALLOC_ERROR(interface); |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 | 670 |
| 671 /** | |
| 672 * Determines if sized internal formats are available for the texture being crea ted. | |
| 673 * | |
| 674 * @param info Info about the GL context. | |
| 675 * @param textureConfig The pixel configuration for the texture being created. | |
| 676 */ | |
| 677 static bool use_sized_format_for_texture(const GrGLContextInfo& info, GrPixelCon fig textureConfig) { | |
| 678 // ES2 requires an unsized format for glTexImage, unlike ES3 and desktop. | |
| 679 bool useSizedFormat = false; | |
| 680 if (kGL_GrGLStandard == info.standard() || | |
| 681 (info.version() >= GR_GL_VER(3, 0) && | |
| 682 // ES3 only works with sized BGRA8 format if "GL_APPLE_texture_format_B GRA8888" enabled | |
| 683 (kBGRA_8888_GrPixelConfig != textureConfig || !info.caps()->bgraIsInter nalFormat()))) { | |
| 684 useSizedFormat = true; | |
| 685 } | |
| 686 return useSizedFormat; | |
| 687 } | |
| 688 | |
| 689 bool GrGLGpu::uploadTexData(const GrSurfaceDesc& desc, | 671 bool GrGLGpu::uploadTexData(const GrSurfaceDesc& desc, |
| 690 GrGLenum target, | 672 GrGLenum target, |
| 691 bool isNewTexture, | 673 bool isNewTexture, |
| 692 int left, int top, int width, int height, | 674 int left, int top, int width, int height, |
| 693 GrPixelConfig dataConfig, | 675 GrPixelConfig dataConfig, |
| 694 const void* data, | 676 const void* data, |
| 695 size_t rowBytes) { | 677 size_t rowBytes) { |
| 696 SkASSERT(data || isNewTexture); | 678 SkASSERT(data || isNewTexture); |
| 697 | 679 |
| 698 // If we're uploading compressed data then we should be using uploadCompress edTexData | 680 // If we're uploading compressed data then we should be using uploadCompress edTexData |
| 699 SkASSERT(!GrPixelConfigIsCompressed(dataConfig)); | 681 SkASSERT(!GrPixelConfigIsCompressed(dataConfig)); |
| 700 | 682 |
| 701 SkASSERT(this->caps()->isConfigTexturable(desc.fConfig)); | 683 SkASSERT(this->caps()->isConfigTexturable(desc.fConfig)); |
| 702 | 684 |
| 703 size_t bpp = GrBytesPerPixel(dataConfig); | 685 size_t bpp = GrBytesPerPixel(dataConfig); |
| 704 if (!GrSurfacePriv::AdjustWritePixelParams(desc.fWidth, desc.fHeight, bpp, & left, &top, | 686 if (!GrSurfacePriv::AdjustWritePixelParams(desc.fWidth, desc.fHeight, bpp, & left, &top, |
| 705 &width, &height, &data, &rowBytes )) { | 687 &width, &height, &data, &rowBytes )) { |
| 706 return false; | 688 return false; |
| 707 } | 689 } |
| 708 size_t trimRowBytes = width * bpp; | 690 size_t trimRowBytes = width * bpp; |
| 709 | 691 |
| 710 // in case we need a temporary, trimmed copy of the src pixels | 692 // in case we need a temporary, trimmed copy of the src pixels |
| 711 #if defined(GOOGLE3) | 693 #if defined(GOOGLE3) |
| 712 // Stack frame size is limited in GOOGLE3. | 694 // Stack frame size is limited in GOOGLE3. |
| 713 SkAutoSMalloc<64 * 128> tempStorage; | 695 SkAutoSMalloc<64 * 128> tempStorage; |
| 714 #else | 696 #else |
| 715 SkAutoSMalloc<128 * 128> tempStorage; | 697 SkAutoSMalloc<128 * 128> tempStorage; |
| 716 #endif | 698 #endif |
| 717 | 699 |
| 718 bool useSizedFormat = use_sized_format_for_texture(this->ctxInfo(), desc.fCo nfig); | |
| 719 | |
| 720 // Internal format comes from the texture desc. | 700 // Internal format comes from the texture desc. |
| 721 GrGLenum internalFormat = useSizedFormat ? | 701 GrGLenum internalFormat = fConfigTable[desc.fConfig].fInternalFormatTexImage ; |
| 722 fConfigTable[desc.fConfig].fSizedInternalFormat: | |
| 723 fConfigTable[desc.fConfig].fBaseInternalFormat; | |
| 724 | 702 |
| 725 // External format and type come from the upload data. | 703 // External format and type come from the upload data. |
| 726 GrGLenum externalFormat = fConfigTable[dataConfig].fExternalFormatForTexImag e; | 704 GrGLenum externalFormat = fConfigTable[dataConfig].fExternalFormatForTexImag e; |
| 727 GrGLenum externalType = fConfigTable[dataConfig].fExternalType; | 705 GrGLenum externalType = fConfigTable[dataConfig].fExternalType; |
| 728 | 706 |
| 729 /* | 707 /* |
| 730 * Check whether to allocate a temporary buffer for flipping y or | 708 * Check whether to allocate a temporary buffer for flipping y or |
| 731 * because our srcData has extra bytes past each row. If so, we need | 709 * because our srcData has extra bytes past each row. If so, we need |
| 732 * to trim those off here, since GL ES may not let us specify | 710 * to trim those off here, since GL ES may not let us specify |
| 733 * GL_UNPACK_ROW_LENGTH. | 711 * GL_UNPACK_ROW_LENGTH. |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1212 format->fTotalBits += format->fStencilBits; | 1190 format->fTotalBits += format->fStencilBits; |
| 1213 } else { | 1191 } else { |
| 1214 format->fTotalBits = format->fStencilBits; | 1192 format->fTotalBits = format->fStencilBits; |
| 1215 } | 1193 } |
| 1216 } | 1194 } |
| 1217 } | 1195 } |
| 1218 } | 1196 } |
| 1219 | 1197 |
| 1220 int GrGLGpu::getCompatibleStencilIndex(GrPixelConfig config) { | 1198 int GrGLGpu::getCompatibleStencilIndex(GrPixelConfig config) { |
| 1221 static const int kSize = 16; | 1199 static const int kSize = 16; |
| 1200 SkASSERT(this->caps()->isConfigRenderable(config, false)); | |
|
egdaniel
2015/12/18 01:31:15
Do we know we will only get here for non-msaa?
bsalomon
2015/12/18 02:01:52
No, but we know that any msaa renderable format is
| |
| 1222 if (ConfigEntry::kUnknown_StencilIndex == fConfigTable[config].fStencilForma tIndex) { | 1201 if (ConfigEntry::kUnknown_StencilIndex == fConfigTable[config].fStencilForma tIndex) { |
| 1223 // Default to unsupported | 1202 // Default to unsupported |
| 1224 fConfigTable[config].fStencilFormatIndex = ConfigEntry::kUnsupported_Ste ncilFormatIndex; | 1203 fConfigTable[config].fStencilFormatIndex = ConfigEntry::kUnsupported_Ste ncilFormatIndex; |
| 1225 // Create color texture | 1204 // Create color texture |
| 1226 GrGLuint colorID = 0; | 1205 GrGLuint colorID = 0; |
| 1227 GL_CALL(GenTextures(1, &colorID)); | 1206 GL_CALL(GenTextures(1, &colorID)); |
| 1228 this->setScratchTextureUnit(); | 1207 this->setScratchTextureUnit(); |
| 1229 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, colorID)); | 1208 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, colorID)); |
| 1230 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, | 1209 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, |
| 1231 GR_GL_TEXTURE_MAG_FILTER, | 1210 GR_GL_TEXTURE_MAG_FILTER, |
| 1232 GR_GL_NEAREST)); | 1211 GR_GL_NEAREST)); |
| 1233 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, | 1212 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, |
| 1234 GR_GL_TEXTURE_MIN_FILTER, | 1213 GR_GL_TEXTURE_MIN_FILTER, |
| 1235 GR_GL_NEAREST)); | 1214 GR_GL_NEAREST)); |
| 1236 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, | 1215 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, |
| 1237 GR_GL_TEXTURE_WRAP_S, | 1216 GR_GL_TEXTURE_WRAP_S, |
| 1238 GR_GL_CLAMP_TO_EDGE)); | 1217 GR_GL_CLAMP_TO_EDGE)); |
| 1239 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, | 1218 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, |
| 1240 GR_GL_TEXTURE_WRAP_T, | 1219 GR_GL_TEXTURE_WRAP_T, |
| 1241 GR_GL_CLAMP_TO_EDGE)); | 1220 GR_GL_CLAMP_TO_EDGE)); |
| 1242 | 1221 |
| 1243 GrGLenum internalFormat = 0x0; // suppress warning | 1222 GrGLenum internalFormat = fConfigTable[config].fInternalFormatTexImage; |
| 1244 GrGLenum externalFormat = 0x0; // suppress warning | 1223 GrGLenum externalFormat = fConfigTable[config].fExternalFormatForTexImag e; |
| 1245 GrGLenum externalType = 0x0; // suppress warning | 1224 GrGLenum externalType = fConfigTable[config].fExternalType; |
| 1246 bool useSizedFormat = use_sized_format_for_texture(this->ctxInfo(), conf ig); | |
| 1247 if (!this->configToGLFormats(config, useSizedFormat, &internalFormat, | |
| 1248 &externalFormat, &externalType)) { | |
| 1249 GL_CALL(DeleteTextures(1, &colorID)); | |
| 1250 return ConfigEntry::kUnsupported_StencilFormatIndex; | |
| 1251 } | |
| 1252 | 1225 |
| 1253 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); | 1226 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); |
| 1254 GL_ALLOC_CALL(this->glInterface(), TexImage2D(GR_GL_TEXTURE_2D, | 1227 GL_ALLOC_CALL(this->glInterface(), TexImage2D(GR_GL_TEXTURE_2D, |
| 1255 0, internalFormat, | 1228 0, |
| 1229 internalFormat, | |
| 1256 kSize, | 1230 kSize, |
| 1257 kSize, | 1231 kSize, |
| 1258 0, | 1232 0, |
| 1259 externalFormat, | 1233 externalFormat, |
| 1260 externalType, | 1234 externalType, |
| 1261 NULL)); | 1235 NULL)); |
| 1262 if (GR_GL_NO_ERROR != GR_GL_GET_ERROR(this->glInterface())) { | 1236 if (GR_GL_NO_ERROR != GR_GL_GET_ERROR(this->glInterface())) { |
| 1263 GL_CALL(DeleteTextures(1, &colorID)); | 1237 GL_CALL(DeleteTextures(1, &colorID)); |
| 1264 return ConfigEntry::kUnsupported_StencilFormatIndex; | 1238 return ConfigEntry::kUnsupported_StencilFormatIndex; |
| 1265 } | 1239 } |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2735 fConfigTable[kR11_EAC_GrPixelConfig].fBaseInternalFormat = GR_GL_COMPRESSED_ R11_EAC; | 2709 fConfigTable[kR11_EAC_GrPixelConfig].fBaseInternalFormat = GR_GL_COMPRESSED_ R11_EAC; |
| 2736 fConfigTable[kR11_EAC_GrPixelConfig].fSizedInternalFormat = GR_GL_COMPRESSED _R11_EAC; | 2710 fConfigTable[kR11_EAC_GrPixelConfig].fSizedInternalFormat = GR_GL_COMPRESSED _R11_EAC; |
| 2737 fConfigTable[kR11_EAC_GrPixelConfig].fExternalFormat = 0; | 2711 fConfigTable[kR11_EAC_GrPixelConfig].fExternalFormat = 0; |
| 2738 fConfigTable[kR11_EAC_GrPixelConfig].fExternalType = 0; | 2712 fConfigTable[kR11_EAC_GrPixelConfig].fExternalType = 0; |
| 2739 | 2713 |
| 2740 fConfigTable[kASTC_12x12_GrPixelConfig].fBaseInternalFormat = GR_GL_COMPRESS ED_RGBA_ASTC_12x12; | 2714 fConfigTable[kASTC_12x12_GrPixelConfig].fBaseInternalFormat = GR_GL_COMPRESS ED_RGBA_ASTC_12x12; |
| 2741 fConfigTable[kASTC_12x12_GrPixelConfig].fSizedInternalFormat = GR_GL_COMPRES SED_RGBA_ASTC_12x12; | 2715 fConfigTable[kASTC_12x12_GrPixelConfig].fSizedInternalFormat = GR_GL_COMPRES SED_RGBA_ASTC_12x12; |
| 2742 fConfigTable[kASTC_12x12_GrPixelConfig].fExternalFormat = 0; | 2716 fConfigTable[kASTC_12x12_GrPixelConfig].fExternalFormat = 0; |
| 2743 fConfigTable[kASTC_12x12_GrPixelConfig].fExternalType = 0; | 2717 fConfigTable[kASTC_12x12_GrPixelConfig].fExternalType = 0; |
| 2744 | 2718 |
| 2719 // Bulk populate the texture internal/external formats here and then deal wi th exceptions below. | |
| 2745 | 2720 |
| 2746 // Almost always we want to pass fExternalFormat as the <format> param to gl Tex[Sub]Image. | 2721 // ES 2.0 requires that the internal/external formats match. |
| 2722 bool useSizedFormats = (kGL_GrGLStandard == this->glStandard() || | |
| 2723 this->glVersion() >= GR_GL_VER(3,0)); | |
| 2747 for (int i = 0; i < kGrPixelConfigCnt; ++i) { | 2724 for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
| 2725 // Almost always we want to pass fExternalFormat as the <format> param t o glTex[Sub]Image. | |
| 2748 fConfigTable[i].fExternalFormatForTexImage = fConfigTable[i].fExternalFo rmat; | 2726 fConfigTable[i].fExternalFormatForTexImage = fConfigTable[i].fExternalFo rmat; |
| 2727 fConfigTable[i].fInternalFormatTexImage = useSizedFormats ? | |
| 2728 fConfigTable[i].fSizedIn ternalFormat : | |
| 2729 fConfigTable[i].fBaseInt ernalFormat; | |
| 2749 } | 2730 } |
| 2750 // OpenGL ES 2.0 + GL_EXT_sRGB allows GL_SRGB_ALPHA to be specified as the < format> | 2731 // OpenGL ES 2.0 + GL_EXT_sRGB allows GL_SRGB_ALPHA to be specified as the < format> |
| 2751 // param to Tex(Sub)Image. ES 2.0 requires the <internalFormat> and <format> params to match. | 2732 // param to Tex(Sub)Image. ES 2.0 requires the <internalFormat> and <format> params to match. |
| 2752 // Thus, on ES 2.0 we will use GL_SRGB_ALPHA as the <format> param. | 2733 // Thus, on ES 2.0 we will use GL_SRGB_ALPHA as the <format> param. |
| 2753 // On OpenGL and ES 3.0+ GL_SRGB_ALPHA does not work for the <format> param to glTexImage. | 2734 // On OpenGL and ES 3.0+ GL_SRGB_ALPHA does not work for the <format> param to glTexImage. |
| 2754 if (this->glStandard() == kGLES_GrGLStandard && this->glVersion() == GR_GL_V ER(2,0)) { | 2735 if (this->glStandard() == kGLES_GrGLStandard && this->glVersion() == GR_GL_V ER(2,0)) { |
| 2755 fConfigTable[kSRGBA_8888_GrPixelConfig].fExternalFormatForTexImage = GR_ GL_SRGB_ALPHA; | 2736 fConfigTable[kSRGBA_8888_GrPixelConfig].fExternalFormatForTexImage = GR_ GL_SRGB_ALPHA; |
| 2756 } | 2737 } |
| 2757 | 2738 |
| 2739 // If BGRA is supported as an internal format it must always be specified to glTex[Sub]Image | |
| 2740 // as a base format. | |
| 2741 // GL_EXT_texture_format_BGRA8888: | |
| 2742 // This extension GL_BGRA as an unsized internal format. However, it is written against ES | |
| 2743 // 2.0 and therefore doesn't define a value for GL_BGRA8 as ES 2.0 uses unsized internal | |
| 2744 // formats. | |
| 2745 // GL_APPLE_texture_format_BGRA8888: | |
| 2746 // ES 2.0: the extension makes BGRA an external format but not an intern al format. | |
| 2747 // ES 3.0: the extension explicitly states GL_BGRA8 is not a valid inter nal format for | |
| 2748 // glTexImage (just for glTexStorage). | |
| 2749 if (useSizedFormats && this->glCaps().bgraIsInternalFormat()) { | |
| 2750 fConfigTable[kBGRA_8888_GrPixelConfig].fInternalFormatTexImage = GR_GL_B GRA; | |
| 2751 } | |
| 2752 | |
| 2758 #ifdef SK_DEBUG | 2753 #ifdef SK_DEBUG |
| 2759 // Make sure we initialized everything. | 2754 // Make sure we initialized everything. |
| 2760 ConfigEntry defaultEntry; | 2755 ConfigEntry defaultEntry; |
| 2761 for (int i = 0; i < kGrPixelConfigCnt; ++i) { | 2756 for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
| 2762 SkASSERT(defaultEntry.fBaseInternalFormat != fConfigTable[i].fBaseIntern alFormat); | 2757 SkASSERT(defaultEntry.fBaseInternalFormat != fConfigTable[i].fBaseIntern alFormat); |
| 2763 SkASSERT(defaultEntry.fSizedInternalFormat != fConfigTable[i].fSizedInte rnalFormat); | 2758 SkASSERT(defaultEntry.fSizedInternalFormat != fConfigTable[i].fSizedInte rnalFormat); |
| 2764 SkASSERT(defaultEntry.fExternalFormat != fConfigTable[i].fExternalFormat ); | 2759 SkASSERT(defaultEntry.fExternalFormat != fConfigTable[i].fExternalFormat ); |
| 2765 SkASSERT(defaultEntry.fExternalType != fConfigTable[i].fExternalType); | 2760 SkASSERT(defaultEntry.fExternalType != fConfigTable[i].fExternalType); |
| 2766 } | 2761 } |
| 2767 #endif | 2762 #endif |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3465 SkASSERT(GrCaps::kAdvanced_BlendEquationSupport == | 3460 SkASSERT(GrCaps::kAdvanced_BlendEquationSupport == |
| 3466 this->caps()->blendEquationSupport()); | 3461 this->caps()->blendEquationSupport()); |
| 3467 GL_CALL(BlendBarrier()); | 3462 GL_CALL(BlendBarrier()); |
| 3468 return; | 3463 return; |
| 3469 default: break; // placate compiler warnings that kNone not handled | 3464 default: break; // placate compiler warnings that kNone not handled |
| 3470 } | 3465 } |
| 3471 } | 3466 } |
| 3472 | 3467 |
| 3473 GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, in t h, | 3468 GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, in t h, |
| 3474 GrPixelConfig config) c onst { | 3469 GrPixelConfig config) c onst { |
| 3470 if (!this->caps()->isConfigTexturable(config)) { | |
| 3471 return false; | |
| 3472 } | |
| 3475 GrGLTextureInfo* info = new GrGLTextureInfo; | 3473 GrGLTextureInfo* info = new GrGLTextureInfo; |
| 3476 info->fTarget = GR_GL_TEXTURE_2D; | 3474 info->fTarget = GR_GL_TEXTURE_2D; |
| 3477 info->fID = 0; | 3475 info->fID = 0; |
| 3478 GL_CALL(GenTextures(1, &info->fID)); | 3476 GL_CALL(GenTextures(1, &info->fID)); |
| 3479 GL_CALL(ActiveTexture(GR_GL_TEXTURE0)); | 3477 GL_CALL(ActiveTexture(GR_GL_TEXTURE0)); |
| 3480 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); | 3478 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); |
| 3481 GL_CALL(BindTexture(info->fTarget, info->fID)); | 3479 GL_CALL(BindTexture(info->fTarget, info->fID)); |
| 3482 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAREST )); | 3480 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAREST )); |
| 3483 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAREST )); | 3481 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAREST )); |
| 3484 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO_ED GE)); | 3482 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO_ED GE)); |
| 3485 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO_ED GE)); | 3483 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO_ED GE)); |
| 3486 | 3484 |
| 3487 GrGLenum internalFormat = 0x0; // suppress warning | 3485 GrGLenum internalFormat = fConfigTable[config].fInternalFormatTexImage; |
| 3488 GrGLenum externalFormat = 0x0; // suppress warning | 3486 GrGLenum externalFormat = fConfigTable[config].fExternalFormatForTexImage; |
| 3489 GrGLenum externalType = 0x0; // suppress warning | 3487 GrGLenum externalType = fConfigTable[config].fExternalType; |
| 3490 | |
| 3491 bool useSizedFormat = use_sized_format_for_texture(this->ctxInfo(), config); | |
| 3492 this->configToGLFormats(config, useSizedFormat, &internalFormat, &externalFo rmat, | |
| 3493 &externalType); | |
| 3494 | 3488 |
| 3495 GL_CALL(TexImage2D(info->fTarget, 0, internalFormat, w, h, 0, externalFormat , | 3489 GL_CALL(TexImage2D(info->fTarget, 0, internalFormat, w, h, 0, externalFormat , |
| 3496 externalType, pixels)); | 3490 externalType, pixels)); |
| 3497 | 3491 |
| 3498 #ifdef SK_IGNORE_GL_TEXTURE_TARGET | 3492 #ifdef SK_IGNORE_GL_TEXTURE_TARGET |
| 3499 GrGLuint id = info->fID; | 3493 GrGLuint id = info->fID; |
| 3500 delete info; | 3494 delete info; |
| 3501 return id; | 3495 return id; |
| 3502 #else | 3496 #else |
| 3503 return reinterpret_cast<GrBackendObject>(info); | 3497 return reinterpret_cast<GrBackendObject>(info); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3589 this->setVertexArrayID(gpu, 0); | 3583 this->setVertexArrayID(gpu, 0); |
| 3590 } | 3584 } |
| 3591 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3585 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 3592 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3586 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 3593 fDefaultVertexArrayAttribState.resize(attrCount); | 3587 fDefaultVertexArrayAttribState.resize(attrCount); |
| 3594 } | 3588 } |
| 3595 attribState = &fDefaultVertexArrayAttribState; | 3589 attribState = &fDefaultVertexArrayAttribState; |
| 3596 } | 3590 } |
| 3597 return attribState; | 3591 return attribState; |
| 3598 } | 3592 } |
| OLD | NEW |