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

Unified Diff: tools/gpu/GrContextFactory.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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gpu/GrContextFactory.h ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gpu/GrContextFactory.cpp
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index 5b5f31415d2096007d58c1cfc655c4c03f8e8b26..2407da930aba3bb3f1fb93e9c53d9a33f8fe5bee 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();
« no previous file with comments | « tools/gpu/GrContextFactory.h ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698