Add config options to run different GPU APIs to dm and nanobench
Add extended config specification form that can be used to run different
gpu backend with different APIs.
The configs can be specified with the form:
gpu(api=string,dit=bool,nvpr=bool,samples=int)
This replaces and removes the --gpuAPI flag.
All existing configs should still work.
Adds following documentation:
out/Debug/dm --help config
Flags:
--config: type: string default: 565 8888 gpu nonrendering
Options: 565 8888 debug gpu gpudebug gpudft gpunull msaa16 msaa4
nonrendering null nullgpu nvprmsaa16 nvprmsaa4 pdf pdf_poppler skp svg
xps or use extended form 'backend(option=value,...)'.
Extended form: 'backend(option=value,...)'
Possible backends and options:
gpu(api=string,dit=bool,nvpr=bool,samples=int) GPU backend
api type: string default: native.
Select graphics API to use with gpu backend.
Options:
native Use platform default OpenGL or OpenGL ES backend.
gl Use OpenGL.
gles Use OpenGL ES.
debug Use debug OpenGL.
null Use null OpenGL.
dit type: bool default: false.
Use device independent text.
nvpr type: bool default: false.
Use NV_path_rendering OpenGL and OpenGL ES extension.
samples type: int default: 0.
Use multisampling with N samples.
Predefined configs:
gpu = gpu()
msaa4 = gpu(samples=4)
msaa16 = gpu(samples=16)
nvprmsaa4 = gpu(nvpr=true,samples=4)
nvprmsaa16 = gpu(nvpr=true,samples=16)
gpudft = gpu(dit=true)
gpudebug = gpu(api=debug)
gpunull = gpu(api=null)
debug = gpu(api=debug)
nullgpu = gpu(api=null)
BUG=skia:2992
Committed: https://skia.googlesource.com/skia/+/e13ca329fca4c28cf4e078561f591ab27b743d23
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1490113005
Committed: https://skia.googlesource.com/skia/+/c8b4336444e7b90382e04e33665fb3b8490b825b
Review URL: https://codereview.chromium.org/1490113005
diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp
index 15af816..4814e78 100755
--- a/src/gpu/GrContextFactory.cpp
+++ b/src/gpu/GrContextFactory.cpp
@@ -24,13 +24,10 @@
#include "GrCaps.h"
GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType type,
- GrGLStandard forcedGpuAPI,
GLContextOptions options) {
for (int i = 0; i < fContexts.count(); ++i) {
if (fContexts[i]->fType == type &&
- fContexts[i]->fOptions == options &&
- (forcedGpuAPI == kNone_GrGLStandard ||
- forcedGpuAPI == fContexts[i]->fGLContext->gl()->fStandard)) {
+ fContexts[i]->fOptions == options) {
fContexts[i]->fGLContext->makeCurrent();
return fContexts[i];
}
@@ -39,31 +36,39 @@
SkAutoTUnref<GrContext> grCtx;
switch (type) {
case kNative_GLContextType:
- glCtx.reset(SkCreatePlatformGLContext(forcedGpuAPI));
+ glCtx.reset(SkCreatePlatformGLContext(kNone_GrGLStandard));
break;
-#ifdef SK_ANGLE
+ case kGL_GLContextType:
+ glCtx.reset(SkCreatePlatformGLContext(kGL_GrGLStandard));
+ break;
+ case kGLES_GLContextType:
+ glCtx.reset(SkCreatePlatformGLContext(kGLES_GrGLStandard));
+ break;
+#if SK_ANGLE
+#ifdef SK_BUILD_FOR_WIN
case kANGLE_GLContextType:
- glCtx.reset(SkANGLEGLContext::Create(forcedGpuAPI, false));
+ glCtx.reset(SkANGLEGLContext::CreateDirectX());
break;
+#endif
case kANGLE_GL_GLContextType:
- glCtx.reset(SkANGLEGLContext::Create(forcedGpuAPI, true));
+ glCtx.reset(SkANGLEGLContext::CreateOpenGL());
break;
#endif
-#ifdef SK_COMMAND_BUFFER
+#if SK_COMMAND_BUFFER
case kCommandBuffer_GLContextType:
- glCtx.reset(SkCommandBufferGLContext::Create(forcedGpuAPI));
+ glCtx.reset(SkCommandBufferGLContext::Create());
break;
#endif
-#ifdef SK_MESA
+#if SK_MESA
case kMESA_GLContextType:
- glCtx.reset(SkMesaGLContext::Create(forcedGpuAPI));
+ glCtx.reset(SkMesaGLContext::Create());
break;
#endif
case kNull_GLContextType:
- glCtx.reset(SkNullGLContext::Create(forcedGpuAPI));
+ glCtx.reset(SkNullGLContext::Create());
break;
case kDebug_GLContextType:
- glCtx.reset(SkDebugGLContext::Create(forcedGpuAPI));
+ glCtx.reset(SkDebugGLContext::Create());
break;
}
if (nullptr == glCtx.get()) {