Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: src/gpu/gl/GrGLCaps.cpp

Issue 1570173004: This CL adds glTexStorage support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Moving check for TexStorage support inside allocate_and_populate_* calls. Changing the caps to indi… Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrGLCaps.h" 9 #include "GrGLCaps.h"
10 10
(...skipping 15 matching lines...) Expand all
26 fMapBufferType = kNone_MapBufferType; 26 fMapBufferType = kNone_MapBufferType;
27 fTransferBufferType = kNone_TransferBufferType; 27 fTransferBufferType = kNone_TransferBufferType;
28 fMaxFragmentUniformVectors = 0; 28 fMaxFragmentUniformVectors = 0;
29 fMaxVertexAttributes = 0; 29 fMaxVertexAttributes = 0;
30 fMaxFragmentTextureUnits = 0; 30 fMaxFragmentTextureUnits = 0;
31 fUnpackRowLengthSupport = false; 31 fUnpackRowLengthSupport = false;
32 fUnpackFlipYSupport = false; 32 fUnpackFlipYSupport = false;
33 fPackRowLengthSupport = false; 33 fPackRowLengthSupport = false;
34 fPackFlipYSupport = false; 34 fPackFlipYSupport = false;
35 fTextureUsageSupport = false; 35 fTextureUsageSupport = false;
36 fTexStorageSupport = false;
37 fTextureRedSupport = false; 36 fTextureRedSupport = false;
38 fImagingSupport = false; 37 fImagingSupport = false;
39 fVertexArrayObjectSupport = false; 38 fVertexArrayObjectSupport = false;
40 fDirectStateAccessSupport = false; 39 fDirectStateAccessSupport = false;
41 fDebugSupport = false; 40 fDebugSupport = false;
42 fES2CompatibilitySupport = false; 41 fES2CompatibilitySupport = false;
43 fMultisampleDisableSupport = false; 42 fMultisampleDisableSupport = false;
44 fDrawIndirectSupport = false; 43 fDrawIndirectSupport = false;
45 fMultiDrawIndirectSupport = false; 44 fMultiDrawIndirectSupport = false;
46 fBaseInstanceSupport = false; 45 fBaseInstanceSupport = false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 fPackRowLengthSupport = version >= GR_GL_VER(3,0) || 99 fPackRowLengthSupport = version >= GR_GL_VER(3,0) ||
101 ctxInfo.hasExtension("GL_NV_pack_subimage"); 100 ctxInfo.hasExtension("GL_NV_pack_subimage");
102 fPackFlipYSupport = 101 fPackFlipYSupport =
103 ctxInfo.hasExtension("GL_ANGLE_pack_reverse_row_order"); 102 ctxInfo.hasExtension("GL_ANGLE_pack_reverse_row_order");
104 } 103 }
105 104
106 fTextureUsageSupport = (kGLES_GrGLStandard == standard) && 105 fTextureUsageSupport = (kGLES_GrGLStandard == standard) &&
107 ctxInfo.hasExtension("GL_ANGLE_texture_usage"); 106 ctxInfo.hasExtension("GL_ANGLE_texture_usage");
108 107
109 if (kGL_GrGLStandard == standard) { 108 if (kGL_GrGLStandard == standard) {
110 // The EXT version can apply to either GL or GLES.
111 fTexStorageSupport = version >= GR_GL_VER(4,2) ||
112 ctxInfo.hasExtension("GL_ARB_texture_storage") ||
113 ctxInfo.hasExtension("GL_EXT_texture_storage");
114 } else {
115 // Qualcomm Adreno drivers appear to have issues with texture storage.
116 fTexStorageSupport = (version >= GR_GL_VER(3,0) &&
117 kQualcomm_GrGLVendor != ctxInfo.vendor()) &&
118 ctxInfo.hasExtension("GL_EXT_texture_storage");
119 }
120
121 if (kGL_GrGLStandard == standard) {
122 fTextureBarrierSupport = version >= GR_GL_VER(4,5) || 109 fTextureBarrierSupport = version >= GR_GL_VER(4,5) ||
123 ctxInfo.hasExtension("GL_ARB_texture_barrier") || 110 ctxInfo.hasExtension("GL_ARB_texture_barrier") ||
124 ctxInfo.hasExtension("GL_NV_texture_barrier"); 111 ctxInfo.hasExtension("GL_NV_texture_barrier");
125 } else { 112 } else {
126 fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier"); 113 fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier");
127 } 114 }
128 115
129 if (kGL_GrGLStandard == standard) { 116 if (kGL_GrGLStandard == standard) {
130 fSampleLocationsSupport = version >= GR_GL_VER(3,2) || 117 fSampleLocationsSupport = version >= GR_GL_VER(3,2) ||
131 ctxInfo.hasExtension("GL_ARB_texture_multisamp le"); 118 ctxInfo.hasExtension("GL_ARB_texture_multisamp le");
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 510
524 this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); 511 this->initShaderPrecisionTable(ctxInfo, gli, glslCaps);
525 512
526 if (contextOptions.fUseShaderSwizzling) { 513 if (contextOptions.fUseShaderSwizzling) {
527 fTextureSwizzleSupport = false; 514 fTextureSwizzleSupport = false;
528 } 515 }
529 516
530 // TODO: remove after command buffer supports full ES 3.0. 517 // TODO: remove after command buffer supports full ES 3.0.
531 if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3, 0) && 518 if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3, 0) &&
532 kChromium_GrGLDriver == ctxInfo.driver()) { 519 kChromium_GrGLDriver == ctxInfo.driver()) {
533 fTexStorageSupport = false;
534 fSupportsInstancedDraws = false; 520 fSupportsInstancedDraws = false;
535 fTextureSwizzleSupport = false; 521 fTextureSwizzleSupport = false;
536 SkASSERT(ctxInfo.hasExtension("GL_CHROMIUM_map_sub")); 522 SkASSERT(ctxInfo.hasExtension("GL_CHROMIUM_map_sub"));
537 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; 523 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag;
538 fMapBufferType = kChromium_MapBufferType; 524 fMapBufferType = kChromium_MapBufferType;
539 } 525 }
540 526
541 // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES com patibility have 527 // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES com patibility have
542 // already been detected. 528 // already been detected.
543 this->initConfigTable(ctxInfo, gli, glslCaps); 529 this->initConfigTable(ctxInfo, gli, glslCaps);
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 r.appendf("Map Buffer Type: %s\n", kMapBufferTypeStr[fMapBufferType]); 1015 r.appendf("Map Buffer Type: %s\n", kMapBufferTypeStr[fMapBufferType]);
1030 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); 1016 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
1031 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); 1017 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits);
1032 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); 1018 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes);
1033 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES ": "NO")); 1019 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES ": "NO"));
1034 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO") ); 1020 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO") );
1035 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": " NO")); 1021 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": " NO"));
1036 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); 1022 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO"));
1037 1023
1038 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" )); 1024 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" ));
1039 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" ));
1040 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); 1025 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
1041 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); 1026 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
1042 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 1027 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
1043 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO")); 1028 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO"));
1044 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); 1029 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO"));
1045 r.appendf("Multisample disable support: %s\n", (fMultisampleDisableSupport ? "YES" : "NO")); 1030 r.appendf("Multisample disable support: %s\n", (fMultisampleDisableSupport ? "YES" : "NO"));
1046 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO ")); 1031 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO "));
1047 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ? "YES" : "NO")); 1032 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ? "YES" : "NO"));
1048 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO ")); 1033 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO "));
1049 r.appendf("Use non-VBO for dynamic data: %s\n", 1034 r.appendf("Use non-VBO for dynamic data: %s\n",
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 Adds R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F, R11F_G11F_B10F. 1291 Adds R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F, R11F_G11F_B10F.
1307 */ 1292 */
1308 uint32_t allRenderFlags = ConfigInfo::kRenderable_Flag; 1293 uint32_t allRenderFlags = ConfigInfo::kRenderable_Flag;
1309 if (kNone_MSFBOType != fMSFBOType) { 1294 if (kNone_MSFBOType != fMSFBOType) {
1310 allRenderFlags |= ConfigInfo::kRenderableWithMSAA_Flag; 1295 allRenderFlags |= ConfigInfo::kRenderableWithMSAA_Flag;
1311 } 1296 }
1312 1297
1313 GrGLStandard standard = ctxInfo.standard(); 1298 GrGLStandard standard = ctxInfo.standard();
1314 GrGLVersion version = ctxInfo.version(); 1299 GrGLVersion version = ctxInfo.version();
1315 1300
1301 bool texStorageSupported = false;
1302 if (kGL_GrGLStandard == standard) {
1303 // The EXT version can apply to either GL or GLES.
1304 texStorageSupported = version >= GR_GL_VER(4,2) ||
1305 ctxInfo.hasExtension("GL_ARB_texture_storage") ||
1306 ctxInfo.hasExtension("GL_EXT_texture_storage");
1307 } else {
1308 // Qualcomm Adreno drivers appear to have issues with texture storage.
1309 texStorageSupported = (version >= GR_GL_VER(3,0) &&
1310 kQualcomm_GrGLVendor != ctxInfo.vendor()) &&
1311 ctxInfo.hasExtension("GL_EXT_texture_storage");
1312 }
1313
1314 // TODO: remove after command buffer supports full ES 3.0
1315 if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0) &&
1316 kChromium_GrGLDriver == ctxInfo.driver()) {
1317 texStorageSupported = false;
1318 }
1319
1316 fConfigTable[kUnknown_GrPixelConfig].fFormats.fBaseInternalFormat = 0; 1320 fConfigTable[kUnknown_GrPixelConfig].fFormats.fBaseInternalFormat = 0;
1317 fConfigTable[kUnknown_GrPixelConfig].fFormats.fSizedInternalFormat = 0; 1321 fConfigTable[kUnknown_GrPixelConfig].fFormats.fSizedInternalFormat = 0;
1318 fConfigTable[kUnknown_GrPixelConfig].fFormats.fExternalFormat[kOther_Externa lFormatUsage] = 0; 1322 fConfigTable[kUnknown_GrPixelConfig].fFormats.fExternalFormat[kOther_Externa lFormatUsage] = 0;
1319 fConfigTable[kUnknown_GrPixelConfig].fFormats.fExternalType = 0; 1323 fConfigTable[kUnknown_GrPixelConfig].fFormats.fExternalType = 0;
1320 fConfigTable[kUnknown_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType; 1324 fConfigTable[kUnknown_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType;
1321 fConfigTable[kUnknown_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1325 fConfigTable[kUnknown_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1322 1326
1323 fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA; 1327 fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA;
1324 fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA8; 1328 fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA8;
1325 fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] = 1329 fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] =
1326 GR_GL_RGBA; 1330 GR_GL_RGBA;
1327 fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGN ED_BYTE; 1331 fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGN ED_BYTE;
1328 fConfigTable[kRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_F ormatType; 1332 fConfigTable[kRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_F ormatType;
1329 fConfigTable[kRGBA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Fla g; 1333 fConfigTable[kRGBA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Fla g;
1330 if (kGL_GrGLStandard == standard) { 1334 if (kGL_GrGLStandard == standard) {
1331 // We require some form of FBO support and all GLs with FBO support can render to RGBA8 1335 // We require some form of FBO support and all GLs with FBO support can render to RGBA8
1332 fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= allRenderFlags; 1336 fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= allRenderFlags;
1333 } else { 1337 } else {
1334 if (version >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_OES_rgb8_rgba8 ") || 1338 if (version >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_OES_rgb8_rgba8 ") ||
1335 ctxInfo.hasExtension("GL_ARM_rgba8")) { 1339 ctxInfo.hasExtension("GL_ARM_rgba8")) {
1336 fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= allRenderFlags; 1340 fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= allRenderFlags;
1337 } 1341 }
1338 } 1342 }
1343 if (texStorageSupported) {
1344 fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexS torage_Flag;
1345 }
1339 fConfigTable[kRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1346 fConfigTable[kRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1340 1347
1341 fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] = 1348 fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] =
1342 GR_GL_BGRA; 1349 GR_GL_BGRA;
1343 fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIG NED_BYTE; 1350 fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIG NED_BYTE;
1344 fConfigTable[kBGRA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_F ormatType; 1351 fConfigTable[kBGRA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_F ormatType;
1345 if (kGL_GrGLStandard == standard) { 1352 if (kGL_GrGLStandard == standard) {
1346 fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR _GL_RGBA; 1353 fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR _GL_RGBA;
1347 fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = G R_GL_RGBA8; 1354 fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = G R_GL_RGBA8;
1348 if (version >= GR_GL_VER(1, 2) || ctxInfo.hasExtension("GL_EXT_bgra")) { 1355 if (version >= GR_GL_VER(1, 2) || ctxInfo.hasExtension("GL_EXT_bgra")) {
(...skipping 17 matching lines...) Expand all
1366 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { 1373 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
1367 fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTexture able_Flag | 1374 fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTexture able_Flag |
1368 ConfigInfo::kRendera ble_Flag; 1375 ConfigInfo::kRendera ble_Flag;
1369 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888") && 1376 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888") &&
1370 (this->usesMSAARenderBuffers() || this->fMSFBOType == kMixedSamp les_MSFBOType)) { 1377 (this->usesMSAARenderBuffers() || this->fMSFBOType == kMixedSamp les_MSFBOType)) {
1371 fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= 1378 fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |=
1372 ConfigInfo::kRenderableWithMSAA_Flag; 1379 ConfigInfo::kRenderableWithMSAA_Flag;
1373 } 1380 }
1374 } 1381 }
1375 } 1382 }
1383 if (texStorageSupported) {
1384 fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexS torage_Flag;
1385 }
1376 fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1386 fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1377 1387
1378 // We only enable srgb support if both textures and FBOs support srgb. 1388 // We only enable srgb support if both textures and FBOs support srgb.
1379 bool srgbSupport = false; 1389 bool srgbSupport = false;
1380 if (kGL_GrGLStandard == standard) { 1390 if (kGL_GrGLStandard == standard) {
1381 if (ctxInfo.version() >= GR_GL_VER(3,0)) { 1391 if (ctxInfo.version() >= GR_GL_VER(3,0)) {
1382 srgbSupport = true; 1392 srgbSupport = true;
1383 } else if (ctxInfo.hasExtension("GL_EXT_texture_sRGB")) { 1393 } else if (ctxInfo.hasExtension("GL_EXT_texture_sRGB")) {
1384 if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") || 1394 if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") ||
1385 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) { 1395 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) {
(...skipping 15 matching lines...) Expand all
1401 // GL does not do srgb<->rgb conversions when transferring between cpu and g pu. Thus, the 1411 // GL does not do srgb<->rgb conversions when transferring between cpu and g pu. Thus, the
1402 // external format is GL_RGBA. See below for note about ES2.0 and glTex[Sub] Image. 1412 // external format is GL_RGBA. See below for note about ES2.0 and glTex[Sub] Image.
1403 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] = 1413 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] =
1404 GR_GL_RGBA; 1414 GR_GL_RGBA;
1405 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIG NED_BYTE; 1415 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIG NED_BYTE;
1406 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_ FormatType; 1416 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_ FormatType;
1407 if (srgbSupport) { 1417 if (srgbSupport) {
1408 fConfigTable[kSRGBA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag | 1418 fConfigTable[kSRGBA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag |
1409 allRenderFlags; 1419 allRenderFlags;
1410 } 1420 }
1421 if (texStorageSupported) {
1422 fConfigTable[kSRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex Storage_Flag;
1423 }
1411 fConfigTable[kSRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1424 fConfigTable[kSRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1412 1425
1413 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RG B; 1426 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RG B;
1414 if (this->ES2CompatibilitySupport()) { 1427 if (this->ES2CompatibilitySupport()) {
1415 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_RGB565; 1428 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_RGB565;
1416 } else { 1429 } else {
1417 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_RGB5; 1430 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_RGB5;
1418 } 1431 }
1419 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fExternalFormat[kOther_Externa lFormatUsage] = 1432 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fExternalFormat[kOther_Externa lFormatUsage] =
1420 GR_GL_RGB; 1433 GR_GL_RGB;
1421 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED _SHORT_5_6_5; 1434 fConfigTable[kRGB_565_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED _SHORT_5_6_5;
1422 fConfigTable[kRGB_565_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType; 1435 fConfigTable[kRGB_565_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType;
1423 fConfigTable[kRGB_565_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; 1436 fConfigTable[kRGB_565_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
1424 if (kGL_GrGLStandard == standard) { 1437 if (kGL_GrGLStandard == standard) {
1425 if (version >= GR_GL_VER(4, 2) || ctxInfo.hasExtension("GL_ES2_compatibi lity")) { 1438 if (version >= GR_GL_VER(4, 2) || ctxInfo.hasExtension("GL_ES2_compatibi lity")) {
1426 fConfigTable[kRGB_565_GrPixelConfig].fFlags |= allRenderFlags; 1439 fConfigTable[kRGB_565_GrPixelConfig].fFlags |= allRenderFlags;
1427 } 1440 }
1428 } else { 1441 } else {
1429 fConfigTable[kRGB_565_GrPixelConfig].fFlags |= allRenderFlags; 1442 fConfigTable[kRGB_565_GrPixelConfig].fFlags |= allRenderFlags;
1430 } 1443 }
1444 // 565 is not a sized internal format on desktop GL. So on desktop with
1445 // 565 we always use an unsized internal format to let the system pick
1446 // the best sized format to convert the 565 data to. Since TexStorage
1447 // only allows sized internal formats we disallow it.
bsalomon 2016/02/27 14:18:54 This logic is due for an update, as of 4.2 regular
cblume 2016/02/28 02:44:42 Want me to throw a TODO in here?
bsalomon 2016/02/29 14:42:28 Sure
cblume 2016/02/29 17:22:31 Done.
1448 if (texStorageSupported && kGL_GrGLStandard != standard) {
1449 fConfigTable[kRGB_565_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexSto rage_Flag;
1450 }
1431 fConfigTable[kRGB_565_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1451 fConfigTable[kRGB_565_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1432 1452
1433 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA; 1453 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA;
1434 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA4; 1454 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA4;
1435 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] = 1455 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] =
1436 GR_GL_RGBA; 1456 GR_GL_RGBA;
1437 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGN ED_SHORT_4_4_4_4; 1457 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGN ED_SHORT_4_4_4_4;
1438 fConfigTable[kRGBA_4444_GrPixelConfig].fFormatType = kNormalizedFixedPoint_F ormatType; 1458 fConfigTable[kRGBA_4444_GrPixelConfig].fFormatType = kNormalizedFixedPoint_F ormatType;
1439 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Fla g; 1459 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Fla g;
1440 if (kGL_GrGLStandard == standard) { 1460 if (kGL_GrGLStandard == standard) {
1441 if (version >= GR_GL_VER(4, 2)) { 1461 if (version >= GR_GL_VER(4, 2)) {
1442 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags; 1462 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags;
1443 } 1463 }
1444 } else { 1464 } else {
1445 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags; 1465 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags;
1446 } 1466 }
1467 if (texStorageSupported) {
1468 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexS torage_Flag;
1469 }
1447 fConfigTable[kRGBA_4444_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1470 fConfigTable[kRGBA_4444_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1448 1471
1449 if (this->textureRedSupport()) { 1472 if (this->textureRedSupport()) {
1450 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_G L_RED; 1473 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_G L_RED;
1451 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_R8; 1474 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_R8;
1452 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_Ext ernalFormatUsage] = 1475 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_Ext ernalFormatUsage] =
1453 GR_GL_RED; 1476 GR_GL_RED;
1454 fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::RRRR(); 1477 fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::RRRR();
1455 } else { 1478 } else {
1456 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_G L_ALPHA; 1479 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_G L_ALPHA;
1457 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_ALPHA8; 1480 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_ALPHA8;
1458 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_Ext ernalFormatUsage] = 1481 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_Ext ernalFormatUsage] =
1459 GR_GL_ALPHA; 1482 GR_GL_ALPHA;
1460 fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::AAAA(); 1483 fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::AAAA();
1461 } 1484 }
1462 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED _BYTE; 1485 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED _BYTE;
1463 fConfigTable[kAlpha_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType; 1486 fConfigTable[kAlpha_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType;
1464 fConfigTable[kAlpha_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; 1487 fConfigTable[kAlpha_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
1465 if (this->textureRedSupport() || kDesktop_ARB_MSFBOType == this->msFBOType() ) { 1488 if (this->textureRedSupport() || kDesktop_ARB_MSFBOType == this->msFBOType() ) {
1466 // desktop ARB extension/3.0+ supports ALPHA8 as renderable. 1489 // desktop ARB extension/3.0+ supports ALPHA8 as renderable.
1467 // Core profile removes ALPHA8 support, but we should have chosen R8 in that case. 1490 // Core profile removes ALPHA8 support, but we should have chosen R8 in that case.
1468 fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags; 1491 fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags;
1469 } 1492 }
1493 if (texStorageSupported) {
1494 fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexSto rage_Flag;
1495 }
1470 1496
1471 // Check for [half] floating point texture support 1497 // Check for [half] floating point texture support
1472 // NOTE: We disallow floating point textures on ES devices if linear filteri ng modes are not 1498 // NOTE: We disallow floating point textures on ES devices if linear filteri ng modes are not
1473 // supported. This is for simplicity, but a more granular approach is possib le. Coincidentally, 1499 // supported. This is for simplicity, but a more granular approach is possib le. Coincidentally,
1474 // [half] floating point textures became part of the standard in ES3.1 / OGL 3.0. 1500 // [half] floating point textures became part of the standard in ES3.1 / OGL 3.0.
1475 bool hasFPTextures = false; 1501 bool hasFPTextures = false;
1476 bool hasHalfFPTextures = false; 1502 bool hasHalfFPTextures = false;
1477 // for now we don't support floating point MSAA on ES 1503 // for now we don't support floating point MSAA on ES
1478 uint32_t fpRenderFlags = (kGL_GrGLStandard == standard) ? 1504 uint32_t fpRenderFlags = (kGL_GrGLStandard == standard) ?
1479 allRenderFlags : (uint32_t)ConfigInfo::kRenderable _Flag; 1505 allRenderFlags : (uint32_t)ConfigInfo::kRenderable _Flag;
(...skipping 27 matching lines...) Expand all
1507 fConfigTable[kRGBA_float_GrPixelConfig].fFormatType = kFloat_FormatType; 1533 fConfigTable[kRGBA_float_GrPixelConfig].fFormatType = kFloat_FormatType;
1508 if (hasFPTextures) { 1534 if (hasFPTextures) {
1509 fConfigTable[kRGBA_float_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag; 1535 fConfigTable[kRGBA_float_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag;
1510 // For now we only enable rendering to float on desktop, because on ES w e'd have to solve 1536 // For now we only enable rendering to float on desktop, because on ES w e'd have to solve
1511 // many precision issues and no clients actually want this yet. 1537 // many precision issues and no clients actually want this yet.
1512 if (kGL_GrGLStandard == standard /* || version >= GR_GL_VER(3,2) || 1538 if (kGL_GrGLStandard == standard /* || version >= GR_GL_VER(3,2) ||
1513 ctxInfo.hasExtension("GL_EXT_color_buffer_float")*/) { 1539 ctxInfo.hasExtension("GL_EXT_color_buffer_float")*/) {
1514 fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= fpRenderFlags; 1540 fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= fpRenderFlags;
1515 } 1541 }
1516 } 1542 }
1543 if (texStorageSupported) {
1544 fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex Storage_Flag;
1545 }
1517 fConfigTable[kRGBA_float_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1546 fConfigTable[kRGBA_float_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1518 1547
1519 if (this->textureRedSupport()) { 1548 if (this->textureRedSupport()) {
1520 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G R_GL_RED; 1549 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G R_GL_RED;
1521 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_R16F; 1550 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_R16F;
1522 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalFormat[kOther_ ExternalFormatUsage] 1551 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalFormat[kOther_ ExternalFormatUsage]
1523 = GR_GL_RED; 1552 = GR_GL_RED;
1524 fConfigTable[kAlpha_half_GrPixelConfig].fSwizzle = GrSwizzle::RRRR(); 1553 fConfigTable[kAlpha_half_GrPixelConfig].fSwizzle = GrSwizzle::RRRR();
1525 } else { 1554 } else {
1526 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G R_GL_ALPHA; 1555 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G R_GL_ALPHA;
(...skipping 11 matching lines...) Expand all
1538 if (hasHalfFPTextures) { 1567 if (hasHalfFPTextures) {
1539 fConfigTable[kAlpha_half_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag; 1568 fConfigTable[kAlpha_half_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag;
1540 // ES requires either 3.2 or the combination of EXT_color_buffer_half_fl oat and support for 1569 // ES requires either 3.2 or the combination of EXT_color_buffer_half_fl oat and support for
1541 // GL_RED internal format. 1570 // GL_RED internal format.
1542 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || 1571 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) ||
1543 (this->textureRedSupport() && 1572 (this->textureRedSupport() &&
1544 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) { 1573 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) {
1545 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags; 1574 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags;
1546 } 1575 }
1547 } 1576 }
1577 if (texStorageSupported) {
1578 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex Storage_Flag;
1579 }
1548 1580
1549 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA; 1581 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA;
1550 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA16F; 1582 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA16F;
1551 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] = 1583 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] =
1552 GR_GL_RGBA; 1584 GR_GL_RGBA;
1553 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER (3, 0)) { 1585 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER (3, 0)) {
1554 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA LF_FLOAT; 1586 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA LF_FLOAT;
1555 } else { 1587 } else {
1556 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA LF_FLOAT_OES; 1588 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA LF_FLOAT_OES;
1557 } 1589 }
1558 fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType; 1590 fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType;
1559 if (hasHalfFPTextures) { 1591 if (hasHalfFPTextures) {
1560 fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable _Flag; 1592 fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable _Flag;
1561 // ES requires 3.2 or EXT_color_buffer_half_float. 1593 // ES requires 3.2 or EXT_color_buffer_half_float.
1562 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || 1594 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) ||
1563 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) { 1595 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) {
1564 fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= fpRenderFlags; 1596 fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= fpRenderFlags;
1565 } 1597 }
1566 } 1598 }
1599 if (texStorageSupported) {
1600 fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexS torage_Flag;
1601 }
1567 fConfigTable[kRGBA_half_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1602 fConfigTable[kRGBA_half_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1568 1603
1569 // Compressed texture support 1604 // Compressed texture support
1570 1605
1571 // glCompressedTexImage2D is available on all OpenGL ES devices. It is avail able on standard 1606 // glCompressedTexImage2D is available on all OpenGL ES devices. It is avail able on standard
1572 // OpenGL after version 1.3. We'll assume at least that level of OpenGL supp ort. 1607 // OpenGL after version 1.3. We'll assume at least that level of OpenGL supp ort.
1573 1608
1574 // TODO: Fix command buffer bindings and remove this. 1609 // TODO: Fix command buffer bindings and remove this.
1575 fCompressedTexSubImageSupport = SkToBool(gli->fFunctions.fCompressedTexSubIm age2D); 1610 fCompressedTexSubImageSupport = SkToBool(gli->fFunctions.fCompressedTexSubIm age2D);
1576 1611
(...skipping 14 matching lines...) Expand all
1591 SkAutoSTMalloc<10, GrGLint> formats(numFormats); 1626 SkAutoSTMalloc<10, GrGLint> formats(numFormats);
1592 GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats); 1627 GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats);
1593 for (int i = 0; i < numFormats; ++i) { 1628 for (int i = 0; i < numFormats; ++i) {
1594 if (GR_GL_PALETTE8_RGBA8 == formats[i]) { 1629 if (GR_GL_PALETTE8_RGBA8 == formats[i]) {
1595 fConfigTable[kIndex_8_GrPixelConfig].fFlags = ConfigInfo::kT extureable_Flag; 1630 fConfigTable[kIndex_8_GrPixelConfig].fFlags = ConfigInfo::kT extureable_Flag;
1596 break; 1631 break;
1597 } 1632 }
1598 } 1633 }
1599 } 1634 }
1600 } 1635 }
1636 if (texStorageSupported) {
1637 fConfigTable[kIndex_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexSto rage_Flag;
bsalomon 2016/02/27 14:18:54 The spec for this (at least the original extension
cblume 2016/02/28 02:44:42 If it is something I can just look up then I would
bsalomon 2016/02/29 14:42:28 Totally up to you... if you do wind up researching
cblume 2016/02/29 17:22:31 I went ahead and disabled all the compressed textu
1638 }
1601 fConfigTable[kIndex_8_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1639 fConfigTable[kIndex_8_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1602 1640
1603 // May change the internal format based on extensions. 1641 // May change the internal format based on extensions.
1604 fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat = 1642 fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat =
1605 GR_GL_COMPRESSED_LUMINANCE_LATC1; 1643 GR_GL_COMPRESSED_LUMINANCE_LATC1;
1606 fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat = 1644 fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
1607 GR_GL_COMPRESSED_LUMINANCE_LATC1; 1645 GR_GL_COMPRESSED_LUMINANCE_LATC1;
1608 if (ctxInfo.hasExtension("GL_EXT_texture_compression_latc") || 1646 if (ctxInfo.hasExtension("GL_EXT_texture_compression_latc") ||
1609 ctxInfo.hasExtension("GL_NV_texture_compression_latc")) { 1647 ctxInfo.hasExtension("GL_NV_texture_compression_latc")) {
1610 fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag ; 1648 fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag ;
1611 } else if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(3, 0)) || 1649 } else if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(3, 0)) ||
1612 ctxInfo.hasExtension("GL_EXT_texture_compression_rgtc") || 1650 ctxInfo.hasExtension("GL_EXT_texture_compression_rgtc") ||
1613 ctxInfo.hasExtension("GL_ARB_texture_compression_rgtc")) { 1651 ctxInfo.hasExtension("GL_ARB_texture_compression_rgtc")) {
1614 // RGTC is identical and available on OpenGL 3.0+ as well as with extens ions 1652 // RGTC is identical and available on OpenGL 3.0+ as well as with extens ions
1615 fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag ; 1653 fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag ;
1616 fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat = 1654 fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat =
1617 GR_GL_COMPRESSED_RED_RGTC1; 1655 GR_GL_COMPRESSED_RED_RGTC1;
1618 fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat = 1656 fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
1619 GR_GL_COMPRESSED_RED_RGTC1; 1657 GR_GL_COMPRESSED_RED_RGTC1;
1620 } else if (ctxInfo.hasExtension("GL_AMD_compressed_3DC_texture")) { 1658 } else if (ctxInfo.hasExtension("GL_AMD_compressed_3DC_texture")) {
1621 fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag ; 1659 fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag ;
1622 fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_C OMPRESSED_3DC_X; 1660 fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_C OMPRESSED_3DC_X;
1623 fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat = 1661 fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
1624 GR_GL_COMPRESSED_3DC_X; 1662 GR_GL_COMPRESSED_3DC_X;
1625 1663
1626 } 1664 }
1627 fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFo rmatUsage] = 0; 1665 fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFo rmatUsage] = 0;
1628 fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalType = 0; 1666 fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalType = 0;
1629 fConfigTable[kLATC_GrPixelConfig].fFormatType = kNormalizedFixedPoint_Format Type; 1667 fConfigTable[kLATC_GrPixelConfig].fFormatType = kNormalizedFixedPoint_Format Type;
1668 if (texStorageSupported) {
1669 fConfigTable[kLATC_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorag e_Flag;
1670 }
1630 fConfigTable[kLATC_GrPixelConfig].fSwizzle = GrSwizzle::RRRR(); 1671 fConfigTable[kLATC_GrPixelConfig].fSwizzle = GrSwizzle::RRRR();
1631 1672
1632 fConfigTable[kETC1_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPR ESSED_ETC1_RGB8; 1673 fConfigTable[kETC1_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPR ESSED_ETC1_RGB8;
1633 fConfigTable[kETC1_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_COMP RESSED_ETC1_RGB8; 1674 fConfigTable[kETC1_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_COMP RESSED_ETC1_RGB8;
1634 fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFo rmatUsage] = 0; 1675 fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFo rmatUsage] = 0;
1635 fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalType = 0; 1676 fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalType = 0;
1636 fConfigTable[kETC1_GrPixelConfig].fFormatType = kNormalizedFixedPoint_Format Type; 1677 fConfigTable[kETC1_GrPixelConfig].fFormatType = kNormalizedFixedPoint_Format Type;
1637 if (kGL_GrGLStandard == standard) { 1678 if (kGL_GrGLStandard == standard) {
1638 if (version >= GR_GL_VER(4, 3) || ctxInfo.hasExtension("GL_ARB_ES3_compa tibility")) { 1679 if (version >= GR_GL_VER(4, 3) || ctxInfo.hasExtension("GL_ARB_ES3_compa tibility")) {
1639 fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_ Flag; 1680 fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_ Flag;
1640 } 1681 }
1641 } else { 1682 } else {
1642 if (version >= GR_GL_VER(3, 0) || 1683 if (version >= GR_GL_VER(3, 0) ||
1643 ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") || 1684 ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") ||
1644 // ETC2 is a superset of ETC1, so we can just check for that, too. 1685 // ETC2 is a superset of ETC1, so we can just check for that, too.
1645 (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && 1686 (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") &&
1646 ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"))) { 1687 ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"))) {
1647 fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_ Flag; 1688 fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_ Flag;
1648 } 1689 }
1649 } 1690 }
1691 if (texStorageSupported) {
1692 fConfigTable[kETC1_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorag e_Flag;
1693 }
1650 fConfigTable[kETC1_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1694 fConfigTable[kETC1_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1651 1695
1652 fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_CO MPRESSED_R11_EAC; 1696 fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_CO MPRESSED_R11_EAC;
1653 fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_C OMPRESSED_R11_EAC; 1697 fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_C OMPRESSED_R11_EAC;
1654 fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fExternalFormat[kOther_Externa lFormatUsage] = 0; 1698 fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fExternalFormat[kOther_Externa lFormatUsage] = 0;
1655 fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fExternalType = 0; 1699 fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fExternalType = 0;
1656 fConfigTable[kR11_EAC_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType; 1700 fConfigTable[kR11_EAC_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType;
1657 // Check for R11_EAC. We don't support R11_EAC on desktop, as most cards def ault to 1701 // Check for R11_EAC. We don't support R11_EAC on desktop, as most cards def ault to
1658 // decompressing the textures in the driver, and is generally slower. 1702 // decompressing the textures in the driver, and is generally slower.
1659 if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) { 1703 if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) {
1660 fConfigTable[kR11_EAC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_F lag; 1704 fConfigTable[kR11_EAC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_F lag;
1661 } 1705 }
1706 if (texStorageSupported) {
1707 fConfigTable[kR11_EAC_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexSto rage_Flag;
1708 }
1662 fConfigTable[kR11_EAC_GrPixelConfig].fSwizzle = GrSwizzle::RRRR(); 1709 fConfigTable[kR11_EAC_GrPixelConfig].fSwizzle = GrSwizzle::RRRR();
1663 1710
1664 fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fBaseInternalFormat = 1711 fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fBaseInternalFormat =
1665 GR_GL_COMPRESSED_RGBA_ASTC_12x12; 1712 GR_GL_COMPRESSED_RGBA_ASTC_12x12;
1666 fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fSizedInternalFormat = 1713 fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fSizedInternalFormat =
1667 GR_GL_COMPRESSED_RGBA_ASTC_12x12; 1714 GR_GL_COMPRESSED_RGBA_ASTC_12x12;
1668 fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] = 1715 fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] =
1669 0; 1716 0;
1670 fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fExternalType = 0; 1717 fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fExternalType = 0;
1671 fConfigTable[kASTC_12x12_GrPixelConfig].fFormatType = kNormalizedFixedPoint_ FormatType; 1718 fConfigTable[kASTC_12x12_GrPixelConfig].fFormatType = kNormalizedFixedPoint_ FormatType;
1672 if (ctxInfo.hasExtension("GL_KHR_texture_compression_astc_hdr") || 1719 if (ctxInfo.hasExtension("GL_KHR_texture_compression_astc_hdr") ||
1673 ctxInfo.hasExtension("GL_KHR_texture_compression_astc_ldr") || 1720 ctxInfo.hasExtension("GL_KHR_texture_compression_astc_ldr") ||
1674 ctxInfo.hasExtension("GL_OES_texture_compression_astc")) { 1721 ctxInfo.hasExtension("GL_OES_texture_compression_astc")) {
1675 fConfigTable[kASTC_12x12_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag; 1722 fConfigTable[kASTC_12x12_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag;
1676 } 1723 }
1724 if (texStorageSupported) {
1725 fConfigTable[kASTC_12x12_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex Storage_Flag;
1726 }
1677 fConfigTable[kASTC_12x12_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1727 fConfigTable[kASTC_12x12_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1678 1728
1679 // Bulk populate the texture internal/external formats here and then deal wi th exceptions below. 1729 // Bulk populate the texture internal/external formats here and then deal wi th exceptions below.
1680 1730
1681 // ES 2.0 requires that the internal/external formats match. 1731 // ES 2.0 requires that the internal/external formats match.
1682 bool useSizedTexFormats = (kGL_GrGLStandard == ctxInfo.standard() || 1732 bool useSizedTexFormats = (kGL_GrGLStandard == ctxInfo.standard() ||
1683 ctxInfo.version() >= GR_GL_VER(3,0)); 1733 ctxInfo.version() >= GR_GL_VER(3,0));
1684 // All ES versions (thus far) require sized internal formats for render buff ers. 1734 // All ES versions (thus far) require sized internal formats for render buff ers.
1685 // TODO: Always use sized internal format? 1735 // TODO: Always use sized internal format?
1686 bool useSizedRbFormats = kGLES_GrGLStandard == ctxInfo.standard(); 1736 bool useSizedRbFormats = kGLES_GrGLStandard == ctxInfo.standard();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { 1802 for (int j = 0; j < kExternalFormatUsageCnt; ++j) {
1753 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != 1803 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] !=
1754 fConfigTable[i].fFormats.fExternalFormat[j]); 1804 fConfigTable[i].fFormats.fExternalFormat[j]);
1755 } 1805 }
1756 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); 1806 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType);
1757 } 1807 }
1758 #endif 1808 #endif
1759 } 1809 }
1760 1810
1761 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} 1811 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {}
OLDNEW
« src/gpu/gl/GrGLCaps.h ('K') | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698