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

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

Issue 1317443004: Calculate pixel config and stencil fmt pairs once per pixel config. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Unused variable Created 5 years, 3 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.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 10
11 #include "GrGLContext.h" 11 #include "GrGLContext.h"
12 #include "glsl/GrGLSLCaps.h" 12 #include "glsl/GrGLSLCaps.h"
13 #include "SkTSearch.h" 13 #include "SkTSearch.h"
14 #include "SkTSort.h" 14 #include "SkTSort.h"
15 15
16 GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, 16 GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
17 const GrGLContextInfo& ctxInfo, 17 const GrGLContextInfo& ctxInfo,
18 const GrGLInterface* glInterface) : INHERITED(contextOptions) { 18 const GrGLInterface* glInterface) : INHERITED(contextOptions) {
19 fVerifiedColorConfigs.reset(); 19 fVerifiedColorConfigs.reset();
20 fStencilFormats.reset(); 20 fStencilFormats.reset();
21 fStencilVerifiedColorConfigs.reset();
22 fMSFBOType = kNone_MSFBOType; 21 fMSFBOType = kNone_MSFBOType;
23 fInvalidateFBType = kNone_InvalidateFBType; 22 fInvalidateFBType = kNone_InvalidateFBType;
24 fLATCAlias = kLATC_LATCAlias; 23 fLATCAlias = kLATC_LATCAlias;
25 fMapBufferType = kNone_MapBufferType; 24 fMapBufferType = kNone_MapBufferType;
26 fMaxFragmentUniformVectors = 0; 25 fMaxFragmentUniformVectors = 0;
27 fMaxVertexAttributes = 0; 26 fMaxVertexAttributes = 0;
28 fMaxFragmentTextureUnits = 0; 27 fMaxFragmentTextureUnits = 0;
29 fRGBA8RenderbufferSupport = false; 28 fRGBA8RenderbufferSupport = false;
30 fBGRAIsInternalFormat = false; 29 fBGRAIsInternalFormat = false;
31 fTextureSwizzleSupport = false; 30 fTextureSwizzleSupport = false;
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 fStencilFormats.push_back() = gS8; 1011 fStencilFormats.push_back() = gS8;
1013 //fStencilFormats.push_back() = gS16; 1012 //fStencilFormats.push_back() = gS16;
1014 if (ctxInfo.version() >= GR_GL_VER(3,0) || 1013 if (ctxInfo.version() >= GR_GL_VER(3,0) ||
1015 ctxInfo.hasExtension("GL_OES_packed_depth_stencil")) { 1014 ctxInfo.hasExtension("GL_OES_packed_depth_stencil")) {
1016 fStencilFormats.push_back() = gD24S8; 1015 fStencilFormats.push_back() = gD24S8;
1017 } 1016 }
1018 if (ctxInfo.hasExtension("GL_OES_stencil4")) { 1017 if (ctxInfo.hasExtension("GL_OES_stencil4")) {
1019 fStencilFormats.push_back() = gS4; 1018 fStencilFormats.push_back() = gS4;
1020 } 1019 }
1021 } 1020 }
1022 SkASSERT(0 == fStencilVerifiedColorConfigs.count());
1023 fStencilVerifiedColorConfigs.push_back_n(fStencilFormats.count());
1024 }
1025
1026 void GrGLCaps::markColorConfigAndStencilFormatAsVerified(
1027 GrPixelConfig config,
1028 const GrGLStencilAttachment::Format& format) {
1029 #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
1030 return;
1031 #endif
1032 SkASSERT((unsigned)config < (unsigned)kGrPixelConfigCnt);
1033 SkASSERT(fStencilFormats.count() == fStencilVerifiedColorConfigs.count());
1034 int count = fStencilFormats.count();
1035 // we expect a really small number of possible formats so linear search
1036 // should be OK
1037 SkASSERT(count < 16);
1038 for (int i = 0; i < count; ++i) {
1039 if (format.fInternalFormat ==
1040 fStencilFormats[i].fInternalFormat) {
1041 fStencilVerifiedColorConfigs[i].markVerified(config);
1042 return;
1043 }
1044 }
1045 SkFAIL("Why are we seeing a stencil format that "
1046 "GrGLCaps doesn't know about.");
1047 }
1048
1049 bool GrGLCaps::isColorConfigAndStencilFormatVerified(
1050 GrPixelConfig config,
1051 const GrGLStencilAttachment::Format& format) con st {
1052 #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
1053 return false;
1054 #endif
1055 SkASSERT((unsigned)config < (unsigned)kGrPixelConfigCnt);
1056 int count = fStencilFormats.count();
1057 // we expect a really small number of possible formats so linear search
1058 // should be OK
1059 SkASSERT(count < 16);
1060 for (int i = 0; i < count; ++i) {
1061 if (format.fInternalFormat ==
1062 fStencilFormats[i].fInternalFormat) {
1063 return fStencilVerifiedColorConfigs[i].isVerified(config);
1064 }
1065 }
1066 SkFAIL("Why are we seeing a stencil format that "
1067 "GLCaps doesn't know about.");
1068 return false;
1069 } 1021 }
1070 1022
1071 SkString GrGLCaps::dump() const { 1023 SkString GrGLCaps::dump() const {
1072 1024
1073 SkString r = INHERITED::dump(); 1025 SkString r = INHERITED::dump();
1074 1026
1075 r.appendf("--- GL-Specific ---\n"); 1027 r.appendf("--- GL-Specific ---\n");
1076 for (int i = 0; i < fStencilFormats.count(); ++i) { 1028 for (int i = 0; i < fStencilFormats.count(); ++i) {
1077 r.appendf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n", 1029 r.appendf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n",
1078 i, 1030 i,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 for (int p = 0; p < kGrSLPrecisionCount; ++p) { 1189 for (int p = 0; p < kGrSLPrecisionCount; ++p) {
1238 glslCaps->fFloatPrecisions[kGeometry_GrShaderType][p] = 1190 glslCaps->fFloatPrecisions[kGeometry_GrShaderType][p] =
1239 glslCaps->fFloatPrecisions[kVerte x_GrShaderType][p]; 1191 glslCaps->fFloatPrecisions[kVerte x_GrShaderType][p];
1240 } 1192 }
1241 } 1193 }
1242 } 1194 }
1243 1195
1244 1196
1245 1197
1246 1198
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698