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

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

Issue 304743004: Move ETC1 and LATC enums value to GrPixelConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Only generate mipmaps for uncompressed textures. Created 6 years, 6 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/GrGLDefines.h » ('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 #include "GrGLContext.h" 10 #include "GrGLContext.h"
(...skipping 12 matching lines...) Expand all
23 fStencilVerifiedColorConfigs.reset(); 23 fStencilVerifiedColorConfigs.reset();
24 fMSFBOType = kNone_MSFBOType; 24 fMSFBOType = kNone_MSFBOType;
25 fFBFetchType = kNone_FBFetchType; 25 fFBFetchType = kNone_FBFetchType;
26 fInvalidateFBType = kNone_InvalidateFBType; 26 fInvalidateFBType = kNone_InvalidateFBType;
27 fMapBufferType = kNone_MapBufferType; 27 fMapBufferType = kNone_MapBufferType;
28 fMaxFragmentUniformVectors = 0; 28 fMaxFragmentUniformVectors = 0;
29 fMaxVertexAttributes = 0; 29 fMaxVertexAttributes = 0;
30 fMaxFragmentTextureUnits = 0; 30 fMaxFragmentTextureUnits = 0;
31 fMaxFixedFunctionTextureCoords = 0; 31 fMaxFixedFunctionTextureCoords = 0;
32 fRGBA8RenderbufferSupport = false; 32 fRGBA8RenderbufferSupport = false;
33 fBGRAFormatSupport = false;
34 fBGRAIsInternalFormat = false; 33 fBGRAIsInternalFormat = false;
35 fTextureSwizzleSupport = false; 34 fTextureSwizzleSupport = false;
36 fUnpackRowLengthSupport = false; 35 fUnpackRowLengthSupport = false;
37 fUnpackFlipYSupport = false; 36 fUnpackFlipYSupport = false;
38 fPackRowLengthSupport = false; 37 fPackRowLengthSupport = false;
39 fPackFlipYSupport = false; 38 fPackFlipYSupport = false;
40 fTextureUsageSupport = false; 39 fTextureUsageSupport = false;
41 fTexStorageSupport = false; 40 fTexStorageSupport = false;
42 fTextureRedSupport = false; 41 fTextureRedSupport = false;
43 fImagingSupport = false; 42 fImagingSupport = false;
(...skipping 17 matching lines...) Expand all
61 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; 60 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs;
62 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; 61 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors;
63 fMaxVertexAttributes = caps.fMaxVertexAttributes; 62 fMaxVertexAttributes = caps.fMaxVertexAttributes;
64 fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits; 63 fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits;
65 fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords; 64 fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords;
66 fMSFBOType = caps.fMSFBOType; 65 fMSFBOType = caps.fMSFBOType;
67 fFBFetchType = caps.fFBFetchType; 66 fFBFetchType = caps.fFBFetchType;
68 fInvalidateFBType = caps.fInvalidateFBType; 67 fInvalidateFBType = caps.fInvalidateFBType;
69 fMapBufferType = caps.fMapBufferType; 68 fMapBufferType = caps.fMapBufferType;
70 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; 69 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport;
71 fBGRAFormatSupport = caps.fBGRAFormatSupport;
72 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; 70 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat;
73 fTextureSwizzleSupport = caps.fTextureSwizzleSupport; 71 fTextureSwizzleSupport = caps.fTextureSwizzleSupport;
74 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; 72 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport;
75 fUnpackFlipYSupport = caps.fUnpackFlipYSupport; 73 fUnpackFlipYSupport = caps.fUnpackFlipYSupport;
76 fPackRowLengthSupport = caps.fPackRowLengthSupport; 74 fPackRowLengthSupport = caps.fPackRowLengthSupport;
77 fPackFlipYSupport = caps.fPackFlipYSupport; 75 fPackFlipYSupport = caps.fPackFlipYSupport;
78 fTextureUsageSupport = caps.fTextureUsageSupport; 76 fTextureUsageSupport = caps.fTextureUsageSupport;
79 fTexStorageSupport = caps.fTexStorageSupport; 77 fTexStorageSupport = caps.fTexStorageSupport;
80 fTextureRedSupport = caps.fTextureRedSupport; 78 fTextureRedSupport = caps.fTextureRedSupport;
81 fImagingSupport = caps.fImagingSupport; 79 fImagingSupport = caps.fImagingSupport;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 126
129 if (kGL_GrGLStandard == standard) { 127 if (kGL_GrGLStandard == standard) {
130 fRGBA8RenderbufferSupport = true; 128 fRGBA8RenderbufferSupport = true;
131 } else { 129 } else {
132 fRGBA8RenderbufferSupport = version >= GR_GL_VER(3,0) || 130 fRGBA8RenderbufferSupport = version >= GR_GL_VER(3,0) ||
133 ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || 131 ctxInfo.hasExtension("GL_OES_rgb8_rgba8") ||
134 ctxInfo.hasExtension("GL_ARM_rgba8"); 132 ctxInfo.hasExtension("GL_ARM_rgba8");
135 } 133 }
136 134
137 if (kGL_GrGLStandard == standard) { 135 if (kGL_GrGLStandard == standard) {
138 fBGRAFormatSupport = version >= GR_GL_VER(1,2) ||
139 ctxInfo.hasExtension("GL_EXT_bgra");
140 } else {
141 if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) {
142 fBGRAFormatSupport = true;
143 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
144 fBGRAFormatSupport = true;
145 fBGRAIsInternalFormat = true;
146 }
147 SkASSERT(fBGRAFormatSupport ||
148 kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig);
149 }
150
151 if (kGL_GrGLStandard == standard) {
152 fTextureSwizzleSupport = version >= GR_GL_VER(3,3) || 136 fTextureSwizzleSupport = version >= GR_GL_VER(3,3) ||
153 ctxInfo.hasExtension("GL_ARB_texture_swizzle"); 137 ctxInfo.hasExtension("GL_ARB_texture_swizzle");
154 } else { 138 } else {
155 fTextureSwizzleSupport = version >= GR_GL_VER(3,0); 139 fTextureSwizzleSupport = version >= GR_GL_VER(3,0);
156 } 140 }
157 141
158 if (kGL_GrGLStandard == standard) { 142 if (kGL_GrGLStandard == standard) {
159 fUnpackRowLengthSupport = true; 143 fUnpackRowLengthSupport = true;
160 fUnpackFlipYSupport = false; 144 fUnpackFlipYSupport = false;
161 fPackRowLengthSupport = true; 145 fPackRowLengthSupport = true;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 239
256 // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader 240 // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader
257 fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); 241 fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor();
258 242
259 this->initFSAASupport(ctxInfo, gli); 243 this->initFSAASupport(ctxInfo, gli);
260 this->initStencilFormats(ctxInfo); 244 this->initStencilFormats(ctxInfo);
261 245
262 /************************************************************************** 246 /**************************************************************************
263 * GrDrawTargetCaps fields 247 * GrDrawTargetCaps fields
264 **************************************************************************/ 248 **************************************************************************/
265 GrGLint numFormats;
266 GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats);
267 if (numFormats) {
268 SkAutoSTMalloc<10, GrGLint> formats(numFormats);
269 GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats);
270 for (int i = 0; i < numFormats; ++i) {
271 if (formats[i] == GR_GL_PALETTE8_RGBA8) {
272 f8BitPaletteSupport = true;
273 break;
274 }
275 }
276 }
277
278 if (kGL_GrGLStandard == standard) { 249 if (kGL_GrGLStandard == standard) {
279 // we could also look for GL_ATI_separate_stencil extension or 250 // we could also look for GL_ATI_separate_stencil extension or
280 // GL_EXT_stencil_two_side but they use different function signatures 251 // GL_EXT_stencil_two_side but they use different function signatures
281 // than GL2.0+ (and than each other). 252 // than GL2.0+ (and than each other).
282 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); 253 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0));
283 // supported on GL 1.4 and higher or by extension 254 // supported on GL 1.4 and higher or by extension
284 fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) || 255 fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) ||
285 ctxInfo.hasExtension("GL_EXT_stencil_wrap"); 256 ctxInfo.hasExtension("GL_EXT_stencil_wrap");
286 } else { 257 } else {
287 // ES 2 has two sided stencil and stencil wrap 258 // ES 2 has two sided stencil and stencil wrap
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } else { 331 } else {
361 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat ives"); 332 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat ives");
362 } 333 }
363 334
364 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { 335 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) {
365 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); 336 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount);
366 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { 337 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) {
367 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); 338 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount);
368 } 339 }
369 340
341 this->initConfigTexturableTable(ctxInfo, gli);
370 this->initConfigRenderableTable(ctxInfo); 342 this->initConfigRenderableTable(ctxInfo);
371 343
372 this->initCompressedTextureSupport(ctxInfo);
373
374 return true; 344 return true;
375 } 345 }
376 346
377 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { 347 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) {
378 348
379 // OpenGL < 3.0 349 // OpenGL < 3.0
380 // no support for render targets unless the GL_ARB_framebuffer_object 350 // no support for render targets unless the GL_ARB_framebuffer_object
381 // extension is supported (in which case we get ALPHA, RED, RG, RGB, 351 // extension is supported (in which case we get ALPHA, RED, RG, RGB,
382 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we 352 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we
383 // probably don't get R8 in this case. 353 // probably don't get R8 in this case.
(...skipping 13 matching lines...) Expand all
397 // ES 2.0 367 // ES 2.0
398 // color renderable: RGBA4, RGB5_A1, RGB565 368 // color renderable: RGBA4, RGB5_A1, RGB565
399 // GL_EXT_texture_rg adds support for R8 as a color render target 369 // GL_EXT_texture_rg adds support for R8 as a color render target
400 // GL_OES_rgb8_rgba8 and/or GL_ARM_rgba8 adds support for RGBA8 370 // GL_OES_rgb8_rgba8 and/or GL_ARM_rgba8 adds support for RGBA8
401 // GL_EXT_texture_format_BGRA8888 and/or GL_APPLE_texture_format_BGRA8888 a dded BGRA support 371 // GL_EXT_texture_format_BGRA8888 and/or GL_APPLE_texture_format_BGRA8888 a dded BGRA support
402 372
403 // ES 3.0 373 // ES 3.0
404 // Same as ES 2.0 except R8 and RGBA8 are supported without extensions (the functions called 374 // Same as ES 2.0 except R8 and RGBA8 are supported without extensions (the functions called
405 // below already account for this). 375 // below already account for this).
406 376
377 GrGLStandard standard = ctxInfo.standard();
378
407 enum { 379 enum {
408 kNo_MSAA = 0, 380 kNo_MSAA = 0,
409 kYes_MSAA = 1, 381 kYes_MSAA = 1,
410 }; 382 };
411 383
412 if (kGL_GrGLStandard == ctxInfo.standard()) { 384 if (kGL_GrGLStandard == standard) {
413 // Post 3.0 we will get R8 385 // Post 3.0 we will get R8
414 // Prior to 3.0 we will get ALPHA8 (with GL_ARB_framebuffer_object) 386 // Prior to 3.0 we will get ALPHA8 (with GL_ARB_framebuffer_object)
415 if (ctxInfo.version() >= GR_GL_VER(3,0) || 387 if (ctxInfo.version() >= GR_GL_VER(3,0) ||
416 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { 388 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
417 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = true; 389 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = true;
418 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = true; 390 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = true;
419 } 391 }
420 } else { 392 } else {
421 // On ES we can only hope for R8 393 // On ES we can only hope for R8
422 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = fTextureRedSupp ort; 394 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = fTextureRedSupp ort;
423 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSup port; 395 fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSup port;
424 } 396 }
425 397
426 if (kGL_GrGLStandard != ctxInfo.standard()) { 398 if (kGL_GrGLStandard != standard) {
427 // only available in ES 399 // only available in ES
428 fConfigRenderSupport[kRGB_565_GrPixelConfig][kNo_MSAA] = true; 400 fConfigRenderSupport[kRGB_565_GrPixelConfig][kNo_MSAA] = true;
429 fConfigRenderSupport[kRGB_565_GrPixelConfig][kYes_MSAA] = true; 401 fConfigRenderSupport[kRGB_565_GrPixelConfig][kYes_MSAA] = true;
430 } 402 }
431 403
432 // we no longer support 444 as a render target 404 // we no longer support 444 as a render target
433 fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kNo_MSAA] = false; 405 fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kNo_MSAA] = false;
434 fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kYes_MSAA] = false; 406 fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kYes_MSAA] = false;
435 407
436 if (this->fRGBA8RenderbufferSupport) { 408 if (this->fRGBA8RenderbufferSupport) {
437 fConfigRenderSupport[kRGBA_8888_GrPixelConfig][kNo_MSAA] = true; 409 fConfigRenderSupport[kRGBA_8888_GrPixelConfig][kNo_MSAA] = true;
438 fConfigRenderSupport[kRGBA_8888_GrPixelConfig][kYes_MSAA] = true; 410 fConfigRenderSupport[kRGBA_8888_GrPixelConfig][kYes_MSAA] = true;
439 } 411 }
440 412
441 if (this->fBGRAFormatSupport) { 413 if (this->isConfigTexturable(kBGRA_8888_GrPixelConfig)) {
442 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kNo_MSAA] = true; 414 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kNo_MSAA] = true;
443 // The GL_EXT_texture_format_BGRA8888 extension does not add BGRA to the list of 415 // The GL_EXT_texture_format_BGRA8888 extension does not add BGRA to the list of
444 // configs that are color-renderable and can be passed to glRenderBuffer StorageMultisample. 416 // configs that are color-renderable and can be passed to glRenderBuffer StorageMultisample.
445 // Chromium may have an extension to allow BGRA renderbuffers to work on desktop platforms. 417 // Chromium may have an extension to allow BGRA renderbuffers to work on desktop platforms.
446 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) { 418 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) {
447 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true; 419 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true;
448 } else { 420 } else {
449 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = 421 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] =
450 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers(); 422 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers();
451 } 423 }
452 } 424 }
453 425
454 // If we don't support MSAA then undo any places above where we set a config as renderable with 426 // If we don't support MSAA then undo any places above where we set a config as renderable with
455 // msaa. 427 // msaa.
456 if (kNone_MSFBOType == fMSFBOType) { 428 if (kNone_MSFBOType == fMSFBOType) {
457 for (int i = 0; i < kGrPixelConfigCnt; ++i) { 429 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
458 fConfigRenderSupport[i][kYes_MSAA] = false; 430 fConfigRenderSupport[i][kYes_MSAA] = false;
459 } 431 }
460 } 432 }
461 } 433 }
462 434
463 void GrGLCaps::initCompressedTextureSupport(const GrGLContextInfo &ctxInfo) { 435 void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G rGLInterface* gli) {
464 GrGLStandard standard = ctxInfo.standard(); 436 GrGLStandard standard = ctxInfo.standard();
465 GrGLVersion version = ctxInfo.version(); 437 GrGLVersion version = ctxInfo.version();
466 438
439 // Base texture support
440 fConfigTextureSupport[kAlpha_8_GrPixelConfig] = true;
441 fConfigTextureSupport[kRGB_565_GrPixelConfig] = true;
442 fConfigTextureSupport[kRGBA_4444_GrPixelConfig] = true;
443 fConfigTextureSupport[kRGBA_8888_GrPixelConfig] = true;
444
445 // Check for 8-bit palette..
446 GrGLint numFormats;
447 GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats);
448 if (numFormats) {
449 SkAutoSTMalloc<10, GrGLint> formats(numFormats);
450 GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats);
451 for (int i = 0; i < numFormats; ++i) {
452 if (GR_GL_PALETTE8_RGBA8 == formats[i]) {
453 fConfigTextureSupport[kIndex_8_GrPixelConfig] = true;
454 break;
455 }
456 }
457 }
458
459 // Check for BGRA
460 if (kGL_GrGLStandard == standard) {
461 fConfigTextureSupport[kBGRA_8888_GrPixelConfig] =
462 version >= GR_GL_VER(1,2) || ctxInfo.hasExtension("GL_EXT_bgra");
463 } else {
464 if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) {
465 fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true;
466 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
467 fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true;
468 fBGRAIsInternalFormat = true;
469 }
470 SkASSERT(fConfigTextureSupport[kBGRA_8888_GrPixelConfig] ||
471 kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig);
472 }
473
474 // Compressed texture support
475
467 // glCompressedTexImage2D is available on all OpenGL ES devices... 476 // glCompressedTexImage2D is available on all OpenGL ES devices...
468 // however, it is only available on standard OpenGL after version 1.3 477 // however, it is only available on standard OpenGL after version 1.3
469 if (kGL_GrGLStandard == standard && version < GR_GL_VER(1, 3)) { 478 bool hasCompressTex2D = (kGL_GrGLStandard != standard || version >= GR_GL_VE R(1, 3));
470 return;
471 }
472 479
473 // Check for ETC1 480 // Check for ETC1
474 bool hasETC1 = false; 481 bool hasETC1 = false;
475 482
476 // First check version for support 483 // First check version for support
477 if (kGL_GrGLStandard == standard) { 484 if (kGL_GrGLStandard == standard) {
478 hasETC1 = 485 hasETC1 = hasCompressTex2D &&
479 version >= GR_GL_VER(4, 3) || 486 (version >= GR_GL_VER(4, 3) ||
480 ctxInfo.hasExtension("GL_ARB_ES3_compatibility"); 487 ctxInfo.hasExtension("GL_ARB_ES3_compatibility"));
481 } else { 488 } else {
482 hasETC1 = 489 hasETC1 = hasCompressTex2D &&
483 version >= GR_GL_VER(3, 0) || 490 (version >= GR_GL_VER(3, 0) ||
484 ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") || 491 ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") ||
485 // ETC2 is a superset of ETC1, so we can just check for that, too. 492 // ETC2 is a superset of ETC1, so we can just check for that, too.
486 (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && 493 (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") &&
487 ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture")); 494 ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture")));
488 } 495 }
489 fCompressedFormatSupport[kETC1_GrCompressedFormat] = hasETC1; 496 fConfigTextureSupport[kETC1_GrPixelConfig] = hasETC1;
490 497
491 fCompressedFormatSupport[kETC2_GrCompressedFormat] = false; 498 // Check for LATC under its various forms
492 fCompressedFormatSupport[kDXT1_GrCompressedFormat] = false; 499 LATCAlias alias = kLATC_LATCAlias;
500 bool hasLATC = hasCompressTex2D &&
501 (ctxInfo.hasExtension("GL_EXT_texture_compression_latc") ||
502 ctxInfo.hasExtension("GL_NV_texture_compression_latc"));
503
504 // Check for RGTC
505 if (!hasLATC) {
506 // If we're using OpenGL 3.0 or later, then we have RGTC, an identical c ompression format.
507 if (kGL_GrGLStandard == standard) {
508 hasLATC = version >= GR_GL_VER(3, 0);
509 }
510
511 if (!hasLATC) {
512 hasLATC =
513 ctxInfo.hasExtension("GL_EXT_texture_compression_rgtc") ||
514 ctxInfo.hasExtension("GL_ARB_texture_compression_rgtc");
515 }
516
517 if (hasLATC) {
518 alias = kRGTC_LATCAlias;
519 }
520 }
521
522 // Check for 3DC
523 if (!hasLATC) {
524 hasLATC = ctxInfo.hasExtension("GL_AMD_compressed_3DC_texture");
525 if (hasLATC) {
526 alias = k3DC_LATCAlias;
527 }
528 }
529
530 fConfigTextureSupport[kLATC_GrPixelConfig] = hasLATC;
531 fLATCAlias = alias;
493 } 532 }
494 533
495 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, 534 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
496 GrGLenum format, 535 GrGLenum format,
497 GrGLenum type) const { 536 GrGLenum type) const {
498 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { 537 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) {
499 // ES 2 guarantees this format is supported 538 // ES 2 guarantees this format is supported
500 return true; 539 return true;
501 } 540 }
502 541
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); 760 r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]);
722 r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType ]); 761 r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType ]);
723 r.appendf("Map Buffer Type: %s\n", kMapBufferTypeStr[fMapBufferType]); 762 r.appendf("Map Buffer Type: %s\n", kMapBufferTypeStr[fMapBufferType]);
724 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); 763 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
725 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); 764 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits);
726 if (!fIsCoreProfile) { 765 if (!fIsCoreProfile) {
727 r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTe xtureCoords); 766 r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTe xtureCoords);
728 } 767 }
729 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); 768 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes);
730 r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO")); 769 r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO"));
731 r.appendf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO"));
732 r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES" : "NO")); 770 r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES" : "NO"));
733 r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO")); 771 r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO"));
734 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES ": "NO")); 772 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES ": "NO"));
735 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO") ); 773 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO") );
736 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": " NO")); 774 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": " NO"));
737 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); 775 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO"));
738 776
739 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" )); 777 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" ));
740 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" )); 778 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" ));
741 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); 779 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
742 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); 780 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
743 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 781 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
744 r.appendf("Fragment coord conventions support: %s\n", 782 r.appendf("Fragment coord conventions support: %s\n",
745 (fFragCoordsConventionSupport ? "YES": "NO")); 783 (fFragCoordsConventionSupport ? "YES": "NO"));
746 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 784 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
747 r.appendf("Use non-VBO for dynamic data: %s\n", 785 r.appendf("Use non-VBO for dynamic data: %s\n",
748 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 786 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
749 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 787 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO "));
750 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); 788 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
751 return r; 789 return r;
752 } 790 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLDefines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698