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

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

Issue 218763006: Use glInvalidateFramebuffer() when it is supported. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGpuGL.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 #include "GrGLContext.h" 10 #include "GrGLContext.h"
11 #include "SkTSearch.h" 11 #include "SkTSearch.h"
12 #include "SkTSort.h" 12 #include "SkTSort.h"
13 13
14 GrGLCaps::GrGLCaps() { 14 GrGLCaps::GrGLCaps() {
15 this->reset(); 15 this->reset();
16 } 16 }
17 17
18 void GrGLCaps::reset() { 18 void GrGLCaps::reset() {
19 INHERITED::reset(); 19 INHERITED::reset();
20 20
21 fVerifiedColorConfigs.reset(); 21 fVerifiedColorConfigs.reset();
22 fStencilFormats.reset(); 22 fStencilFormats.reset();
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 fMaxFragmentUniformVectors = 0; 27 fMaxFragmentUniformVectors = 0;
27 fMaxVertexAttributes = 0; 28 fMaxVertexAttributes = 0;
28 fMaxFragmentTextureUnits = 0; 29 fMaxFragmentTextureUnits = 0;
29 fMaxFixedFunctionTextureCoords = 0; 30 fMaxFixedFunctionTextureCoords = 0;
30 fRGBA8RenderbufferSupport = false; 31 fRGBA8RenderbufferSupport = false;
31 fBGRAFormatSupport = false; 32 fBGRAFormatSupport = false;
32 fBGRAIsInternalFormat = false; 33 fBGRAIsInternalFormat = false;
33 fTextureSwizzleSupport = false; 34 fTextureSwizzleSupport = false;
34 fUnpackRowLengthSupport = false; 35 fUnpackRowLengthSupport = false;
35 fUnpackFlipYSupport = false; 36 fUnpackFlipYSupport = false;
(...skipping 21 matching lines...) Expand all
57 INHERITED::operator=(caps); 58 INHERITED::operator=(caps);
58 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; 59 fVerifiedColorConfigs = caps.fVerifiedColorConfigs;
59 fStencilFormats = caps.fStencilFormats; 60 fStencilFormats = caps.fStencilFormats;
60 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; 61 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs;
61 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; 62 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors;
62 fMaxVertexAttributes = caps.fMaxVertexAttributes; 63 fMaxVertexAttributes = caps.fMaxVertexAttributes;
63 fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits; 64 fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits;
64 fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords; 65 fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords;
65 fMSFBOType = caps.fMSFBOType; 66 fMSFBOType = caps.fMSFBOType;
66 fFBFetchType = caps.fFBFetchType; 67 fFBFetchType = caps.fFBFetchType;
68 fInvalidateFBType = caps.fInvalidateFBType;
67 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; 69 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport;
68 fBGRAFormatSupport = caps.fBGRAFormatSupport; 70 fBGRAFormatSupport = caps.fBGRAFormatSupport;
69 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; 71 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat;
70 fTextureSwizzleSupport = caps.fTextureSwizzleSupport; 72 fTextureSwizzleSupport = caps.fTextureSwizzleSupport;
71 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; 73 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport;
72 fUnpackFlipYSupport = caps.fUnpackFlipYSupport; 74 fUnpackFlipYSupport = caps.fUnpackFlipYSupport;
73 fPackRowLengthSupport = caps.fPackRowLengthSupport; 75 fPackRowLengthSupport = caps.fPackRowLengthSupport;
74 fPackFlipYSupport = caps.fPackFlipYSupport; 76 fPackFlipYSupport = caps.fPackFlipYSupport;
75 fTextureUsageSupport = caps.fTextureUsageSupport; 77 fTextureUsageSupport = caps.fTextureUsageSupport;
76 fTexStorageSupport = caps.fTexStorageSupport; 78 fTexStorageSupport = caps.fTexStorageSupport;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 217
216 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha ve trouble with 218 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha ve trouble with
217 // frequently changing VBOs. We've measured a performance increase using non -VBO vertex 219 // frequently changing VBOs. We've measured a performance increase using non -VBO vertex
218 // data for dynamic content on these GPUs. Perhaps we should read the render er string and 220 // data for dynamic content on these GPUs. Perhaps we should read the render er string and
219 // limit this decision to specific GPU families rather than basing it on the vendor alone. 221 // limit this decision to specific GPU families rather than basing it on the vendor alone.
220 if (!GR_GL_MUST_USE_VBO && 222 if (!GR_GL_MUST_USE_VBO &&
221 (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxIn fo.vendor())) { 223 (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxIn fo.vendor())) {
222 fUseNonVBOVertexAndIndexDynamicData = true; 224 fUseNonVBOVertexAndIndexDynamicData = true;
223 } 225 }
224 226
225 fDiscardRenderTargetSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuff er"); 227 if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(4,3)) ||
228 (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) ||
229 ctxInfo.hasExtension("GL_ARB_invalidate_subdata")) {
230 fDiscardRenderTargetSupport = true;
231 fInvalidateFBType = kInvalidate_InvalidateFBType;
232 } else if (ctxInfo.hasExtension("GL_EXT_discard_framebuffer")) {
233 fDiscardRenderTargetSupport = true;
234 fInvalidateFBType = kDiscard_InvalidateFBType;
235 }
226 236
227 if (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInf o.vendor()) { 237 if (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInf o.vendor()) {
228 fFullClearIsFree = true; 238 fFullClearIsFree = true;
229 } 239 }
230 240
231 if (kGL_GrGLStandard == standard) { 241 if (kGL_GrGLStandard == standard) {
232 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || 242 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
233 ctxInfo.hasExtension("GL_ARB_vertex_array_ob ject"); 243 ctxInfo.hasExtension("GL_ARB_vertex_array_ob ject");
234 } else { 244 } else {
235 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || 245 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 static const char* kFBFetchTypeStr[] = { 635 static const char* kFBFetchTypeStr[] = {
626 "None", 636 "None",
627 "EXT", 637 "EXT",
628 "NV", 638 "NV",
629 }; 639 };
630 GR_STATIC_ASSERT(0 == kNone_FBFetchType); 640 GR_STATIC_ASSERT(0 == kNone_FBFetchType);
631 GR_STATIC_ASSERT(1 == kEXT_FBFetchType); 641 GR_STATIC_ASSERT(1 == kEXT_FBFetchType);
632 GR_STATIC_ASSERT(2 == kNV_FBFetchType); 642 GR_STATIC_ASSERT(2 == kNV_FBFetchType);
633 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1); 643 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1);
634 644
645 static const char* kInvalidateFBTypeStr[] = {
646 "None",
647 "Discard",
648 "Invalidate",
649 };
650 GR_STATIC_ASSERT(0 == kNone_InvalidateFBType);
651 GR_STATIC_ASSERT(1 == kDiscard_InvalidateFBType);
652 GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType);
653 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kInvalidateFBTypeStr) == kLast_InvalidateFBT ype + 1);
635 654
636 r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); 655 r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
637 r.appendf("Fixed Function Support: %s\n", (fFixedFunctionSupport ? "YES" : " NO")); 656 r.appendf("Fixed Function Support: %s\n", (fFixedFunctionSupport ? "YES" : " NO"));
638 r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); 657 r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]);
639 r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); 658 r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]);
659 r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType ]);
640 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); 660 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
641 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); 661 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits);
642 if (fFixedFunctionSupport) { 662 if (fFixedFunctionSupport) {
643 r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTe xtureCoords); 663 r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTe xtureCoords);
644 } 664 }
645 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); 665 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes);
646 r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO")); 666 r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO"));
647 r.appendf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); 667 r.appendf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO"));
648 r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES" : "NO")); 668 r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES" : "NO"));
649 r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO")); 669 r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO"));
650 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES ": "NO")); 670 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES ": "NO"));
651 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO") ); 671 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO") );
652 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": " NO")); 672 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": " NO"));
653 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); 673 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO"));
654 674
655 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" )); 675 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" ));
656 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" )); 676 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" ));
657 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); 677 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
658 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); 678 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
659 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 679 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
660 r.appendf("Fragment coord conventions support: %s\n", 680 r.appendf("Fragment coord conventions support: %s\n",
661 (fFragCoordsConventionSupport ? "YES": "NO")); 681 (fFragCoordsConventionSupport ? "YES": "NO"));
662 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 682 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
663 r.appendf("Use non-VBO for dynamic data: %s\n", 683 r.appendf("Use non-VBO for dynamic data: %s\n",
664 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 684 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
665 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 685 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO "));
666 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); 686 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
667 return r; 687 return r;
668 } 688 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698