aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu/GrContextFactory.cpp
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-07-29 08:14:20 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-29 08:14:20 -0700
commite0d362929d6569e8737d80dead791c640390e819 (patch)
tree3943140ef518a4fc3962672a74039cb776f1ef48 /tools/gpu/GrContextFactory.cpp
parent0d9990f052670a8af29e1e775c414810f8fc6e86 (diff)
Add test configs for instanced rendering
Adds the following configs and enables them on select bots: glinst, glinst4, glinstdit4, glinst16, glinstdit16, esinst, esinst4, esinstdit4 Makes general changes to GrContextOptions, GrCaps, etc. to facilitate this. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2182783004 Review-Url: https://codereview.chromium.org/2182783004
Diffstat (limited to 'tools/gpu/GrContextFactory.cpp')
-rw-r--r--tools/gpu/GrContextFactory.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index 5b5f31415d..2407da930a 100644
--- a/tools/gpu/GrContextFactory.cpp
+++ b/tools/gpu/GrContextFactory.cpp
@@ -31,6 +31,8 @@ GrContextFactory::GrContextFactory() { }
GrContextFactory::GrContextFactory(const GrContextOptions& opts)
: fGlobalOptions(opts) {
+ // In this factory, instanced rendering is specified with kUseInstanced_ContextOptions.
+ SkASSERT(!fGlobalOptions.fEnableInstancedRendering);
}
GrContextFactory::~GrContextFactory() {
@@ -150,8 +152,9 @@ ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op
}
testCtx.reset(glCtx);
glInterface.reset(SkRef(glCtx->gl()));
- // Block NVPR from non-NVPR types.
- if (!(kEnableNVPR_ContextOptions & options)) {
+ // Block NVPR from non-NVPR types. We don't block NVPR from contexts that will use
+ // instanced rendering because that would prevent us from testing mixed samples.
+ if (!((kEnableNVPR_ContextOptions | kUseInstanced_ContextOptions) & options)) {
glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface.get()));
if (!glInterface) {
return ContextInfo();
@@ -188,7 +191,11 @@ ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op
}
testCtx->makeCurrent();
SkASSERT(testCtx && testCtx->backend() == backend);
- grCtx.reset(GrContext::Create(backend, backendContext, fGlobalOptions));
+ GrContextOptions grOptions = fGlobalOptions;
+ if (kUseInstanced_ContextOptions & options) {
+ grOptions.fEnableInstancedRendering = true;
+ }
+ grCtx.reset(GrContext::Create(backend, backendContext, grOptions));
if (!grCtx.get()) {
return ContextInfo();
}
@@ -197,6 +204,11 @@ ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op
return ContextInfo();
}
}
+ if (kUseInstanced_ContextOptions & options) {
+ if (GrCaps::InstancedSupport::kNone == grCtx->caps()->instancedSupport()) {
+ return ContextInfo();
+ }
+ }
if (kRequireSRGBSupport_ContextOptions & options) {
if (!grCtx->caps()->srgbSupport()) {
return ContextInfo();