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

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: Adding TODO comment. 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
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
1448 //
1449 // TODO: As of 4.2, regular GL supports 565. This logic is due for an
1450 // update.
1451 if (texStorageSupported && kGL_GrGLStandard != standard) {
1452 fConfigTable[kRGB_565_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexSto rage_Flag;
1453 }
1431 fConfigTable[kRGB_565_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1454 fConfigTable[kRGB_565_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1432 1455
1433 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA; 1456 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA;
1434 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA4; 1457 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA4;
1435 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] = 1458 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] =
1436 GR_GL_RGBA; 1459 GR_GL_RGBA;
1437 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGN ED_SHORT_4_4_4_4; 1460 fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGN ED_SHORT_4_4_4_4;
1438 fConfigTable[kRGBA_4444_GrPixelConfig].fFormatType = kNormalizedFixedPoint_F ormatType; 1461 fConfigTable[kRGBA_4444_GrPixelConfig].fFormatType = kNormalizedFixedPoint_F ormatType;
1439 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Fla g; 1462 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Fla g;
1440 if (kGL_GrGLStandard == standard) { 1463 if (kGL_GrGLStandard == standard) {
1441 if (version >= GR_GL_VER(4, 2)) { 1464 if (version >= GR_GL_VER(4, 2)) {
1442 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags; 1465 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags;
1443 } 1466 }
1444 } else { 1467 } else {
1445 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags; 1468 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags;
1446 } 1469 }
1470 if (texStorageSupported) {
1471 fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexS torage_Flag;
1472 }
1447 fConfigTable[kRGBA_4444_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1473 fConfigTable[kRGBA_4444_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1448 1474
1449 if (this->textureRedSupport()) { 1475 if (this->textureRedSupport()) {
1450 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_G L_RED; 1476 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_G L_RED;
1451 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_R8; 1477 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_R8;
1452 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_Ext ernalFormatUsage] = 1478 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_Ext ernalFormatUsage] =
1453 GR_GL_RED; 1479 GR_GL_RED;
1454 fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::RRRR(); 1480 fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::RRRR();
1455 } else { 1481 } else {
1456 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_G L_ALPHA; 1482 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_G L_ALPHA;
1457 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_ALPHA8; 1483 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_ GL_ALPHA8;
1458 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_Ext ernalFormatUsage] = 1484 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_Ext ernalFormatUsage] =
1459 GR_GL_ALPHA; 1485 GR_GL_ALPHA;
1460 fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::AAAA(); 1486 fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::AAAA();
1461 } 1487 }
1462 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED _BYTE; 1488 fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED _BYTE;
1463 fConfigTable[kAlpha_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType; 1489 fConfigTable[kAlpha_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_For matType;
1464 fConfigTable[kAlpha_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; 1490 fConfigTable[kAlpha_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
1465 if (this->textureRedSupport() || kDesktop_ARB_MSFBOType == this->msFBOType() ) { 1491 if (this->textureRedSupport() || kDesktop_ARB_MSFBOType == this->msFBOType() ) {
1466 // desktop ARB extension/3.0+ supports ALPHA8 as renderable. 1492 // desktop ARB extension/3.0+ supports ALPHA8 as renderable.
1467 // Core profile removes ALPHA8 support, but we should have chosen R8 in that case. 1493 // Core profile removes ALPHA8 support, but we should have chosen R8 in that case.
1468 fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags; 1494 fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags;
1469 } 1495 }
1496 if (texStorageSupported) {
1497 fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexSto rage_Flag;
1498 }
1470 1499
1471 // Check for [half] floating point texture support 1500 // Check for [half] floating point texture support
1472 // NOTE: We disallow floating point textures on ES devices if linear filteri ng modes are not 1501 // 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, 1502 // 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. 1503 // [half] floating point textures became part of the standard in ES3.1 / OGL 3.0.
1475 bool hasFPTextures = false; 1504 bool hasFPTextures = false;
1476 bool hasHalfFPTextures = false; 1505 bool hasHalfFPTextures = false;
1477 // for now we don't support floating point MSAA on ES 1506 // for now we don't support floating point MSAA on ES
1478 uint32_t fpRenderFlags = (kGL_GrGLStandard == standard) ? 1507 uint32_t fpRenderFlags = (kGL_GrGLStandard == standard) ?
1479 allRenderFlags : (uint32_t)ConfigInfo::kRenderable _Flag; 1508 allRenderFlags : (uint32_t)ConfigInfo::kRenderable _Flag;
(...skipping 27 matching lines...) Expand all
1507 fConfigTable[kRGBA_float_GrPixelConfig].fFormatType = kFloat_FormatType; 1536 fConfigTable[kRGBA_float_GrPixelConfig].fFormatType = kFloat_FormatType;
1508 if (hasFPTextures) { 1537 if (hasFPTextures) {
1509 fConfigTable[kRGBA_float_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag; 1538 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 1539 // 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. 1540 // many precision issues and no clients actually want this yet.
1512 if (kGL_GrGLStandard == standard /* || version >= GR_GL_VER(3,2) || 1541 if (kGL_GrGLStandard == standard /* || version >= GR_GL_VER(3,2) ||
1513 ctxInfo.hasExtension("GL_EXT_color_buffer_float")*/) { 1542 ctxInfo.hasExtension("GL_EXT_color_buffer_float")*/) {
1514 fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= fpRenderFlags; 1543 fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= fpRenderFlags;
1515 } 1544 }
1516 } 1545 }
1546 if (texStorageSupported) {
1547 fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex Storage_Flag;
1548 }
1517 fConfigTable[kRGBA_float_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1549 fConfigTable[kRGBA_float_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1518 1550
1519 if (this->textureRedSupport()) { 1551 if (this->textureRedSupport()) {
1520 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G R_GL_RED; 1552 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G R_GL_RED;
1521 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_R16F; 1553 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_R16F;
1522 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalFormat[kOther_ ExternalFormatUsage] 1554 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalFormat[kOther_ ExternalFormatUsage]
1523 = GR_GL_RED; 1555 = GR_GL_RED;
1524 fConfigTable[kAlpha_half_GrPixelConfig].fSwizzle = GrSwizzle::RRRR(); 1556 fConfigTable[kAlpha_half_GrPixelConfig].fSwizzle = GrSwizzle::RRRR();
1525 } else { 1557 } else {
1526 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G R_GL_ALPHA; 1558 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G R_GL_ALPHA;
(...skipping 11 matching lines...) Expand all
1538 if (hasHalfFPTextures) { 1570 if (hasHalfFPTextures) {
1539 fConfigTable[kAlpha_half_GrPixelConfig].fFlags = ConfigInfo::kTextureabl e_Flag; 1571 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 1572 // ES requires either 3.2 or the combination of EXT_color_buffer_half_fl oat and support for
1541 // GL_RED internal format. 1573 // GL_RED internal format.
1542 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || 1574 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) ||
1543 (this->textureRedSupport() && 1575 (this->textureRedSupport() &&
1544 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) { 1576 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) {
1545 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags; 1577 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags;
1546 } 1578 }
1547 } 1579 }
1580 if (texStorageSupported) {
1581 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex Storage_Flag;
1582 }
1548 1583
1549 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA; 1584 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ RGBA;
1550 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA16F; 1585 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL _RGBA16F;
1551 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] = 1586 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter nalFormatUsage] =
1552 GR_GL_RGBA; 1587 GR_GL_RGBA;
1553 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER (3, 0)) { 1588 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER (3, 0)) {
1554 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA LF_FLOAT; 1589 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA LF_FLOAT;
1555 } else { 1590 } else {
1556 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA LF_FLOAT_OES; 1591 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA LF_FLOAT_OES;
1557 } 1592 }
1558 fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType; 1593 fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType;
1559 if (hasHalfFPTextures) { 1594 if (hasHalfFPTextures) {
1560 fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable _Flag; 1595 fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable _Flag;
1561 // ES requires 3.2 or EXT_color_buffer_half_float. 1596 // ES requires 3.2 or EXT_color_buffer_half_float.
1562 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || 1597 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) ||
1563 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) { 1598 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) {
1564 fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= fpRenderFlags; 1599 fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= fpRenderFlags;
1565 } 1600 }
1566 } 1601 }
1602 if (texStorageSupported) {
1603 fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexS torage_Flag;
1604 }
1567 fConfigTable[kRGBA_half_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1605 fConfigTable[kRGBA_half_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1568 1606
1569 // Compressed texture support 1607 // Compressed texture support
1570 1608
1571 // glCompressedTexImage2D is available on all OpenGL ES devices. It is avail able on standard 1609 // 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. 1610 // OpenGL after version 1.3. We'll assume at least that level of OpenGL supp ort.
1573 1611
1574 // TODO: Fix command buffer bindings and remove this. 1612 // TODO: Fix command buffer bindings and remove this.
1575 fCompressedTexSubImageSupport = SkToBool(gli->fFunctions.fCompressedTexSubIm age2D); 1613 fCompressedTexSubImageSupport = SkToBool(gli->fFunctions.fCompressedTexSubIm age2D);
1576 1614
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { 1790 for (int j = 0; j < kExternalFormatUsageCnt; ++j) {
1753 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != 1791 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] !=
1754 fConfigTable[i].fFormats.fExternalFormat[j]); 1792 fConfigTable[i].fFormats.fExternalFormat[j]);
1755 } 1793 }
1756 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); 1794 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType);
1757 } 1795 }
1758 #endif 1796 #endif
1759 } 1797 }
1760 1798
1761 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} 1799 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {}
OLDNEW
« no previous file with comments | « 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