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

Unified Diff: tools/VisualBench/VisualBench.cpp

Issue 1473253002: Add offscreen mode to visualbench (Closed) Base URL: https://skia.googlesource.com/skia.git@visualbench_blit2
Patch Set: Created 5 years, 1 month 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
Index: tools/VisualBench/VisualBench.cpp
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp
index 5ff556d5bbf30399cde9685c8d3efe3ef4f93784..421d69c5feab96b58bdb336e46e8017f8c31d64d 100644
--- a/tools/VisualBench/VisualBench.cpp
+++ b/tools/VisualBench/VisualBench.cpp
@@ -22,6 +22,8 @@
#include "VisualInteractiveModule.h"
#include "gl/GrGLInterface.h"
+#include <stdlib.h>
+
DEFINE_bool2(fullscreen, f, true, "Run fullscreen.");
DEFINE_bool2(interactive, n, false, "Run in interactive mode.");
DEFINE_bool2(dif, d, false, "Use device-independent fonts.");
@@ -35,6 +37,11 @@ VisualBench::VisualBench(void* hwnd, int argc, char** argv)
SkDebugf("%s\n", argv[i]);
}
+ if (FLAGS_nvpr && !FLAGS_msaa) {
+ SkDebugf("Got nvpr without msaa. Exiting.\n");
+ exit(-1);
+ }
+
// these have to happen after commandline parsing
if (FLAGS_dif) {
const SkSurfaceProps& props(INHERITED::getSurfaceProps());
@@ -90,7 +97,8 @@ void VisualBench::resetContext() {
}
void VisualBench::setupContext() {
- if (!this->attach(kNativeGL_BackEndType, FLAGS_msaa, &fAttachmentInfo)) {
+ int screenSamples = FLAGS_offscreen ? 0 : FLAGS_msaa;
+ if (!this->attach(kNativeGL_BackEndType, screenSamples, &fAttachmentInfo)) {
SkDebugf("Not possible to create backend.\n");
INHERITED::detach();
SkFAIL("Could not create backend\n");
@@ -103,7 +111,7 @@ void VisualBench::setupContext() {
fInterface.reset(GrGLCreateNativeInterface());
// TODO use the GLContext creation factories and also set this all up in configs
- if (0 == FLAGS_nvpr) {
+ if (!FLAGS_nvpr) {
fInterface.reset(GrGLInterfaceRemoveNVPR(fInterface));
}
SkASSERT(fInterface);
« no previous file with comments | « no previous file | tools/VisualBench/VisualBenchmarkStream.cpp » ('j') | tools/VisualBench/VisualLightweightBenchModule.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698