diff options
author | joshualitt <joshualitt@chromium.org> | 2015-06-26 12:46:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-26 12:46:36 -0700 |
commit | 58001553ec6298cbea3b2e915ed7a1ac0e763e8f (patch) | |
tree | cb0f31a636e73fec7630b714c2e36cef35e8f023 | |
parent | d24955ad3511a024206dd2ac893b52aa85d6cd30 (diff) |
add drawArraysInstanced to caps
BUG=skia:
Review URL: https://codereview.chromium.org/1202383006
-rw-r--r-- | include/gpu/GrCaps.h | 5 | ||||
-rw-r--r-- | src/gpu/GrCaps.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 14 |
3 files changed, 21 insertions, 0 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 3ae75db72f..6b24ecd6bf 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -214,6 +214,10 @@ public: return fGeometryBufferMapThreshold; } + bool supportsInstancedDraws() const { + return fSupportsInstancedDraws; + } + protected: /** Subclasses must call this at the end of their constructors in order to apply caps overrides requested by the client. Note that overrides will only reduce the caps never @@ -233,6 +237,7 @@ protected: bool fCompressedTexSubImageSupport : 1; bool fOversizedStencilSupport : 1; bool fTextureBarrierSupport : 1; + bool fSupportsInstancedDraws : 1; // Driver workaround bool fUseDrawInsteadOfClear : 1; diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp index 900bd65cc2..d6a5470ad5 100644 --- a/src/gpu/GrCaps.cpp +++ b/src/gpu/GrCaps.cpp @@ -91,6 +91,7 @@ GrCaps::GrCaps(const GrContextOptions& options) { fCompressedTexSubImageSupport = false; fOversizedStencilSupport = false; fTextureBarrierSupport = false; + fSupportsInstancedDraws = false; fUseDrawInsteadOfClear = false; @@ -152,6 +153,7 @@ SkString GrCaps::dump() const { r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSubImageSupport]); r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencilSupport]); r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSupport]); + r.appendf("Supports instanced draws : %s\n", gNY[fSupportsInstancedDraws]); r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOfClear]); r.appendf("Draw Instead of TexSubImage [workaround] : %s\n", gNY[fUseDrawInsteadOfPartialRenderTargetWrite]); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 69580ec3d2..feb45eab88 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -455,6 +455,20 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, fOversizedStencilSupport = ctxInfo.version() >= GR_GL_VER(3, 0); } + if (kGL_GrGLStandard == standard) { + // 3.1 has draw_instanced but not instanced_arrays, for the time being we only care about + // instanced arrays, but we could make this more granular if we wanted + fSupportsInstancedDraws = + version >= GR_GL_VER(3, 2) || + (ctxInfo.hasExtension("GL_ARB_draw_instanced") && + ctxInfo.hasExtension("GL_ARB_instanced_arrays")); + } else { + fSupportsInstancedDraws = + version >= GR_GL_VER(3, 0) || + (ctxInfo.hasExtension("GL_EXT_draw_instanced") && + ctxInfo.hasExtension("GL_EXT_instanced_arrays")); + } + this->initConfigTexturableTable(ctxInfo, gli); this->initConfigRenderableTable(ctxInfo); this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); |