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

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

Issue 2182783004: Add test configs for instanced rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add test configs for instanced rendering Created 4 years, 4 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 "GrContextOptions.h" 11 #include "GrContextOptions.h"
12 #include "GrGLContext.h" 12 #include "GrGLContext.h"
13 #include "GrGLRenderTarget.h" 13 #include "GrGLRenderTarget.h"
14 #include "glsl/GrGLSLCaps.h" 14 #include "glsl/GrGLSLCaps.h"
15 #include "instanced/GLInstancedRendering.h"
15 #include "SkTSearch.h" 16 #include "SkTSearch.h"
16 #include "SkTSort.h" 17 #include "SkTSort.h"
17 18
18 GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, 19 GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
19 const GrGLContextInfo& ctxInfo, 20 const GrGLContextInfo& ctxInfo,
20 const GrGLInterface* glInterface) : INHERITED(contextOptions) { 21 const GrGLInterface* glInterface) : INHERITED(contextOptions) {
21 fStandard = ctxInfo.standard(); 22 fStandard = ctxInfo.standard();
22 23
23 fStencilFormats.reset(); 24 fStencilFormats.reset();
24 fMSFBOType = kNone_MSFBOType; 25 fMSFBOType = kNone_MSFBOType;
25 fInvalidateFBType = kNone_InvalidateFBType; 26 fInvalidateFBType = kNone_InvalidateFBType;
26 fMapBufferType = kNone_MapBufferType; 27 fMapBufferType = kNone_MapBufferType;
27 fTransferBufferType = kNone_TransferBufferType; 28 fTransferBufferType = kNone_TransferBufferType;
28 fMaxFragmentUniformVectors = 0; 29 fMaxFragmentUniformVectors = 0;
29 fUnpackRowLengthSupport = false; 30 fUnpackRowLengthSupport = false;
30 fUnpackFlipYSupport = false; 31 fUnpackFlipYSupport = false;
31 fPackRowLengthSupport = false; 32 fPackRowLengthSupport = false;
32 fPackFlipYSupport = false; 33 fPackFlipYSupport = false;
33 fTextureUsageSupport = false; 34 fTextureUsageSupport = false;
34 fTextureRedSupport = false; 35 fTextureRedSupport = false;
35 fImagingSupport = false; 36 fImagingSupport = false;
36 fVertexArrayObjectSupport = false; 37 fVertexArrayObjectSupport = false;
37 fDirectStateAccessSupport = false; 38 fDirectStateAccessSupport = false;
38 fDebugSupport = false; 39 fDebugSupport = false;
39 fES2CompatibilitySupport = false; 40 fES2CompatibilitySupport = false;
40 fDrawIndirectSupport = false; 41 fDrawIndirectSupport = false;
41 fMultiDrawIndirectSupport = false; 42 fMultiDrawIndirectSupport = false;
42 fBaseInstanceSupport = false; 43 fBaseInstanceSupport = false;
43 fCanDrawIndirectToFloat = false;
44 fIsCoreProfile = false; 44 fIsCoreProfile = false;
45 fBindFragDataLocationSupport = false; 45 fBindFragDataLocationSupport = false;
46 fRectangleTextureSupport = false; 46 fRectangleTextureSupport = false;
47 fTextureSwizzleSupport = false; 47 fTextureSwizzleSupport = false;
48 fRGBA8888PixelsOpsAreSlow = false; 48 fRGBA8888PixelsOpsAreSlow = false;
49 fPartialFBOReadIsSlow = false; 49 fPartialFBOReadIsSlow = false;
50 fMipMapLevelAndLodControlSupport = false; 50 fMipMapLevelAndLodControlSupport = false;
51 fRGBAToBGRAReadbackConversionsAreSlow = false; 51 fRGBAToBGRAReadbackConversionsAreSlow = false;
52 fDoManualMipmapping = false; 52 fDoManualMipmapping = false;
53 53
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 fBaseInstanceSupport = version >= GR_GL_VER(4,2); 519 fBaseInstanceSupport = version >= GR_GL_VER(4,2);
520 fMultiDrawIndirectSupport = version >= GR_GL_VER(4,3) || 520 fMultiDrawIndirectSupport = version >= GR_GL_VER(4,3) ||
521 (!fBaseInstanceSupport && // The ARB extensi on has no base inst. 521 (!fBaseInstanceSupport && // The ARB extensi on has no base inst.
522 ctxInfo.hasExtension("GL_ARB_multi_draw_ind irect")); 522 ctxInfo.hasExtension("GL_ARB_multi_draw_ind irect"));
523 } else { 523 } else {
524 fDrawIndirectSupport = version >= GR_GL_VER(3,1); 524 fDrawIndirectSupport = version >= GR_GL_VER(3,1);
525 fMultiDrawIndirectSupport = ctxInfo.hasExtension("GL_EXT_multi_draw_indi rect"); 525 fMultiDrawIndirectSupport = ctxInfo.hasExtension("GL_EXT_multi_draw_indi rect");
526 fBaseInstanceSupport = ctxInfo.hasExtension("GL_EXT_base_instance"); 526 fBaseInstanceSupport = ctxInfo.hasExtension("GL_EXT_base_instance");
527 } 527 }
528 528
529 // OS X doesn't seem to write correctly to floating point textures when usin g glDraw*Indirect,
530 // regardless of the underlying GPU.
531 #ifndef SK_BUILD_FOR_MAC
532 if (fDrawIndirectSupport) {
533 fCanDrawIndirectToFloat = true;
534 }
535 #endif
536
537 this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); 529 this->initShaderPrecisionTable(ctxInfo, gli, glslCaps);
538 530
539 if (contextOptions.fUseShaderSwizzling) { 531 if (contextOptions.fUseShaderSwizzling) {
540 fTextureSwizzleSupport = false; 532 fTextureSwizzleSupport = false;
541 } 533 }
542 534
543 if (kGL_GrGLStandard == standard) { 535 if (kGL_GrGLStandard == standard) {
544 if ((version >= GR_GL_VER(4, 0) || ctxInfo.hasExtension("GL_ARB_sample_s hading")) && 536 if ((version >= GR_GL_VER(4, 0) || ctxInfo.hasExtension("GL_ARB_sample_s hading")) &&
545 ctxInfo.vendor() != kIntel_GrGLVendor) { 537 ctxInfo.vendor() != kIntel_GrGLVendor) {
546 fSampleShadingSupport = true; 538 fSampleShadingSupport = true;
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 1101
1110 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" )); 1102 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" ));
1111 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); 1103 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
1112 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); 1104 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
1113 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 1105 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
1114 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO")); 1106 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO"));
1115 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); 1107 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO"));
1116 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO ")); 1108 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO "));
1117 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ? "YES" : "NO")); 1109 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ? "YES" : "NO"));
1118 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO ")); 1110 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO "));
1119 r.appendf("Can draw indirect to float: %s\n", (fCanDrawIndirectToFloat ? "YE S" : "NO"));
1120 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO")); 1111 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO"));
1121 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" : "NO")); 1112 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" : "NO"));
1122 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor t ? "YES" : "NO")); 1113 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor t ? "YES" : "NO"));
1123 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES " : "NO")); 1114 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES " : "NO"));
1124 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" : "NO")); 1115 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" : "NO"));
1125 r.appendf("BGRA to RGBA readback conversions are slow: %s\n", 1116 r.appendf("BGRA to RGBA readback conversions are slow: %s\n",
1126 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO")); 1117 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO"));
1127 1118
1128 r.append("Configs\n-------\n"); 1119 r.append("Configs\n-------\n");
1129 for (int i = 0; i < kGrPixelConfigCnt; ++i) { 1120 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 fConfigTable[i].fFormats.fSizedInternalFormat); 1919 fConfigTable[i].fFormats.fSizedInternalFormat);
1929 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { 1920 for (int j = 0; j < kExternalFormatUsageCnt; ++j) {
1930 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != 1921 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] !=
1931 fConfigTable[i].fFormats.fExternalFormat[j]); 1922 fConfigTable[i].fFormats.fExternalFormat[j]);
1932 } 1923 }
1933 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); 1924 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType);
1934 } 1925 }
1935 #endif 1926 #endif
1936 } 1927 }
1937 1928
1938 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} 1929 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {
1930 if (options.fEnableInstancedRendering) {
1931 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th is);
1932 #ifndef SK_BUILD_FOR_MAC
1933 // OS X doesn't seem to write correctly to floating point textures when using
1934 // glDraw*Indirect, regardless of the underlying GPU.
1935 fAvoidInstancedDrawsToFPTargets = true;
1936 #endif
1937 }
1938 }
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