| 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();
|
|
|