Add Dockerfile for building and running local Skia checkout with SwiftShader
This also adds a little helper to fuzz that allows us to see what
GPU is being targeted.
This is the first step in getting a SwiftShader fuzz target.
To prove that this works, simply download this patch and run:
./docker/skia-with-swift-shader-base/build-with-swift-shader-and-run "out/with-swift-shader/fuzz --gpuInfo -t api -n NativeGLCanvas -b out/with-swift-shader/fiddle"
Running supplied command ['out/with-swift-shader/fuzz', '--gpuInfo', '-t', 'api', '-n', 'NativeGLCanvas', '-b', 'out/with-swift-shader/fiddle']
Fuzzing NativeGLCanvas...
GL_RENDERER Google SwiftShader
GL_VENDOR Google Inc.
GL_VERSION OpenGL ES 3.0 SwiftShader 4.0.0.6
Bug: skia:
Change-Id: I3cc11a6bcd14f70f6025011722f9a73c94cb1f65
Reviewed-on: https://skia-review.googlesource.com/132269
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
diff --git a/fuzz/FuzzCommon.h b/fuzz/FuzzCommon.h
index 7615fe7..9435b43 100644
--- a/fuzz/FuzzCommon.h
+++ b/fuzz/FuzzCommon.h
@@ -12,6 +12,30 @@
#include "SkPath.h"
#include "SkRegion.h"
+
+#if SK_SUPPORT_GPU
+#include "GrContextFactory.h"
+#include "gl/GrGLFunctions.h"
+#include "gl/GrGLGpu.h"
+#include "gl/GrGLUtil.h"
+#include "GrContextPriv.h"
+
+inline void dumpGPUInfo(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);
+}
+
+#endif
+
// We don't always want to test NaNs and infinities.
static inline void fuzz_nice_float(Fuzz* fuzz, float* f) {
float v;
@@ -60,3 +84,4 @@
void BuildPath(Fuzz* fuzz, SkPath* path, int last_verb);
#endif
+