aboutsummaryrefslogtreecommitdiffhomepage
path: root/fuzz/FuzzCanvas.cpp
diff options
context:
space:
mode:
authorGravatar Kevin Lubick <kjlubick@google.com>2018-06-07 10:33:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-07 14:53:58 +0000
commitfaef51451a81dccffcba50b58d9a323bdd9f150c (patch)
treec1120ca9d527c70aa2a942ef0b3066f87f81b734 /fuzz/FuzzCanvas.cpp
parent0d225395faf27690c724619af35243985bf6e2df (diff)
More libfuzzer cleanups from GPU switchover
This was breaking the oss-fuzz build as is. Bug: oss-fuzz:8701 Change-Id: I23ad21816a293356c91cd3bbc6276b2ed3ceafe6 Reviewed-on: https://skia-review.googlesource.com/132822 Commit-Queue: Kevin Lubick <kjlubick@google.com> Auto-Submit: Kevin Lubick <kjlubick@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'fuzz/FuzzCanvas.cpp')
-rw-r--r--fuzz/FuzzCanvas.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index b66e5187dd..7ca14d2223 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -61,16 +61,23 @@
#include "SkXfermodeImageFilter.h"
// SRC
+#include "SkCommandLineFlags.h"
#include "SkUtils.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
+#include "GrContextPriv.h"
+#include "gl/GrGLFunctions.h"
+#include "gl/GrGLGpu.h"
+#include "gl/GrGLUtil.h"
#endif
// MISC
#include <iostream>
+DEFINE_bool2(gpuInfo, g, false, "Display GPU information on relevant targets.");
+
// TODO:
// SkTextBlob with Unicode
// SkImage: more types
@@ -1801,6 +1808,21 @@ DEF_FUZZ(SerializedImageFilter, fuzz) {
}
#if SK_SUPPORT_GPU
+
+static void dump_GPU_info(GrContext* context) {
+ const GrGLInterface* gl = static_cast<GrGLGpu*>(context->contextPriv().getGpu())
+ ->glInterface();
+ const GrGLubyte* output;
+ GR_GL_CALL_RET(gl, output, GetString(GR_GL_RENDERER));
+ SkDebugf("GL_RENDERER %s\n", (const char*) output);
+
+ GR_GL_CALL_RET(gl, output, GetString(GR_GL_VENDOR));
+ SkDebugf("GL_VENDOR %s\n", (const char*) output);
+
+ GR_GL_CALL_RET(gl, output, GetString(GR_GL_VERSION));
+ SkDebugf("GL_VERSION %s\n", (const char*) output);
+}
+
static void fuzz_ganesh(Fuzz* fuzz, GrContext* context) {
SkASSERT(context);
auto surface = SkSurface::MakeRenderTarget(
@@ -1811,8 +1833,6 @@ static void fuzz_ganesh(Fuzz* fuzz, GrContext* context) {
fuzz_canvas(fuzz, surface->getCanvas());
}
-extern bool FLAGS_gpuInfo;
-
DEF_FUZZ(NativeGLCanvas, fuzz) {
sk_gpu_test::GrContextFactory f;
GrContext* context = f.get(sk_gpu_test::GrContextFactory::kGL_ContextType);
@@ -1820,7 +1840,7 @@ DEF_FUZZ(NativeGLCanvas, fuzz) {
context = f.get(sk_gpu_test::GrContextFactory::kGLES_ContextType);
}
if (FLAGS_gpuInfo) {
- dumpGPUInfo(context);
+ dump_GPU_info(context);
}
fuzz_ganesh(fuzz, context);
}