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
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index 5b5f314..2407da9 100644
--- a/tools/gpu/GrContextFactory.cpp
+++ b/tools/gpu/GrContextFactory.cpp
@@ -31,6 +31,8 @@
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 @@
}
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 @@
}
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 @@
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();