2015-03-25 14:11:02 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2013 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
#include "DMJsonWriter.h"
|
|
|
|
#include "DMSrcSink.h"
|
2015-02-23 20:18:05 +00:00
|
|
|
#include "DMSrcSinkAndroid.h"
|
2015-01-15 18:56:12 +00:00
|
|
|
#include "ProcStats.h"
|
2016-02-25 01:59:16 +00:00
|
|
|
#include "Resources.h"
|
2015-01-15 18:56:12 +00:00
|
|
|
#include "SkBBHFactory.h"
|
2015-01-27 22:46:26 +00:00
|
|
|
#include "SkChecksum.h"
|
2015-08-14 15:32:46 +00:00
|
|
|
#include "SkCodec.h"
|
2016-02-26 22:43:21 +00:00
|
|
|
#include "SkColorPriv.h"
|
2016-05-23 17:21:17 +00:00
|
|
|
#include "SkColorSpace.h"
|
2014-07-22 17:15:34 +00:00
|
|
|
#include "SkCommonFlags.h"
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
#include "SkCommonFlagsConfig.h"
|
2016-04-19 16:18:11 +00:00
|
|
|
#include "SkData.h"
|
2015-06-10 16:31:09 +00:00
|
|
|
#include "SkFontMgr.h"
|
2013-10-16 13:02:15 +00:00
|
|
|
#include "SkGraphics.h"
|
2016-02-26 22:43:21 +00:00
|
|
|
#include "SkHalf.h"
|
2016-06-08 00:21:10 +00:00
|
|
|
#include "SkLeanWindows.h"
|
2015-01-15 18:56:12 +00:00
|
|
|
#include "SkMD5.h"
|
2015-07-07 19:21:21 +00:00
|
|
|
#include "SkMutex.h"
|
Start to rework DM JSON handling.
DM's striking off into its own JSON world. This gets strawman implementations
in place for writing and reading a JSON file mapping test name to hashes.
For what it's worth, I basically want to change _all_ these pieces,
- MD5 is slow and we can replace it with something faster,
- JSON schema needs room to grow more data,
- it'd be nice to hash once instead of twice when reading and writing,
- this code wants lots of refactoring,
but this gives us a starting platform to work on these bits at our leisure.
E.x. file for now:
mtklein@mtklein ~/skia (dm)> cat good/dm.json
{
"3x3bitmaprect_565" : "fc70d985fbfbe70e3a3c9dc626d4f5bc",
"3x3bitmaprect_8888" : "df1591dde35907399734ea19feb76663",
"3x3bitmaprect_gpu" : "df1591dde35907399734ea19feb76663",
"aaclip_565" : "1862798689b838a7ab0dc0652b9ace3a",
"aaclip_8888" : "47bb314329f0ce243f1d83fd583decb7",
"aaclip_gpu" : "75f72412d0ef4815770202d297246e7d",
...
BUG=skia:
R=jcgregorio@google.com, stephana@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/546873002
2014-09-08 15:05:18 +00:00
|
|
|
#include "SkOSFile.h"
|
2016-02-26 22:43:21 +00:00
|
|
|
#include "SkPM4fPriv.h"
|
2016-02-23 18:39:36 +00:00
|
|
|
#include "SkSpinlock.h"
|
2015-02-20 20:30:19 +00:00
|
|
|
#include "SkTHash.h"
|
SkThreadPool ~~> SkTaskGroup
SkTaskGroup is like SkThreadPool except the threads stay in
one global pool. Each SkTaskGroup itself is tiny (4 bytes)
and its wait() method applies only to tasks add()ed to that
instance, not the whole thread pool.
This means we don't need to bring up new thread pools when
tests themselves want to use multithreading (e.g. pathops,
quilt). We just create a new SkTaskGroup and wait for that
to complete. This should be more efficient, and allow us
to expand where we use threads to really latency sensitive
places. E.g. we can probably now use these in nanobench
for CPU .skp rendering.
Now that all threads are sharing the same pool, I think we
can remove most of the custom mechanism pathops tests use
to control threading. They'll just ride on the global pool
with all other tests now.
This (temporarily?) removes the GPU multithreading feature
from DM, which we don't use.
On my desktop, DM runs a little faster (57s -> 55s) in
Debug, and a lot faster in Release (36s -> 24s). The bots
show speedups of similar proportions, cutting more than a
minute off the N4/Release and Win7/Debug runtimes.
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/9c7207b5dc71dc5a96a2eb107d401133333d5b6f
R=caryclark@google.com, bsalomon@google.com, bungeman@google.com, mtklein@google.com, reed@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/531653002
2014-09-03 22:34:37 +00:00
|
|
|
#include "SkTaskGroup.h"
|
2015-03-12 13:28:54 +00:00
|
|
|
#include "SkThreadUtils.h"
|
2014-02-26 16:31:22 +00:00
|
|
|
#include "Test.h"
|
2015-01-15 18:56:12 +00:00
|
|
|
#include "Timer.h"
|
2016-04-19 16:18:11 +00:00
|
|
|
#include "picture_utils.h"
|
2015-06-10 16:31:09 +00:00
|
|
|
#include "sk_tool_utils.h"
|
2014-06-03 20:57:14 +00:00
|
|
|
|
2015-10-01 14:28:13 +00:00
|
|
|
#ifdef SK_PDF_IMAGE_STATS
|
|
|
|
extern void SkPDFImageDumpStats();
|
|
|
|
#endif
|
|
|
|
|
2015-08-24 20:27:01 +00:00
|
|
|
#include "png.h"
|
|
|
|
|
2015-08-26 12:15:46 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2015-10-28 15:56:41 +00:00
|
|
|
#ifndef SK_BUILD_FOR_WIN32
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2015-04-03 14:24:48 +00:00
|
|
|
DEFINE_string(src, "tests gm skp image", "Source types to test.");
|
2015-01-15 18:56:12 +00:00
|
|
|
DEFINE_bool(nameByHash, false,
|
|
|
|
"If true, write to FLAGS_writePath[0]/<hash>.png instead of "
|
2015-04-03 14:24:48 +00:00
|
|
|
"to FLAGS_writePath[0]/<config>/<sourceType>/<sourceOptions>/<name>.png");
|
2015-01-15 18:56:12 +00:00
|
|
|
DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
|
2015-02-17 19:13:33 +00:00
|
|
|
DEFINE_string(matrix, "1 0 0 1",
|
|
|
|
"2x2 scale+skew matrix to apply or upright when using "
|
|
|
|
"'matrix' or 'upright' in config.");
|
2015-01-15 20:46:02 +00:00
|
|
|
DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2015-01-15 21:44:22 +00:00
|
|
|
DEFINE_string(blacklist, "",
|
2015-04-03 14:24:48 +00:00
|
|
|
"Space-separated config/src/srcOptions/name quadruples to blacklist. '_' matches anything. E.g. \n"
|
|
|
|
"'--blacklist gpu skp _ _' will blacklist all SKPs drawn into the gpu config.\n"
|
|
|
|
"'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aarects GM on 8888.");
|
2015-01-15 21:44:22 +00:00
|
|
|
|
2015-01-27 22:46:26 +00:00
|
|
|
DEFINE_string2(readPath, r, "", "If set check for equality with golden results in this directory.");
|
|
|
|
|
2015-04-03 21:15:33 +00:00
|
|
|
DEFINE_string(uninterestingHashesFile, "",
|
|
|
|
"File containing a list of uninteresting hashes. If a result hashes to something in "
|
|
|
|
"this list, no image is written for that result.");
|
|
|
|
|
2015-04-27 15:45:01 +00:00
|
|
|
DEFINE_int32(shards, 1, "We're splitting source data into this many shards.");
|
|
|
|
DEFINE_int32(shard, 0, "Which shard do I run?");
|
|
|
|
|
2016-06-02 19:41:14 +00:00
|
|
|
DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.");
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
using namespace DM;
|
2016-03-31 01:56:19 +00:00
|
|
|
using sk_gpu_test::GrContextFactory;
|
2016-03-31 17:59:06 +00:00
|
|
|
using sk_gpu_test::GLTestContext;
|
2016-04-05 19:59:06 +00:00
|
|
|
using sk_gpu_test::ContextInfo;
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
2014-06-30 13:36:31 +00:00
|
|
|
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
static const double kStartMs = SkTime::GetMSecs();
|
2016-03-08 17:01:39 +00:00
|
|
|
|
|
|
|
static FILE* gVLog;
|
|
|
|
|
|
|
|
template <typename... Args>
|
|
|
|
static void vlog(const char* fmt, Args&&... args) {
|
|
|
|
if (gVLog) {
|
|
|
|
fprintf(gVLog, "%s\t", HumanizeMs(SkTime::GetMSecs() - kStartMs).c_str());
|
|
|
|
fprintf(gVLog, fmt, args...);
|
|
|
|
fflush(gVLog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename... Args>
|
|
|
|
static void info(const char* fmt, Args&&... args) {
|
|
|
|
vlog(fmt, args...);
|
|
|
|
if (!FLAGS_quiet) {
|
|
|
|
printf(fmt, args...);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void info(const char* fmt) {
|
|
|
|
if (!FLAGS_quiet) {
|
|
|
|
printf("%s", fmt); // Clang warns printf(fmt) is insecure.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-05 00:12:46 +00:00
|
|
|
SK_DECLARE_STATIC_MUTEX(gFailuresMutex);
|
2015-01-15 18:56:12 +00:00
|
|
|
static SkTArray<SkString> gFailures;
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2016-02-25 03:07:07 +00:00
|
|
|
static void fail(const SkString& err) {
|
2015-01-15 18:56:12 +00:00
|
|
|
SkAutoMutexAcquire lock(gFailuresMutex);
|
|
|
|
SkDebugf("\n\nFAILURE: %s\n\n", err.c_str());
|
|
|
|
gFailures.push_back(err);
|
|
|
|
}
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2016-07-25 22:27:29 +00:00
|
|
|
struct Running {
|
|
|
|
SkString id;
|
|
|
|
SkThreadID thread;
|
|
|
|
|
|
|
|
void dump() const {
|
|
|
|
info("\t%s\n", id.c_str());
|
|
|
|
}
|
|
|
|
};
|
2015-03-18 12:27:14 +00:00
|
|
|
|
2016-02-23 18:39:36 +00:00
|
|
|
// We use a spinlock to make locking this in a signal handler _somewhat_ safe.
|
2016-02-29 18:14:38 +00:00
|
|
|
static SkSpinlock gMutex;
|
2016-07-25 22:27:29 +00:00
|
|
|
static int32_t gPending;
|
|
|
|
static SkTArray<Running> gRunning;
|
2016-02-25 03:07:07 +00:00
|
|
|
|
|
|
|
static void done(const char* config, const char* src, const char* srcOptions, const char* name) {
|
|
|
|
SkString id = SkStringPrintf("%s %s %s %s", config, src, srcOptions, name);
|
2016-03-08 17:01:39 +00:00
|
|
|
vlog("done %s\n", id.c_str());
|
2016-02-24 20:28:32 +00:00
|
|
|
int pending;
|
2015-03-18 12:27:14 +00:00
|
|
|
{
|
2016-06-10 20:56:35 +00:00
|
|
|
SkAutoMutexAcquire lock(gMutex);
|
2015-03-18 12:27:14 +00:00
|
|
|
for (int i = 0; i < gRunning.count(); i++) {
|
2016-07-25 22:27:29 +00:00
|
|
|
if (gRunning[i].id == id) {
|
2015-03-18 12:27:14 +00:00
|
|
|
gRunning.removeShuffle(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-02-24 20:28:32 +00:00
|
|
|
pending = --gPending;
|
2015-05-19 21:13:31 +00:00
|
|
|
}
|
2015-01-23 13:48:00 +00:00
|
|
|
// We write our dm.json file every once in a while in case we crash.
|
|
|
|
// Notice this also handles the final dm.json when pending == 0.
|
|
|
|
if (pending % 500 == 0) {
|
|
|
|
JsonWriter::DumpJson();
|
|
|
|
}
|
2015-01-10 19:18:04 +00:00
|
|
|
}
|
|
|
|
|
2016-02-25 03:07:07 +00:00
|
|
|
static void start(const char* config, const char* src, const char* srcOptions, const char* name) {
|
|
|
|
SkString id = SkStringPrintf("%s %s %s %s", config, src, srcOptions, name);
|
2016-03-08 17:01:39 +00:00
|
|
|
vlog("start %s\n", id.c_str());
|
2016-06-10 20:56:35 +00:00
|
|
|
SkAutoMutexAcquire lock(gMutex);
|
2016-07-25 22:27:29 +00:00
|
|
|
gRunning.push_back({id,SkGetThreadID()});
|
2015-03-18 12:27:14 +00:00
|
|
|
}
|
|
|
|
|
2016-02-24 20:28:32 +00:00
|
|
|
static void print_status() {
|
|
|
|
int curr = sk_tools::getCurrResidentSetSizeMB(),
|
|
|
|
peak = sk_tools::getMaxResidentSetSizeMB();
|
2016-03-08 17:01:39 +00:00
|
|
|
SkString elapsed = HumanizeMs(SkTime::GetMSecs() - kStartMs);
|
2016-02-24 20:28:32 +00:00
|
|
|
|
2016-06-10 20:56:35 +00:00
|
|
|
SkAutoMutexAcquire lock(gMutex);
|
2016-03-08 17:01:39 +00:00
|
|
|
info("\n%s elapsed, %d active, %d queued, %dMB RAM, %dMB peak\n",
|
|
|
|
elapsed.c_str(), gRunning.count(), gPending - gRunning.count(), curr, peak);
|
2016-02-24 20:28:32 +00:00
|
|
|
for (auto& task : gRunning) {
|
2016-07-25 22:27:29 +00:00
|
|
|
task.dump();
|
2016-02-24 20:28:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-25 22:27:29 +00:00
|
|
|
#if !defined(SK_BUILD_FOR_ANDROID)
|
|
|
|
static void find_culprit() {
|
|
|
|
// Assumes gMutex is locked.
|
|
|
|
SkThreadID thisThread = SkGetThreadID();
|
|
|
|
for (auto& task : gRunning) {
|
|
|
|
if (task.thread == thisThread) {
|
|
|
|
info("Likely culprit:\n");
|
|
|
|
task.dump();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-02-23 18:39:36 +00:00
|
|
|
#if defined(SK_BUILD_FOR_WIN32)
|
2016-06-09 15:59:48 +00:00
|
|
|
static LONG WINAPI crash_handler(EXCEPTION_POINTERS* e) {
|
2016-02-29 14:35:28 +00:00
|
|
|
static const struct {
|
|
|
|
const char* name;
|
2016-03-01 22:10:23 +00:00
|
|
|
DWORD code;
|
2016-02-29 14:35:28 +00:00
|
|
|
} kExceptions[] = {
|
|
|
|
#define _(E) {#E, E}
|
|
|
|
_(EXCEPTION_ACCESS_VIOLATION),
|
|
|
|
_(EXCEPTION_BREAKPOINT),
|
|
|
|
_(EXCEPTION_INT_DIVIDE_BY_ZERO),
|
|
|
|
_(EXCEPTION_STACK_OVERFLOW),
|
|
|
|
// TODO: more?
|
|
|
|
#undef _
|
|
|
|
};
|
|
|
|
|
2016-06-10 20:56:35 +00:00
|
|
|
SkAutoMutexAcquire lock(gMutex);
|
2016-06-09 15:59:48 +00:00
|
|
|
|
|
|
|
const DWORD code = e->ExceptionRecord->ExceptionCode;
|
|
|
|
info("\nCaught exception %u", code);
|
|
|
|
for (const auto& exception : kExceptions) {
|
|
|
|
if (exception.code == code) {
|
|
|
|
info(" %s", exception.name);
|
2016-02-29 14:35:28 +00:00
|
|
|
}
|
|
|
|
}
|
2016-06-09 15:59:48 +00:00
|
|
|
info(", was running:\n");
|
|
|
|
for (auto& task : gRunning) {
|
2016-07-25 22:27:29 +00:00
|
|
|
task.dump();
|
2016-06-09 15:59:48 +00:00
|
|
|
}
|
2016-07-25 22:27:29 +00:00
|
|
|
find_culprit();
|
2016-06-09 15:59:48 +00:00
|
|
|
fflush(stdout);
|
|
|
|
|
2016-02-29 14:35:28 +00:00
|
|
|
// Execute default exception handler... hopefully, exit.
|
|
|
|
return EXCEPTION_EXECUTE_HANDLER;
|
2016-02-23 18:39:36 +00:00
|
|
|
}
|
2016-06-09 15:59:48 +00:00
|
|
|
static void setup_crash_handler() { SetUnhandledExceptionFilter(crash_handler); }
|
2016-02-23 18:39:36 +00:00
|
|
|
|
2016-03-01 01:02:52 +00:00
|
|
|
#elif !defined(SK_BUILD_FOR_ANDROID)
|
|
|
|
#include <execinfo.h>
|
2016-02-23 18:39:36 +00:00
|
|
|
#include <signal.h>
|
2016-03-01 01:02:52 +00:00
|
|
|
#include <stdlib.h>
|
2016-02-29 14:35:28 +00:00
|
|
|
|
2016-06-09 15:59:48 +00:00
|
|
|
static void crash_handler(int sig) {
|
2016-06-10 20:56:35 +00:00
|
|
|
SkAutoMutexAcquire lock(gMutex);
|
2016-06-09 15:59:48 +00:00
|
|
|
|
|
|
|
info("\nCaught signal %d [%s], was running:\n", sig, strsignal(sig));
|
|
|
|
for (auto& task : gRunning) {
|
2016-07-25 22:27:29 +00:00
|
|
|
task.dump();
|
2016-06-09 15:59:48 +00:00
|
|
|
}
|
2016-07-25 22:27:29 +00:00
|
|
|
find_culprit();
|
2016-06-09 15:59:48 +00:00
|
|
|
|
|
|
|
void* stack[64];
|
|
|
|
int count = backtrace(stack, SK_ARRAY_COUNT(stack));
|
|
|
|
char** symbols = backtrace_symbols(stack, count);
|
|
|
|
info("\nStack trace:\n");
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
info(" %s\n", symbols[i]);
|
|
|
|
}
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
_Exit(sig);
|
|
|
|
}
|
|
|
|
|
2016-02-23 18:39:36 +00:00
|
|
|
static void setup_crash_handler() {
|
|
|
|
const int kSignals[] = { SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGSEGV };
|
|
|
|
for (int sig : kSignals) {
|
2016-06-09 15:59:48 +00:00
|
|
|
signal(sig, crash_handler);
|
2016-02-23 18:39:36 +00:00
|
|
|
}
|
|
|
|
}
|
2016-03-01 01:02:52 +00:00
|
|
|
|
|
|
|
#else // Android
|
|
|
|
static void setup_crash_handler() {}
|
2016-02-23 18:39:36 +00:00
|
|
|
#endif
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
2015-01-27 22:46:26 +00:00
|
|
|
struct Gold : public SkString {
|
2015-02-20 20:30:19 +00:00
|
|
|
Gold() : SkString("") {}
|
2016-02-25 03:07:07 +00:00
|
|
|
Gold(const SkString& sink, const SkString& src,
|
|
|
|
const SkString& srcOptions, const SkString& name,
|
|
|
|
const SkString& md5)
|
2015-01-27 22:46:26 +00:00
|
|
|
: SkString("") {
|
|
|
|
this->append(sink);
|
|
|
|
this->append(src);
|
2015-04-03 14:24:48 +00:00
|
|
|
this->append(srcOptions);
|
2015-01-27 22:46:26 +00:00
|
|
|
this->append(name);
|
|
|
|
this->append(md5);
|
|
|
|
}
|
2015-10-15 19:23:01 +00:00
|
|
|
struct Hash {
|
|
|
|
uint32_t operator()(const Gold& g) const {
|
|
|
|
return SkGoodHash()((const SkString&)g);
|
|
|
|
}
|
|
|
|
};
|
2015-01-27 22:46:26 +00:00
|
|
|
};
|
2015-02-20 20:30:19 +00:00
|
|
|
static SkTHashSet<Gold, Gold::Hash> gGold;
|
2015-01-27 22:46:26 +00:00
|
|
|
|
|
|
|
static void add_gold(JsonWriter::BitmapResult r) {
|
2015-04-03 14:24:48 +00:00
|
|
|
gGold.add(Gold(r.config, r.sourceType, r.sourceOptions, r.name, r.md5));
|
2015-01-27 22:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void gather_gold() {
|
|
|
|
if (!FLAGS_readPath.isEmpty()) {
|
|
|
|
SkString path(FLAGS_readPath[0]);
|
|
|
|
path.append("/dm.json");
|
|
|
|
if (!JsonWriter::ReadJson(path.c_str(), add_gold)) {
|
|
|
|
fail(SkStringPrintf("Couldn't read %s for golden results.", path.c_str()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
2016-03-16 15:37:19 +00:00
|
|
|
#if defined(SK_BUILD_FOR_WIN32)
|
|
|
|
static const char* kNewline = "\r\n";
|
|
|
|
#else
|
|
|
|
static const char* kNewline = "\n";
|
|
|
|
#endif
|
|
|
|
|
2015-04-03 21:15:33 +00:00
|
|
|
static SkTHashSet<SkString> gUninterestingHashes;
|
|
|
|
|
|
|
|
static void gather_uninteresting_hashes() {
|
|
|
|
if (!FLAGS_uninterestingHashesFile.isEmpty()) {
|
|
|
|
SkAutoTUnref<SkData> data(SkData::NewFromFileName(FLAGS_uninterestingHashesFile[0]));
|
2015-09-22 18:43:53 +00:00
|
|
|
if (!data) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("WARNING: unable to read uninteresting hashes from %s\n",
|
|
|
|
FLAGS_uninterestingHashesFile[0]);
|
2015-09-22 18:43:53 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-04-03 21:15:33 +00:00
|
|
|
SkTArray<SkString> hashes;
|
2016-03-16 15:37:19 +00:00
|
|
|
SkStrSplit((const char*)data->data(), kNewline, &hashes);
|
2015-04-03 21:15:33 +00:00
|
|
|
for (const SkString& hash : hashes) {
|
|
|
|
gUninterestingHashes.add(hash);
|
|
|
|
}
|
2016-03-08 17:01:39 +00:00
|
|
|
info("FYI: loaded %d distinct uninteresting hashes from %d lines\n",
|
|
|
|
gUninterestingHashes.count(), hashes.count());
|
2015-04-03 21:15:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
2015-07-29 13:37:28 +00:00
|
|
|
struct TaggedSrc : public SkAutoTDelete<Src> {
|
2016-02-25 03:07:07 +00:00
|
|
|
SkString tag;
|
|
|
|
SkString options;
|
2015-07-29 13:37:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TaggedSink : public SkAutoTDelete<Sink> {
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
SkString tag;
|
2015-04-03 14:24:48 +00:00
|
|
|
};
|
2015-01-15 18:56:12 +00:00
|
|
|
|
|
|
|
static const bool kMemcpyOK = true;
|
|
|
|
|
2015-07-29 13:37:28 +00:00
|
|
|
static SkTArray<TaggedSrc, kMemcpyOK> gSrcs;
|
|
|
|
static SkTArray<TaggedSink, kMemcpyOK> gSinks;
|
2015-01-15 18:56:12 +00:00
|
|
|
|
2015-04-27 15:45:01 +00:00
|
|
|
static bool in_shard() {
|
|
|
|
static int N = 0;
|
|
|
|
return N++ % FLAGS_shards == FLAGS_shard;
|
|
|
|
}
|
|
|
|
|
2016-02-25 03:07:07 +00:00
|
|
|
static void push_src(const char* tag, ImplicitString options, Src* s) {
|
2015-01-15 18:56:12 +00:00
|
|
|
SkAutoTDelete<Src> src(s);
|
2015-04-27 15:45:01 +00:00
|
|
|
if (in_shard() &&
|
2016-02-25 03:07:07 +00:00
|
|
|
FLAGS_src.contains(tag) &&
|
2015-01-15 18:56:12 +00:00
|
|
|
!SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) {
|
2015-07-29 13:37:28 +00:00
|
|
|
TaggedSrc& s = gSrcs.push_back();
|
2016-03-16 20:53:35 +00:00
|
|
|
s.reset(src.release());
|
2015-01-15 18:56:12 +00:00
|
|
|
s.tag = tag;
|
2015-04-03 14:24:48 +00:00
|
|
|
s.options = options;
|
2013-10-16 13:02:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-01 21:57:57 +00:00
|
|
|
static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorType dstColorType,
|
2016-02-03 17:42:42 +00:00
|
|
|
SkAlphaType dstAlphaType, float scale) {
|
2016-02-25 19:03:47 +00:00
|
|
|
if (FLAGS_simpleCodec) {
|
|
|
|
if (mode != CodecSrc::kCodec_Mode || dstColorType != CodecSrc::kGetFromCanvas_DstColorType
|
|
|
|
|| scale != 1.0f)
|
|
|
|
// Only decode in the simple case.
|
|
|
|
return;
|
|
|
|
}
|
2015-09-01 21:57:57 +00:00
|
|
|
SkString folder;
|
|
|
|
switch (mode) {
|
|
|
|
case CodecSrc::kCodec_Mode:
|
|
|
|
folder.append("codec");
|
|
|
|
break;
|
2016-01-13 17:31:39 +00:00
|
|
|
case CodecSrc::kCodecZeroInit_Mode:
|
|
|
|
folder.append("codec_zero_init");
|
|
|
|
break;
|
2015-09-01 21:57:57 +00:00
|
|
|
case CodecSrc::kScanline_Mode:
|
|
|
|
folder.append("scanline");
|
|
|
|
break;
|
|
|
|
case CodecSrc::kStripe_Mode:
|
|
|
|
folder.append("stripe");
|
|
|
|
break;
|
2016-02-22 20:27:46 +00:00
|
|
|
case CodecSrc::kCroppedScanline_Mode:
|
|
|
|
folder.append("crop");
|
|
|
|
break;
|
2015-09-01 21:57:57 +00:00
|
|
|
case CodecSrc::kSubset_Mode:
|
Remove unwanted images in Gold
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/
*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc). Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.
*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended. The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images. Right now in Gold, we have a
bunch of untriaged gray versions of color images.
The second issue would have been caught if we signaled
a fatal failure for invalid conversions. Maybe we should
look into this now that 565 is supported everywhere?
BUG=skia:
Review URL: https://codereview.chromium.org/1314163007
2015-09-02 20:20:52 +00:00
|
|
|
folder.append("codec_subset");
|
2015-09-01 21:57:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (dstColorType) {
|
|
|
|
case CodecSrc::kGrayscale_Always_DstColorType:
|
|
|
|
folder.append("_kGray8");
|
|
|
|
break;
|
|
|
|
case CodecSrc::kIndex8_Always_DstColorType:
|
|
|
|
folder.append("_kIndex8");
|
|
|
|
break;
|
2016-04-22 23:27:24 +00:00
|
|
|
case CodecSrc::kNonNative8888_Always_DstColorType:
|
|
|
|
folder.append("_kNonNative");
|
|
|
|
break;
|
2015-09-01 21:57:57 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-02-03 17:42:42 +00:00
|
|
|
switch (dstAlphaType) {
|
|
|
|
case kPremul_SkAlphaType:
|
|
|
|
folder.append("_premul");
|
|
|
|
break;
|
|
|
|
case kUnpremul_SkAlphaType:
|
|
|
|
folder.append("_unpremul");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-09-01 21:57:57 +00:00
|
|
|
if (1.0f != scale) {
|
|
|
|
folder.appendf("_%.3f", scale);
|
|
|
|
}
|
|
|
|
|
2016-02-03 17:42:42 +00:00
|
|
|
CodecSrc* src = new CodecSrc(path, mode, dstColorType, dstAlphaType, scale);
|
2015-09-01 21:57:57 +00:00
|
|
|
push_src("image", folder, src);
|
|
|
|
}
|
|
|
|
|
2016-05-16 16:04:13 +00:00
|
|
|
static void push_android_codec_src(Path path, CodecSrc::DstColorType dstColorType,
|
|
|
|
SkAlphaType dstAlphaType, int sampleSize) {
|
2015-10-21 17:27:10 +00:00
|
|
|
SkString folder;
|
2016-05-16 16:04:13 +00:00
|
|
|
folder.append("scaled_codec");
|
2015-10-21 17:27:10 +00:00
|
|
|
|
|
|
|
switch (dstColorType) {
|
|
|
|
case CodecSrc::kGrayscale_Always_DstColorType:
|
|
|
|
folder.append("_kGray8");
|
|
|
|
break;
|
|
|
|
case CodecSrc::kIndex8_Always_DstColorType:
|
|
|
|
folder.append("_kIndex8");
|
|
|
|
break;
|
2016-04-22 23:27:24 +00:00
|
|
|
case CodecSrc::kNonNative8888_Always_DstColorType:
|
|
|
|
folder.append("_kNonNative");
|
|
|
|
break;
|
2015-10-21 17:27:10 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-02-03 17:42:42 +00:00
|
|
|
switch (dstAlphaType) {
|
|
|
|
case kPremul_SkAlphaType:
|
|
|
|
folder.append("_premul");
|
|
|
|
break;
|
2016-02-03 20:39:10 +00:00
|
|
|
case kUnpremul_SkAlphaType:
|
|
|
|
folder.append("_unpremul");
|
|
|
|
break;
|
2016-02-03 17:42:42 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-10-21 17:27:10 +00:00
|
|
|
if (1 != sampleSize) {
|
2015-11-13 17:59:11 +00:00
|
|
|
folder.appendf("_%.3f", 1.0f / (float) sampleSize);
|
2015-10-21 17:27:10 +00:00
|
|
|
}
|
|
|
|
|
2016-05-16 16:04:13 +00:00
|
|
|
AndroidCodecSrc* src = new AndroidCodecSrc(path, dstColorType, dstAlphaType, sampleSize);
|
2015-10-21 17:27:10 +00:00
|
|
|
push_src("image", folder, src);
|
|
|
|
}
|
|
|
|
|
2016-03-09 22:20:58 +00:00
|
|
|
static void push_image_gen_src(Path path, ImageGenSrc::Mode mode, SkAlphaType alphaType, bool isGpu)
|
|
|
|
{
|
|
|
|
SkString folder;
|
|
|
|
switch (mode) {
|
|
|
|
case ImageGenSrc::kCodec_Mode:
|
|
|
|
folder.append("gen_codec");
|
|
|
|
break;
|
|
|
|
case ImageGenSrc::kPlatform_Mode:
|
|
|
|
folder.append("gen_platform");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isGpu) {
|
|
|
|
folder.append("_gpu");
|
|
|
|
} else {
|
|
|
|
switch (alphaType) {
|
|
|
|
case kOpaque_SkAlphaType:
|
|
|
|
folder.append("_opaque");
|
|
|
|
break;
|
|
|
|
case kPremul_SkAlphaType:
|
|
|
|
folder.append("_premul");
|
|
|
|
break;
|
|
|
|
case kUnpremul_SkAlphaType:
|
|
|
|
folder.append("_unpremul");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImageGenSrc* src = new ImageGenSrc(path, mode, alphaType, isGpu);
|
|
|
|
push_src("image", folder, src);
|
|
|
|
}
|
|
|
|
|
2015-04-09 19:43:10 +00:00
|
|
|
static void push_codec_srcs(Path path) {
|
|
|
|
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
|
|
|
|
if (!encoded) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("Couldn't read %s.", path.c_str());
|
2015-04-09 19:43:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
|
2015-08-27 14:41:13 +00:00
|
|
|
if (nullptr == codec.get()) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("Couldn't create codec for %s.", path.c_str());
|
2015-04-09 19:43:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-20 15:38:54 +00:00
|
|
|
// native scaling is only supported by WEBP and JPEG
|
|
|
|
bool supportsNativeScaling = false;
|
Remove unwanted images in Gold
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/
*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc). Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.
*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended. The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images. Right now in Gold, we have a
bunch of untriaged gray versions of color images.
The second issue would have been caught if we signaled
a fatal failure for invalid conversions. Maybe we should
look into this now that 565 is supported everywhere?
BUG=skia:
Review URL: https://codereview.chromium.org/1314163007
2015-09-02 20:20:52 +00:00
|
|
|
|
2016-02-22 20:27:46 +00:00
|
|
|
SkTArray<CodecSrc::Mode> nativeModes;
|
|
|
|
nativeModes.push_back(CodecSrc::kCodec_Mode);
|
|
|
|
nativeModes.push_back(CodecSrc::kCodecZeroInit_Mode);
|
|
|
|
switch (codec->getEncodedFormat()) {
|
|
|
|
case SkEncodedFormat::kJPEG_SkEncodedFormat:
|
|
|
|
nativeModes.push_back(CodecSrc::kScanline_Mode);
|
|
|
|
nativeModes.push_back(CodecSrc::kStripe_Mode);
|
|
|
|
nativeModes.push_back(CodecSrc::kCroppedScanline_Mode);
|
2016-05-20 15:38:54 +00:00
|
|
|
supportsNativeScaling = true;
|
2016-02-22 20:27:46 +00:00
|
|
|
break;
|
|
|
|
case SkEncodedFormat::kWEBP_SkEncodedFormat:
|
|
|
|
nativeModes.push_back(CodecSrc::kSubset_Mode);
|
2016-05-20 15:38:54 +00:00
|
|
|
supportsNativeScaling = true;
|
2016-02-22 20:27:46 +00:00
|
|
|
break;
|
2016-03-11 15:32:33 +00:00
|
|
|
case SkEncodedFormat::kDNG_SkEncodedFormat:
|
2016-02-23 13:37:25 +00:00
|
|
|
break;
|
2016-02-22 20:27:46 +00:00
|
|
|
default:
|
|
|
|
nativeModes.push_back(CodecSrc::kScanline_Mode);
|
|
|
|
break;
|
|
|
|
}
|
Remove unwanted images in Gold
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/
*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc). Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.
*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended. The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images. Right now in Gold, we have a
bunch of untriaged gray versions of color images.
The second issue would have been caught if we signaled
a fatal failure for invalid conversions. Maybe we should
look into this now that 565 is supported everywhere?
BUG=skia:
Review URL: https://codereview.chromium.org/1314163007
2015-09-02 20:20:52 +00:00
|
|
|
|
2016-02-22 20:27:46 +00:00
|
|
|
SkTArray<CodecSrc::DstColorType> colorTypes;
|
|
|
|
colorTypes.push_back(CodecSrc::kGetFromCanvas_DstColorType);
|
2016-04-22 23:27:24 +00:00
|
|
|
colorTypes.push_back(CodecSrc::kNonNative8888_Always_DstColorType);
|
Remove unwanted images in Gold
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/
*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc). Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.
*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended. The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images. Right now in Gold, we have a
bunch of untriaged gray versions of color images.
The second issue would have been caught if we signaled
a fatal failure for invalid conversions. Maybe we should
look into this now that 565 is supported everywhere?
BUG=skia:
Review URL: https://codereview.chromium.org/1314163007
2015-09-02 20:20:52 +00:00
|
|
|
switch (codec->getInfo().colorType()) {
|
|
|
|
case kGray_8_SkColorType:
|
2016-02-22 20:27:46 +00:00
|
|
|
colorTypes.push_back(CodecSrc::kGrayscale_Always_DstColorType);
|
2016-02-16 21:24:54 +00:00
|
|
|
if (kWBMP_SkEncodedFormat == codec->getEncodedFormat()) {
|
2016-02-22 20:27:46 +00:00
|
|
|
colorTypes.push_back(CodecSrc::kIndex8_Always_DstColorType);
|
2016-02-16 21:24:54 +00:00
|
|
|
}
|
Remove unwanted images in Gold
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/
*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc). Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.
*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended. The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images. Right now in Gold, we have a
bunch of untriaged gray versions of color images.
The second issue would have been caught if we signaled
a fatal failure for invalid conversions. Maybe we should
look into this now that 565 is supported everywhere?
BUG=skia:
Review URL: https://codereview.chromium.org/1314163007
2015-09-02 20:20:52 +00:00
|
|
|
break;
|
|
|
|
case kIndex_8_SkColorType:
|
2016-02-22 20:27:46 +00:00
|
|
|
colorTypes.push_back(CodecSrc::kIndex8_Always_DstColorType);
|
Remove unwanted images in Gold
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/
*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc). Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.
*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended. The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images. Right now in Gold, we have a
bunch of untriaged gray versions of color images.
The second issue would have been caught if we signaled
a fatal failure for invalid conversions. Maybe we should
look into this now that 565 is supported everywhere?
BUG=skia:
Review URL: https://codereview.chromium.org/1314163007
2015-09-02 20:20:52 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2015-06-11 21:27:27 +00:00
|
|
|
|
2016-02-03 17:42:42 +00:00
|
|
|
SkTArray<SkAlphaType> alphaModes;
|
|
|
|
alphaModes.push_back(kPremul_SkAlphaType);
|
2016-05-20 18:08:27 +00:00
|
|
|
if (codec->getInfo().alphaType() != kOpaque_SkAlphaType) {
|
|
|
|
alphaModes.push_back(kUnpremul_SkAlphaType);
|
2016-02-03 17:42:42 +00:00
|
|
|
}
|
2016-01-22 22:46:42 +00:00
|
|
|
|
|
|
|
for (CodecSrc::Mode mode : nativeModes) {
|
2016-05-20 15:38:54 +00:00
|
|
|
for (CodecSrc::DstColorType colorType : colorTypes) {
|
|
|
|
for (SkAlphaType alphaType : alphaModes) {
|
2016-05-20 18:08:27 +00:00
|
|
|
// Only test kCroppedScanline_Mode when the alpha type is premul. The test is
|
2016-05-20 15:38:54 +00:00
|
|
|
// slow and won't be interestingly different with different alpha types.
|
|
|
|
if (CodecSrc::kCroppedScanline_Mode == mode &&
|
2016-05-20 18:08:27 +00:00
|
|
|
kPremul_SkAlphaType != alphaType) {
|
2016-05-20 15:38:54 +00:00
|
|
|
continue;
|
|
|
|
}
|
2016-02-22 20:27:46 +00:00
|
|
|
|
2016-05-20 15:38:54 +00:00
|
|
|
push_codec_src(path, mode, colorType, alphaType, 1.0f);
|
2016-04-26 20:06:38 +00:00
|
|
|
|
2016-05-20 15:38:54 +00:00
|
|
|
// Skip kNonNative on different native scales. It won't be interestingly
|
|
|
|
// different.
|
|
|
|
if (supportsNativeScaling &&
|
|
|
|
CodecSrc::kNonNative8888_Always_DstColorType == colorType) {
|
|
|
|
// Native Scales
|
|
|
|
// SkJpegCodec natively supports scaling to the following:
|
|
|
|
for (auto scale : { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f }) {
|
|
|
|
push_codec_src(path, mode, colorType, alphaType, scale);
|
|
|
|
}
|
2016-02-03 17:42:42 +00:00
|
|
|
}
|
Remove unwanted images in Gold
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/
*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc). Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.
*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended. The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images. Right now in Gold, we have a
bunch of untriaged gray versions of color images.
The second issue would have been caught if we signaled
a fatal failure for invalid conversions. Maybe we should
look into this now that 565 is supported everywhere?
BUG=skia:
Review URL: https://codereview.chromium.org/1314163007
2015-09-02 20:20:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-09-01 21:57:57 +00:00
|
|
|
|
2016-02-25 19:03:47 +00:00
|
|
|
if (FLAGS_simpleCodec) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-21 17:27:10 +00:00
|
|
|
const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
|
|
|
|
|
|
|
for (int sampleSize : sampleSizes) {
|
2016-02-22 20:27:46 +00:00
|
|
|
for (CodecSrc::DstColorType colorType : colorTypes) {
|
2016-02-03 17:42:42 +00:00
|
|
|
for (SkAlphaType alphaType : alphaModes) {
|
2016-04-26 20:06:38 +00:00
|
|
|
// We can exercise all of the kNonNative support code in the swizzler with just a
|
|
|
|
// few sample sizes. Skip the rest.
|
|
|
|
if (CodecSrc::kNonNative8888_Always_DstColorType == colorType && sampleSize > 3) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-05-16 16:04:13 +00:00
|
|
|
push_android_codec_src(path, colorType, alphaType, sampleSize);
|
2015-10-21 17:27:10 +00:00
|
|
|
}
|
2015-09-01 21:57:57 +00:00
|
|
|
}
|
2015-06-11 21:27:27 +00:00
|
|
|
}
|
2016-03-09 22:20:58 +00:00
|
|
|
|
|
|
|
static const char* const rawExts[] = {
|
|
|
|
"arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw",
|
|
|
|
"ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW",
|
|
|
|
};
|
|
|
|
|
|
|
|
// There is not currently a reason to test RAW images on image generator.
|
|
|
|
// If we want to enable these tests, we will need to fix skbug.com/5079.
|
|
|
|
for (const char* ext : rawExts) {
|
|
|
|
if (path.endsWith(ext)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Push image generator GPU test.
|
2016-03-24 14:27:43 +00:00
|
|
|
push_image_gen_src(path, ImageGenSrc::kCodec_Mode, codec->getInfo().alphaType(), true);
|
2016-03-09 22:20:58 +00:00
|
|
|
|
|
|
|
// Push image generator CPU tests.
|
|
|
|
for (SkAlphaType alphaType : alphaModes) {
|
|
|
|
push_image_gen_src(path, ImageGenSrc::kCodec_Mode, alphaType, false);
|
|
|
|
|
|
|
|
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
|
|
|
|
if (kWEBP_SkEncodedFormat != codec->getEncodedFormat() &&
|
|
|
|
kWBMP_SkEncodedFormat != codec->getEncodedFormat() &&
|
|
|
|
kUnpremul_SkAlphaType != alphaType)
|
|
|
|
{
|
|
|
|
push_image_gen_src(path, ImageGenSrc::kPlatform_Mode, alphaType, false);
|
|
|
|
}
|
2016-03-17 20:50:17 +00:00
|
|
|
#elif defined(SK_BUILD_FOR_WIN)
|
|
|
|
if (kWEBP_SkEncodedFormat != codec->getEncodedFormat() &&
|
|
|
|
kWBMP_SkEncodedFormat != codec->getEncodedFormat())
|
|
|
|
{
|
|
|
|
push_image_gen_src(path, ImageGenSrc::kPlatform_Mode, alphaType, false);
|
|
|
|
}
|
2016-03-09 22:20:58 +00:00
|
|
|
#endif
|
|
|
|
}
|
2015-04-09 19:43:10 +00:00
|
|
|
}
|
|
|
|
|
2016-05-18 13:23:57 +00:00
|
|
|
static void push_brd_src(Path path, CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode,
|
|
|
|
uint32_t sampleSize) {
|
|
|
|
SkString folder("brd_android_codec");
|
2015-09-08 22:35:32 +00:00
|
|
|
switch (mode) {
|
|
|
|
case BRDSrc::kFullImage_Mode:
|
|
|
|
break;
|
|
|
|
case BRDSrc::kDivisor_Mode:
|
|
|
|
folder.append("_divisor");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
SkASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (dstColorType) {
|
|
|
|
case CodecSrc::kGetFromCanvas_DstColorType:
|
|
|
|
break;
|
|
|
|
case CodecSrc::kIndex8_Always_DstColorType:
|
|
|
|
folder.append("_kIndex");
|
|
|
|
break;
|
|
|
|
case CodecSrc::kGrayscale_Always_DstColorType:
|
|
|
|
folder.append("_kGray");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
SkASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (1 != sampleSize) {
|
2015-11-13 17:59:11 +00:00
|
|
|
folder.appendf("_%.3f", 1.0f / (float) sampleSize);
|
2015-09-08 22:35:32 +00:00
|
|
|
}
|
|
|
|
|
2016-05-18 13:23:57 +00:00
|
|
|
BRDSrc* src = new BRDSrc(path, mode, dstColorType, sampleSize);
|
2015-09-08 22:35:32 +00:00
|
|
|
push_src("image", folder, src);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void push_brd_srcs(Path path) {
|
2016-05-20 13:02:42 +00:00
|
|
|
// Only run Index8 and grayscale to one sampleSize and Mode. Though interesting
|
|
|
|
// to test these color types, they should not reveal anything across various
|
|
|
|
// sampleSizes and Modes
|
|
|
|
for (auto type : { CodecSrc::kIndex8_Always_DstColorType,
|
|
|
|
CodecSrc::kGrayscale_Always_DstColorType }) {
|
|
|
|
// Arbitrarily choose Mode and sampleSize.
|
|
|
|
push_brd_src(path, type, BRDSrc::kFullImage_Mode, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-03 15:55:11 +00:00
|
|
|
// Test on a variety of sampleSizes, making sure to include:
|
|
|
|
// - 2, 4, and 8, which are natively supported by jpeg
|
|
|
|
// - multiples of 2 which are not divisible by 4 (analogous for 4)
|
|
|
|
// - larger powers of two, since BRD clients generally use powers of 2
|
|
|
|
// We will only produce output for the larger sizes on large images.
|
|
|
|
const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 64 };
|
Remove jpegs with uninitialized memory from Gold
BitmapRegionSampler (uses SkImageDecoder) will often scale
to a power of 2 regardless of the sampleSize requested.
This is skbug.com/4319.
Consider a 60x60 image.
To decode a subset with sample size 3, we might ask for the
following.
[x, y, w, h] = [-15, -15, 30, 30]
sampleSize = 3
Since w = 30 and h = 30, this should give us a 10x10
result. Only the bottom right 5x5 quadrant of this 10x10
subset will actually be in the image. We should get a 5
pixel border on the top and left because we ask for 15
extra pixels on the top and left.
Unfortunately, SkImageDecoder will take our requested
sample size of 3, and then decide to use a sample size of
2. Not only will it scale the image by 2, but it will also
scale the border by 2. So while we are expecting pixel
data to begin at offset (5, 5) of the result bitmap, it
actually begins at offset (7, 7). Making things worse,
the pixels between (5, 5) and (7, 7) are uninitialized,
causing problems on Gold.
Options for fixing this include:
(1) Not testing decodes with a border.
(2) Changing the test to check the size of the output
bitmap.
(3) Disable the tests.
I think it's best to just disable these tests. We know
they don't work, so why do we need to see the results on
Gold?
BUG=skia:4319
Review URL: https://codereview.chromium.org/1313233007
2015-09-11 16:01:16 +00:00
|
|
|
|
2015-09-08 22:35:32 +00:00
|
|
|
const BRDSrc::Mode modes[] = {
|
2015-10-22 14:29:19 +00:00
|
|
|
BRDSrc::kFullImage_Mode,
|
|
|
|
BRDSrc::kDivisor_Mode,
|
2015-09-08 22:35:32 +00:00
|
|
|
};
|
|
|
|
|
2016-05-18 13:23:57 +00:00
|
|
|
for (uint32_t sampleSize : sampleSizes) {
|
2016-05-20 13:02:42 +00:00
|
|
|
for (BRDSrc::Mode mode : modes) {
|
|
|
|
push_brd_src(path, CodecSrc::kGetFromCanvas_DstColorType, mode, sampleSize);
|
2015-09-08 22:35:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool brd_supported(const char* ext) {
|
2015-04-01 13:58:48 +00:00
|
|
|
static const char* const exts[] = {
|
2015-09-08 22:35:32 +00:00
|
|
|
"jpg", "jpeg", "png", "webp",
|
|
|
|
"JPG", "JPEG", "PNG", "WEBP",
|
2015-04-01 13:58:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
|
|
|
|
if (0 == strcmp(exts[i], ext)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2015-03-19 13:03:39 +00:00
|
|
|
}
|
|
|
|
|
2016-02-03 20:19:11 +00:00
|
|
|
static bool gather_srcs() {
|
2015-01-15 18:56:12 +00:00
|
|
|
for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->next()) {
|
2015-04-03 14:24:48 +00:00
|
|
|
push_src("gm", "", new GMSrc(r->factory()));
|
2013-10-16 13:02:15 +00:00
|
|
|
}
|
2015-01-30 15:31:19 +00:00
|
|
|
for (int i = 0; i < FLAGS_skps.count(); i++) {
|
|
|
|
const char* path = FLAGS_skps[i];
|
|
|
|
if (sk_isdir(path)) {
|
|
|
|
SkOSFile::Iter it(path, "skp");
|
|
|
|
for (SkString file; it.next(&file); ) {
|
2015-04-03 14:24:48 +00:00
|
|
|
push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str())));
|
2015-01-30 15:31:19 +00:00
|
|
|
}
|
|
|
|
} else {
|
2015-04-03 14:24:48 +00:00
|
|
|
push_src("skp", "", new SKPSrc(path));
|
2014-02-28 20:31:31 +00:00
|
|
|
}
|
2014-02-26 16:31:22 +00:00
|
|
|
}
|
2016-02-03 20:19:11 +00:00
|
|
|
|
2016-06-02 19:41:14 +00:00
|
|
|
for (int i = 0; i < FLAGS_mskps.count(); i++) {
|
|
|
|
const char* path = FLAGS_mskps[i];
|
|
|
|
if (sk_isdir(path)) {
|
|
|
|
SkOSFile::Iter it(path, "mskp");
|
|
|
|
for (SkString file; it.next(&file);) {
|
|
|
|
push_src("mskp", "",
|
|
|
|
new MSKPSrc(SkOSPath::Join(path, file.c_str())));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
push_src("mskp", "", new MSKPSrc(path));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-03 20:19:11 +00:00
|
|
|
SkTArray<SkString> images;
|
2016-04-29 16:38:40 +00:00
|
|
|
if (!CollectImages(FLAGS_images, &images)) {
|
2016-02-03 20:19:11 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto image : images) {
|
|
|
|
push_codec_srcs(image);
|
2016-02-25 19:03:47 +00:00
|
|
|
if (FLAGS_simpleCodec) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-02-08 20:39:59 +00:00
|
|
|
const char* ext = strrchr(image.c_str(), '.');
|
|
|
|
if (ext && brd_supported(ext+1)) {
|
2016-02-03 20:19:11 +00:00
|
|
|
push_brd_srcs(image);
|
2015-01-15 18:15:02 +00:00
|
|
|
}
|
|
|
|
}
|
2016-02-03 20:19:11 +00:00
|
|
|
|
2016-04-29 16:38:40 +00:00
|
|
|
SkTArray<SkString> colorImages;
|
|
|
|
if (!CollectImages(FLAGS_colorImages, &colorImages)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto colorImage : colorImages) {
|
2016-07-15 20:54:38 +00:00
|
|
|
ColorCodecSrc* src = new ColorCodecSrc(colorImage, ColorCodecSrc::kBaseline_Mode,
|
|
|
|
kN32_SkColorType);
|
2016-04-29 16:38:40 +00:00
|
|
|
push_src("image", "color_codec_baseline", src);
|
2016-05-23 17:21:17 +00:00
|
|
|
|
2016-07-15 20:54:38 +00:00
|
|
|
src = new ColorCodecSrc(colorImage, ColorCodecSrc::kDst_HPZR30w_Mode, kN32_SkColorType);
|
2016-05-23 17:21:17 +00:00
|
|
|
push_src("image", "color_codec_HPZR30w", src);
|
2016-07-15 20:54:38 +00:00
|
|
|
// TODO (msarett):
|
|
|
|
// Should we test this Dst in F16 mode (even though the Dst gamma is 2.2 instead of sRGB)?
|
2016-06-01 21:47:18 +00:00
|
|
|
|
2016-07-15 20:54:38 +00:00
|
|
|
src = new ColorCodecSrc(colorImage, ColorCodecSrc::kDst_sRGB_Mode, kN32_SkColorType);
|
|
|
|
push_src("image", "color_codec_sRGB_kN32", src);
|
|
|
|
src = new ColorCodecSrc(colorImage, ColorCodecSrc::kDst_sRGB_Mode, kRGBA_F16_SkColorType);
|
|
|
|
push_src("image", "color_codec_sRGB_kF16", src);
|
2016-06-20 13:07:45 +00:00
|
|
|
|
2016-06-06 15:20:37 +00:00
|
|
|
#if defined(SK_TEST_QCMS)
|
2016-07-29 13:23:33 +00:00
|
|
|
src = new ColorCodecSrc(colorImage, ColorCodecSrc::kQCMS_HPZR30w_Mode,
|
|
|
|
kRGBA_8888_SkColorType);
|
2016-06-01 21:47:18 +00:00
|
|
|
push_src("image", "color_codec_QCMS_HPZR30w", src);
|
|
|
|
#endif
|
2016-04-29 16:38:40 +00:00
|
|
|
}
|
|
|
|
|
2016-02-03 20:19:11 +00:00
|
|
|
return true;
|
2015-01-15 16:30:25 +00:00
|
|
|
}
|
|
|
|
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
static void push_sink(const SkCommandLineConfig& config, Sink* s) {
|
Revert of Add config options to run different GPU APIs to dm and nanobench (patchset #21 id:400001 of https://codereview.chromium.org/1490113005/ )
Reason for revert:
The Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug builder fails after this CL.
Links to specific builds:
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1689
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1690
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1691
Original issue's description:
> 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
>
> Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
TBR=mtklein@google.com,bsalomon@google.com,joshualitt@google.com,scroggo@google.com,kkinnunen@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:2992
Review URL: https://codereview.chromium.org/1548683002
2015-12-22 18:22:26 +00:00
|
|
|
SkAutoTDelete<Sink> sink(s);
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
|
2015-07-29 13:37:28 +00:00
|
|
|
// Try a simple Src as a canary. If it fails, skip this sink.
|
2015-01-15 18:56:12 +00:00
|
|
|
struct : public Src {
|
2015-07-29 13:37:28 +00:00
|
|
|
Error draw(SkCanvas* c) const override {
|
|
|
|
c->drawRect(SkRect::MakeWH(1,1), SkPaint());
|
|
|
|
return "";
|
|
|
|
}
|
2015-03-26 01:17:31 +00:00
|
|
|
SkISize size() const override { return SkISize::Make(16, 16); }
|
2015-07-29 13:37:28 +00:00
|
|
|
Name name() const override { return "justOneRect"; }
|
|
|
|
} justOneRect;
|
2015-01-15 18:56:12 +00:00
|
|
|
|
|
|
|
SkBitmap bitmap;
|
|
|
|
SkDynamicMemoryWStream stream;
|
2015-02-03 02:26:03 +00:00
|
|
|
SkString log;
|
2015-07-29 13:37:28 +00:00
|
|
|
Error err = sink->draw(justOneRect, &bitmap, &stream, &log);
|
2015-03-05 16:40:28 +00:00
|
|
|
if (err.isFatal()) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("Could not run %s: %s\n", config.getTag().c_str(), err.c_str());
|
2015-04-21 17:49:13 +00:00
|
|
|
exit(1);
|
2014-07-28 14:21:24 +00:00
|
|
|
}
|
2015-01-15 16:30:25 +00:00
|
|
|
|
2015-07-29 13:37:28 +00:00
|
|
|
TaggedSink& ts = gSinks.push_back();
|
2016-03-16 20:53:35 +00:00
|
|
|
ts.reset(sink.release());
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
ts.tag = config.getTag();
|
2015-01-15 18:56:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool gpu_supported() {
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
return FLAGS_gpu;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
|
|
|
|
static Sink* create_sink(const SkCommandLineConfig* config) {
|
2015-12-04 07:04:50 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
Revert of Add config options to run different GPU APIs to dm and nanobench (patchset #21 id:400001 of https://codereview.chromium.org/1490113005/ )
Reason for revert:
The Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug builder fails after this CL.
Links to specific builds:
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1689
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1690
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1691
Original issue's description:
> 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
>
> Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
TBR=mtklein@google.com,bsalomon@google.com,joshualitt@google.com,scroggo@google.com,kkinnunen@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:2992
Review URL: https://codereview.chromium.org/1548683002
2015-12-22 18:22:26 +00:00
|
|
|
if (gpu_supported()) {
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) {
|
2016-04-05 18:06:27 +00:00
|
|
|
GrContextFactory::ContextType contextType = gpuConfig->getContextType();
|
|
|
|
GrContextFactory::ContextOptions contextOptions =
|
|
|
|
GrContextFactory::kNone_ContextOptions;
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
if (gpuConfig->getUseNVPR()) {
|
2016-04-05 18:06:27 +00:00
|
|
|
contextOptions = static_cast<GrContextFactory::ContextOptions>(
|
|
|
|
contextOptions | GrContextFactory::kEnableNVPR_ContextOptions);
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
}
|
2016-07-29 15:14:20 +00:00
|
|
|
if (gpuConfig->getUseInstanced()) {
|
|
|
|
contextOptions = static_cast<GrContextFactory::ContextOptions>(
|
|
|
|
contextOptions | GrContextFactory::kUseInstanced_ContextOptions);
|
|
|
|
}
|
2016-06-16 20:03:24 +00:00
|
|
|
if (SkColorAndColorSpaceAreGammaCorrect(gpuConfig->getColorType(),
|
|
|
|
gpuConfig->getColorSpace())) {
|
2016-04-05 18:06:27 +00:00
|
|
|
contextOptions = static_cast<GrContextFactory::ContextOptions>(
|
|
|
|
contextOptions | GrContextFactory::kRequireSRGBSupport_ContextOptions);
|
2016-03-30 18:19:36 +00:00
|
|
|
}
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
GrContextFactory testFactory;
|
|
|
|
if (!testFactory.get(contextType, contextOptions)) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("WARNING: can not create GPU context for config '%s'. "
|
|
|
|
"GM tests will be skipped.\n", gpuConfig->getTag().c_str());
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return new GPUSink(contextType, contextOptions, gpuConfig->getSamples(),
|
2016-03-10 15:49:08 +00:00
|
|
|
gpuConfig->getUseDIText(), gpuConfig->getColorType(),
|
2016-06-16 20:03:24 +00:00
|
|
|
sk_ref_sp(gpuConfig->getColorSpace()), FLAGS_gpu_threading);
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
}
|
Revert of Add config options to run different GPU APIs to dm and nanobench (patchset #21 id:400001 of https://codereview.chromium.org/1490113005/ )
Reason for revert:
The Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug builder fails after this CL.
Links to specific builds:
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1689
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1690
http://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Debug/builds/1691
Original issue's description:
> 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
>
> Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
TBR=mtklein@google.com,bsalomon@google.com,joshualitt@google.com,scroggo@google.com,kkinnunen@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:2992
Review URL: https://codereview.chromium.org/1548683002
2015-12-22 18:22:26 +00:00
|
|
|
}
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define SINK(t, sink, ...) if (config->getBackend().equals(t)) { return new sink(__VA_ARGS__); }
|
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
2015-12-22 07:48:13 +00:00
|
|
|
|
2015-02-23 20:18:05 +00:00
|
|
|
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
|
|
|
SINK("hwui", HWUISink);
|
|
|
|
#endif
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
if (FLAGS_cpu) {
|
2016-06-16 20:03:24 +00:00
|
|
|
auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
SINK("565", RasterSink, kRGB_565_SkColorType);
|
|
|
|
SINK("8888", RasterSink, kN32_SkColorType);
|
2016-06-16 20:03:24 +00:00
|
|
|
SINK("srgb", RasterSink, kN32_SkColorType, srgbColorSpace);
|
2016-07-26 15:11:50 +00:00
|
|
|
SINK("f16", RasterSink, kRGBA_F16_SkColorType, srgbColorSpace);
|
2016-04-04 13:12:15 +00:00
|
|
|
SINK("pdf", PDFSink);
|
2015-01-28 19:35:18 +00:00
|
|
|
SINK("skp", SKPSink);
|
2015-02-01 04:00:58 +00:00
|
|
|
SINK("svg", SVGSink);
|
|
|
|
SINK("null", NullSink);
|
2015-03-03 17:13:09 +00:00
|
|
|
SINK("xps", XPSSink);
|
2016-04-27 14:45:18 +00:00
|
|
|
SINK("pdfa", PDFSink, true);
|
2015-01-15 18:56:12 +00:00
|
|
|
}
|
|
|
|
#undef SINK
|
2015-08-27 14:41:13 +00:00
|
|
|
return nullptr;
|
2015-01-15 18:56:12 +00:00
|
|
|
}
|
|
|
|
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
static Sink* create_via(const SkString& tag, Sink* wrapped) {
|
|
|
|
#define VIA(t, via, ...) if (tag.equals(t)) { return new via(__VA_ARGS__); }
|
2015-08-27 14:41:13 +00:00
|
|
|
VIA("twice", ViaTwice, wrapped);
|
|
|
|
VIA("serialize", ViaSerialization, wrapped);
|
2016-01-08 18:19:35 +00:00
|
|
|
VIA("pic", ViaPicture, wrapped);
|
2015-08-27 14:41:13 +00:00
|
|
|
VIA("2ndpic", ViaSecondPicture, wrapped);
|
2015-05-05 19:59:56 +00:00
|
|
|
VIA("sp", ViaSingletonPictures, wrapped);
|
2016-07-08 15:43:27 +00:00
|
|
|
VIA("defer", ViaDefer, wrapped);
|
2015-08-27 14:41:13 +00:00
|
|
|
VIA("tiles", ViaTiles, 256, 256, nullptr, wrapped);
|
2015-01-21 21:18:51 +00:00
|
|
|
VIA("tiles_rt", ViaTiles, 256, 256, new SkRTreeFactory, wrapped);
|
2015-01-15 18:56:12 +00:00
|
|
|
|
2015-02-17 19:13:33 +00:00
|
|
|
if (FLAGS_matrix.count() == 4) {
|
2015-01-15 18:56:12 +00:00
|
|
|
SkMatrix m;
|
2015-02-17 19:13:33 +00:00
|
|
|
m.reset();
|
|
|
|
m.setScaleX((SkScalar)atof(FLAGS_matrix[0]));
|
|
|
|
m.setSkewX ((SkScalar)atof(FLAGS_matrix[1]));
|
|
|
|
m.setSkewY ((SkScalar)atof(FLAGS_matrix[2]));
|
|
|
|
m.setScaleY((SkScalar)atof(FLAGS_matrix[3]));
|
|
|
|
VIA("matrix", ViaMatrix, m, wrapped);
|
|
|
|
VIA("upright", ViaUpright, m, wrapped);
|
2015-01-15 18:15:02 +00:00
|
|
|
}
|
2015-03-05 16:01:07 +00:00
|
|
|
|
|
|
|
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
|
|
|
VIA("androidsdk", ViaAndroidSDK, wrapped);
|
|
|
|
#endif
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
#undef VIA
|
2015-08-27 14:41:13 +00:00
|
|
|
return nullptr;
|
2014-07-28 14:21:24 +00:00
|
|
|
}
|
2014-05-14 17:55:32 +00:00
|
|
|
|
2016-05-09 20:42:16 +00:00
|
|
|
static bool gather_sinks() {
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
SkCommandLineConfigArray configs;
|
|
|
|
ParseConfigs(FLAGS_config, &configs);
|
|
|
|
for (int i = 0; i < configs.count(); i++) {
|
|
|
|
const SkCommandLineConfig& config = *configs[i];
|
|
|
|
Sink* sink = create_sink(&config);
|
|
|
|
if (sink == nullptr) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("Skipping config %s: Don't understand '%s'.\n", config.getTag().c_str(),
|
|
|
|
config.getTag().c_str());
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SkTArray<SkString>& parts = config.getViaParts();
|
|
|
|
for (int j = parts.count(); j-- > 0;) {
|
|
|
|
const SkString& part = parts[j];
|
|
|
|
Sink* next = create_via(part, sink);
|
2015-08-27 14:41:13 +00:00
|
|
|
if (next == nullptr) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("Skipping config %s: Don't understand '%s'.\n", config.getTag().c_str(),
|
|
|
|
part.c_str());
|
2015-01-15 18:56:12 +00:00
|
|
|
delete sink;
|
2015-08-27 14:41:13 +00:00
|
|
|
sink = nullptr;
|
2015-01-15 18:56:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
sink = next;
|
2015-01-15 18:15:02 +00:00
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
if (sink) {
|
|
|
|
push_sink(config, sink);
|
2015-01-15 18:15:02 +00:00
|
|
|
}
|
2014-05-14 17:55:32 +00:00
|
|
|
}
|
2016-05-09 20:42:16 +00:00
|
|
|
|
|
|
|
// If no configs were requested (just running tests, perhaps?), then we're okay.
|
|
|
|
// Otherwise, make sure that at least one sink was constructed correctly. This catches
|
|
|
|
// the case of bots without a GPU being assigned GPU configs.
|
|
|
|
return (configs.count() == 0) || (gSinks.count() > 0);
|
2015-01-15 18:15:02 +00:00
|
|
|
}
|
2014-05-14 17:55:32 +00:00
|
|
|
|
2015-08-24 20:27:01 +00:00
|
|
|
static bool dump_png(SkBitmap bitmap, const char* path, const char* md5) {
|
|
|
|
const int w = bitmap.width(),
|
|
|
|
h = bitmap.height();
|
2016-02-26 22:43:21 +00:00
|
|
|
|
2016-04-19 16:18:11 +00:00
|
|
|
sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(bitmap);
|
|
|
|
if (encodedBitmap.get() == nullptr) {
|
|
|
|
return false;
|
2015-08-24 20:27:01 +00:00
|
|
|
}
|
2016-04-19 16:18:11 +00:00
|
|
|
uint32_t* rgba = static_cast<uint32_t*>(encodedBitmap.get()->writable_data());
|
2015-08-24 20:27:01 +00:00
|
|
|
|
|
|
|
// We don't need bitmap anymore. Might as well drop our ref.
|
2015-08-24 21:13:29 +00:00
|
|
|
bitmap.reset();
|
2015-08-24 20:27:01 +00:00
|
|
|
|
2015-08-25 17:56:08 +00:00
|
|
|
FILE* f = fopen(path, "wb");
|
2015-08-24 20:27:01 +00:00
|
|
|
if (!f) { return false; }
|
|
|
|
|
|
|
|
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
|
|
|
if (!png) {
|
|
|
|
fclose(f);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
png_infop info = png_create_info_struct(png);
|
|
|
|
if (!info) {
|
|
|
|
png_destroy_write_struct(&png, &info);
|
|
|
|
fclose(f);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-09-10 17:37:44 +00:00
|
|
|
SkString description;
|
|
|
|
description.append("Key: ");
|
|
|
|
for (int i = 0; i < FLAGS_key.count(); i++) {
|
|
|
|
description.appendf("%s ", FLAGS_key[i]);
|
|
|
|
}
|
|
|
|
description.append("Properties: ");
|
|
|
|
for (int i = 0; i < FLAGS_properties.count(); i++) {
|
|
|
|
description.appendf("%s ", FLAGS_properties[i]);
|
|
|
|
}
|
|
|
|
description.appendf("MD5: %s", md5);
|
|
|
|
|
2015-08-24 20:27:01 +00:00
|
|
|
png_text text[2];
|
|
|
|
text[0].key = (png_charp)"Author";
|
|
|
|
text[0].text = (png_charp)"DM dump_png()";
|
|
|
|
text[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
|
|
|
text[1].key = (png_charp)"Description";
|
2015-09-10 17:37:44 +00:00
|
|
|
text[1].text = (png_charp)description.c_str();
|
2015-08-24 20:27:01 +00:00
|
|
|
text[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
|
|
|
png_set_text(png, info, text, 2);
|
|
|
|
|
|
|
|
png_init_io(png, f);
|
|
|
|
png_set_IHDR(png, info, (png_uint_32)w, (png_uint_32)h, 8,
|
|
|
|
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
|
|
|
|
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
|
|
|
png_write_info(png, info);
|
|
|
|
for (int j = 0; j < h; j++) {
|
2016-04-19 16:18:11 +00:00
|
|
|
png_bytep row = (png_bytep)(rgba + w*j);
|
2015-08-24 20:27:01 +00:00
|
|
|
png_write_rows(png, &row, 1);
|
|
|
|
}
|
|
|
|
png_write_end(png, info);
|
|
|
|
|
|
|
|
png_destroy_write_struct(&png, &info);
|
|
|
|
fclose(f);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-15 21:44:22 +00:00
|
|
|
static bool match(const char* needle, const char* haystack) {
|
2015-08-27 14:41:13 +00:00
|
|
|
return 0 == strcmp("_", needle) || nullptr != strstr(haystack, needle);
|
2015-01-15 21:44:22 +00:00
|
|
|
}
|
|
|
|
|
2016-02-25 03:07:07 +00:00
|
|
|
static bool is_blacklisted(const char* sink, const char* src,
|
|
|
|
const char* srcOptions, const char* name) {
|
2015-04-03 14:51:00 +00:00
|
|
|
for (int i = 0; i < FLAGS_blacklist.count() - 3; i += 4) {
|
2015-01-15 21:44:22 +00:00
|
|
|
if (match(FLAGS_blacklist[i+0], sink) &&
|
2015-04-03 14:24:48 +00:00
|
|
|
match(FLAGS_blacklist[i+1], src) &&
|
|
|
|
match(FLAGS_blacklist[i+2], srcOptions) &&
|
|
|
|
match(FLAGS_blacklist[i+3], name)) {
|
2016-02-25 03:07:07 +00:00
|
|
|
return true;
|
2015-01-15 21:44:22 +00:00
|
|
|
}
|
|
|
|
}
|
2016-02-25 03:07:07 +00:00
|
|
|
return false;
|
2015-01-15 21:44:22 +00:00
|
|
|
}
|
|
|
|
|
2016-01-05 14:20:20 +00:00
|
|
|
// Even when a Task Sink reports to be non-threadsafe (e.g. GPU), we know things like
|
|
|
|
// .png encoding are definitely thread safe. This lets us offload that work to CPU threads.
|
|
|
|
static SkTaskGroup gDefinitelyThreadSafeWork;
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
// The finest-grained unit of work we can run: draw a single Src into a single Sink,
|
|
|
|
// report any errors, and perhaps write out the output: a .png of the bitmap, or a raw stream.
|
|
|
|
struct Task {
|
2015-07-29 13:37:28 +00:00
|
|
|
Task(const TaggedSrc& src, const TaggedSink& sink) : src(src), sink(sink) {}
|
|
|
|
const TaggedSrc& src;
|
|
|
|
const TaggedSink& sink;
|
2015-01-15 18:56:12 +00:00
|
|
|
|
2016-02-08 20:39:59 +00:00
|
|
|
static void Run(const Task& task) {
|
|
|
|
SkString name = task.src->name();
|
2015-07-29 13:37:28 +00:00
|
|
|
|
2015-02-03 02:26:03 +00:00
|
|
|
SkString log;
|
2016-02-25 03:07:07 +00:00
|
|
|
if (!FLAGS_dryRun) {
|
2015-01-15 18:56:12 +00:00
|
|
|
SkBitmap bitmap;
|
|
|
|
SkDynamicMemoryWStream stream;
|
2016-02-25 03:07:07 +00:00
|
|
|
start(task.sink.tag.c_str(), task.src.tag.c_str(),
|
|
|
|
task.src.options.c_str(), name.c_str());
|
2016-02-08 20:39:59 +00:00
|
|
|
Error err = task.sink->draw(*task.src, &bitmap, &stream, &log);
|
2016-03-07 21:20:52 +00:00
|
|
|
if (!log.isEmpty()) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("%s %s %s %s:\n%s\n", task.sink.tag.c_str()
|
|
|
|
, task.src.tag.c_str()
|
|
|
|
, task.src.options.c_str()
|
|
|
|
, name.c_str()
|
|
|
|
, log.c_str());
|
2016-03-07 21:20:52 +00:00
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
if (!err.isEmpty()) {
|
2015-03-05 16:40:28 +00:00
|
|
|
if (err.isFatal()) {
|
2015-04-03 14:24:48 +00:00
|
|
|
fail(SkStringPrintf("%s %s %s %s: %s",
|
2016-02-08 20:39:59 +00:00
|
|
|
task.sink.tag.c_str(),
|
|
|
|
task.src.tag.c_str(),
|
|
|
|
task.src.options.c_str(),
|
2015-03-05 16:40:28 +00:00
|
|
|
name.c_str(),
|
|
|
|
err.c_str()));
|
2015-03-18 12:27:14 +00:00
|
|
|
} else {
|
2016-02-25 03:07:07 +00:00
|
|
|
done(task.sink.tag.c_str(), task.src.tag.c_str(),
|
|
|
|
task.src.options.c_str(), name.c_str());
|
2016-01-21 17:39:35 +00:00
|
|
|
return;
|
2015-03-05 16:40:28 +00:00
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
}
|
2016-01-05 14:20:20 +00:00
|
|
|
|
|
|
|
// We're likely switching threads here, so we must capture by value, [=] or [foo,bar].
|
|
|
|
SkStreamAsset* data = stream.detachAsStream();
|
|
|
|
gDefinitelyThreadSafeWork.add([task,name,bitmap,data]{
|
|
|
|
SkAutoTDelete<SkStreamAsset> ownedData(data);
|
|
|
|
|
|
|
|
// Why doesn't the copy constructor do this when we have pre-locked pixels?
|
|
|
|
bitmap.lockPixels();
|
|
|
|
|
|
|
|
SkString md5;
|
|
|
|
if (!FLAGS_writePath.isEmpty() || !FLAGS_readPath.isEmpty()) {
|
|
|
|
SkMD5 hash;
|
|
|
|
if (data->getLength()) {
|
|
|
|
hash.writeStream(data, data->getLength());
|
|
|
|
data->rewind();
|
DM: swizzle BGRA to RGBA before calculating pixel MD5.
We name our .pngs by pixel hashes for gold. For 8888 images, we're hashing
SkPMColors, which have platform-dependent order: BGRA on Linux and Windows,
RGBA otherwise. This means we can end up with pixel-identical pngs with
different hashes, which is confusing.
This CL standardizes on RGBA for 8888 configs, arbitrarily chosen so that
Android ends up a no-op. Long-term, this should eliminate most of the
0-pixel-diff problems we see on gold.skia.org. There are other ways to end up
with the same .png from different SkBitmaps (think, red 565 square vs. red 8888
square) but they're rather less common / likely.
This will temporarily create a giant 0-pixel-diff problem on gold.skia.org.
Any Linux or Windows images which are not already pixel-identical to a Mac or
Android image should show up as untriaged hashes that are pixel-identical to
their version just before landing (we're only changing the hash, not the .png).
This means anything vaguely platform dependent (fonts, GPUs) will probably show
up as needing a triage but with a zero diff from a previous image.
If this goes well, we might do the same for 565. Just want to leave them out
for now to cut down on the triaging I need to do in one go.
BUG=skia:
Review URL: https://codereview.chromium.org/1226933005
2015-07-08 14:25:27 +00:00
|
|
|
} else {
|
2016-01-05 14:20:20 +00:00
|
|
|
// If we're BGRA (Linux, Windows), swizzle over to RGBA (Mac, Android).
|
|
|
|
// This helps eliminate multiple 0-pixel-diff hashes on gold.skia.org.
|
|
|
|
// (Android's general slow speed breaks the tie arbitrarily in RGBA's favor.)
|
|
|
|
// We might consider promoting 565 to RGBA too.
|
|
|
|
if (bitmap.colorType() == kBGRA_8888_SkColorType) {
|
|
|
|
SkBitmap swizzle;
|
|
|
|
SkAssertResult(bitmap.copyTo(&swizzle, kRGBA_8888_SkColorType));
|
|
|
|
hash.write(swizzle.getPixels(), swizzle.getSize());
|
|
|
|
} else {
|
|
|
|
hash.write(bitmap.getPixels(), bitmap.getSize());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SkMD5::Digest digest;
|
|
|
|
hash.finish(digest);
|
|
|
|
for (int i = 0; i < 16; i++) {
|
|
|
|
md5.appendf("%02x", digest.data[i]);
|
DM: swizzle BGRA to RGBA before calculating pixel MD5.
We name our .pngs by pixel hashes for gold. For 8888 images, we're hashing
SkPMColors, which have platform-dependent order: BGRA on Linux and Windows,
RGBA otherwise. This means we can end up with pixel-identical pngs with
different hashes, which is confusing.
This CL standardizes on RGBA for 8888 configs, arbitrarily chosen so that
Android ends up a no-op. Long-term, this should eliminate most of the
0-pixel-diff problems we see on gold.skia.org. There are other ways to end up
with the same .png from different SkBitmaps (think, red 565 square vs. red 8888
square) but they're rather less common / likely.
This will temporarily create a giant 0-pixel-diff problem on gold.skia.org.
Any Linux or Windows images which are not already pixel-identical to a Mac or
Android image should show up as untriaged hashes that are pixel-identical to
their version just before landing (we're only changing the hash, not the .png).
This means anything vaguely platform dependent (fonts, GPUs) will probably show
up as needing a triage but with a zero diff from a previous image.
If this goes well, we might do the same for 565. Just want to leave them out
for now to cut down on the triaging I need to do in one go.
BUG=skia:
Review URL: https://codereview.chromium.org/1226933005
2015-07-08 14:25:27 +00:00
|
|
|
}
|
2015-01-27 22:46:26 +00:00
|
|
|
}
|
|
|
|
|
2016-01-05 14:20:20 +00:00
|
|
|
if (!FLAGS_readPath.isEmpty() &&
|
2016-02-25 03:07:07 +00:00
|
|
|
!gGold.contains(Gold(task.sink.tag, task.src.tag,
|
|
|
|
task.src.options, name, md5))) {
|
2016-01-05 14:20:20 +00:00
|
|
|
fail(SkStringPrintf("%s not found for %s %s %s %s in %s",
|
|
|
|
md5.c_str(),
|
2016-02-08 20:39:59 +00:00
|
|
|
task.sink.tag.c_str(),
|
|
|
|
task.src.tag.c_str(),
|
|
|
|
task.src.options.c_str(),
|
2016-01-05 14:20:20 +00:00
|
|
|
name.c_str(),
|
|
|
|
FLAGS_readPath[0]));
|
|
|
|
}
|
2015-01-27 22:46:26 +00:00
|
|
|
|
2016-01-05 14:20:20 +00:00
|
|
|
if (!FLAGS_writePath.isEmpty()) {
|
2016-02-08 20:39:59 +00:00
|
|
|
const char* ext = task.sink->fileExtension();
|
2016-01-05 14:20:20 +00:00
|
|
|
if (data->getLength()) {
|
2016-02-08 20:39:59 +00:00
|
|
|
WriteToDisk(task, md5, ext, data, data->getLength(), nullptr);
|
2016-01-05 14:20:20 +00:00
|
|
|
SkASSERT(bitmap.drawsNothing());
|
|
|
|
} else if (!bitmap.drawsNothing()) {
|
2016-02-08 20:39:59 +00:00
|
|
|
WriteToDisk(task, md5, ext, nullptr, 0, &bitmap);
|
2016-01-05 14:20:20 +00:00
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
}
|
2016-01-05 14:20:20 +00:00
|
|
|
});
|
2015-01-15 18:15:02 +00:00
|
|
|
}
|
2016-02-25 03:07:07 +00:00
|
|
|
done(task.sink.tag.c_str(), task.src.tag.c_str(), task.src.options.c_str(), name.c_str());
|
2014-12-13 00:41:12 +00:00
|
|
|
}
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
static void WriteToDisk(const Task& task,
|
2015-01-27 22:46:26 +00:00
|
|
|
SkString md5,
|
|
|
|
const char* ext,
|
2015-01-15 18:56:12 +00:00
|
|
|
SkStream* data, size_t len,
|
2015-01-27 22:46:26 +00:00
|
|
|
const SkBitmap* bitmap) {
|
Add gamma_correct option field to dm.json
E.g.
{
"max_rss_MB" : 23,
"results" : [
{
"key" : {
"config" : "pdf",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "c5dfb531f4d76c77c3305b6a04733262",
"options" : {
"ext" : "pdf",
"gamma_correct" : false
}
},
{
"key" : {
"config" : "8888",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "6177860ed24106446d3a9087527e67bf",
"options" : {
"ext" : "png",
"gamma_correct" : false
}
},
{
"key" : {
"config" : "f16",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "213f80145953ecd4c71e0612447b2ad9",
"options" : {
"ext" : "png",
"gamma_correct" : true
}
}
]
}
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1741973002
Review URL: https://codereview.chromium.org/1741973002
2016-02-29 15:38:01 +00:00
|
|
|
bool gammaCorrect = false;
|
|
|
|
if (bitmap) {
|
2016-04-06 14:38:23 +00:00
|
|
|
gammaCorrect = SkImageInfoIsGammaCorrect(bitmap->info());
|
Add gamma_correct option field to dm.json
E.g.
{
"max_rss_MB" : 23,
"results" : [
{
"key" : {
"config" : "pdf",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "c5dfb531f4d76c77c3305b6a04733262",
"options" : {
"ext" : "pdf",
"gamma_correct" : false
}
},
{
"key" : {
"config" : "8888",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "6177860ed24106446d3a9087527e67bf",
"options" : {
"ext" : "png",
"gamma_correct" : false
}
},
{
"key" : {
"config" : "f16",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "213f80145953ecd4c71e0612447b2ad9",
"options" : {
"ext" : "png",
"gamma_correct" : true
}
}
]
}
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1741973002
Review URL: https://codereview.chromium.org/1741973002
2016-02-29 15:38:01 +00:00
|
|
|
}
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
JsonWriter::BitmapResult result;
|
2015-04-03 14:24:48 +00:00
|
|
|
result.name = task.src->name();
|
2016-02-25 03:07:07 +00:00
|
|
|
result.config = task.sink.tag;
|
2015-04-03 14:24:48 +00:00
|
|
|
result.sourceType = task.src.tag;
|
|
|
|
result.sourceOptions = task.src.options;
|
|
|
|
result.ext = ext;
|
Add gamma_correct option field to dm.json
E.g.
{
"max_rss_MB" : 23,
"results" : [
{
"key" : {
"config" : "pdf",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "c5dfb531f4d76c77c3305b6a04733262",
"options" : {
"ext" : "pdf",
"gamma_correct" : false
}
},
{
"key" : {
"config" : "8888",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "6177860ed24106446d3a9087527e67bf",
"options" : {
"ext" : "png",
"gamma_correct" : false
}
},
{
"key" : {
"config" : "f16",
"name" : "gamma",
"source_type" : "gm"
},
"md5" : "213f80145953ecd4c71e0612447b2ad9",
"options" : {
"ext" : "png",
"gamma_correct" : true
}
}
]
}
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1741973002
Review URL: https://codereview.chromium.org/1741973002
2016-02-29 15:38:01 +00:00
|
|
|
result.gammaCorrect = gammaCorrect;
|
2015-04-03 14:24:48 +00:00
|
|
|
result.md5 = md5;
|
2015-01-15 18:56:12 +00:00
|
|
|
JsonWriter::AddBitmapResult(result);
|
2015-01-15 16:30:25 +00:00
|
|
|
|
2015-04-07 20:38:48 +00:00
|
|
|
// If an MD5 is uninteresting, we want it noted in the JSON file,
|
|
|
|
// but don't want to dump it out as a .png (or whatever ext is).
|
|
|
|
if (gUninterestingHashes.contains(md5)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
const char* dir = FLAGS_writePath[0];
|
|
|
|
if (0 == strcmp(dir, "@")) { // Needed for iOS.
|
|
|
|
dir = FLAGS_resourcePath[0];
|
|
|
|
}
|
|
|
|
sk_mkdir(dir);
|
|
|
|
|
|
|
|
SkString path;
|
|
|
|
if (FLAGS_nameByHash) {
|
|
|
|
path = SkOSPath::Join(dir, result.md5.c_str());
|
|
|
|
path.append(".");
|
|
|
|
path.append(ext);
|
|
|
|
if (sk_exists(path.c_str())) {
|
|
|
|
return; // Content-addressed. If it exists already, we're done.
|
|
|
|
}
|
|
|
|
} else {
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
path = SkOSPath::Join(dir, task.sink.tag.c_str());
|
2015-01-15 18:56:12 +00:00
|
|
|
sk_mkdir(path.c_str());
|
2015-09-01 21:57:57 +00:00
|
|
|
path = SkOSPath::Join(path.c_str(), task.src.tag.c_str());
|
2015-01-15 18:56:12 +00:00
|
|
|
sk_mkdir(path.c_str());
|
2015-09-01 21:57:57 +00:00
|
|
|
if (strcmp(task.src.options.c_str(), "") != 0) {
|
|
|
|
path = SkOSPath::Join(path.c_str(), task.src.options.c_str());
|
2015-04-03 14:24:48 +00:00
|
|
|
sk_mkdir(path.c_str());
|
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
path = SkOSPath::Join(path.c_str(), task.src->name().c_str());
|
|
|
|
path.append(".");
|
|
|
|
path.append(ext);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bitmap) {
|
2015-08-24 20:27:01 +00:00
|
|
|
if (!dump_png(*bitmap, path.c_str(), result.md5.c_str())) {
|
2015-01-15 18:56:12 +00:00
|
|
|
fail(SkStringPrintf("Can't encode PNG to %s.\n", path.c_str()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
2015-08-24 20:27:01 +00:00
|
|
|
SkFILEWStream file(path.c_str());
|
|
|
|
if (!file.isValid()) {
|
|
|
|
fail(SkStringPrintf("Can't open %s for writing.\n", path.c_str()));
|
|
|
|
return;
|
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
if (!file.writeStream(data, len)) {
|
|
|
|
fail(SkStringPrintf("Can't write to %s.\n", path.c_str()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2015-01-15 18:15:02 +00:00
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
};
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
|
|
|
// Unit tests don't fit so well into the Src/Sink model, so we give them special treatment.
|
|
|
|
|
2016-02-08 20:39:59 +00:00
|
|
|
static SkTDArray<skiatest::Test> gParallelTests, gSerialTests;
|
2015-01-15 18:56:12 +00:00
|
|
|
|
|
|
|
static void gather_tests() {
|
2015-01-20 21:47:23 +00:00
|
|
|
if (!FLAGS_src.contains("tests")) {
|
2015-01-15 18:56:12 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-04-27 15:45:01 +00:00
|
|
|
for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; r = r->next()) {
|
|
|
|
if (!in_shard()) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-01-20 17:30:20 +00:00
|
|
|
// Despite its name, factory() is returning a reference to
|
|
|
|
// link-time static const POD data.
|
|
|
|
const skiatest::Test& test = r->factory();
|
|
|
|
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) {
|
2015-01-15 18:56:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
2015-01-20 17:30:20 +00:00
|
|
|
if (test.needsGpu && gpu_supported()) {
|
2016-02-08 20:39:59 +00:00
|
|
|
(FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test);
|
2015-01-20 17:30:20 +00:00
|
|
|
} else if (!test.needsGpu && FLAGS_cpu) {
|
2016-02-08 20:39:59 +00:00
|
|
|
gParallelTests.push(test);
|
2015-01-15 20:46:02 +00:00
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
}
|
2014-06-30 13:36:31 +00:00
|
|
|
}
|
|
|
|
|
2016-02-08 20:39:59 +00:00
|
|
|
static void run_test(skiatest::Test test) {
|
2015-01-20 17:30:20 +00:00
|
|
|
struct : public skiatest::Reporter {
|
2015-03-26 01:17:31 +00:00
|
|
|
void reportFailed(const skiatest::Failure& failure) override {
|
2015-01-20 17:30:20 +00:00
|
|
|
fail(failure.toString());
|
|
|
|
JsonWriter::AddTestFailure(failure);
|
|
|
|
}
|
2015-03-26 01:17:31 +00:00
|
|
|
bool allowExtendedTest() const override {
|
2015-01-20 17:30:20 +00:00
|
|
|
return FLAGS_pathOpsExtended;
|
|
|
|
}
|
2015-03-26 01:17:31 +00:00
|
|
|
bool verbose() const override { return FLAGS_veryVerbose; }
|
2015-01-20 17:30:20 +00:00
|
|
|
} reporter;
|
2015-06-12 19:06:22 +00:00
|
|
|
|
2016-02-25 03:07:07 +00:00
|
|
|
if (!FLAGS_dryRun && !is_blacklisted("_", "tests", "_", test.name)) {
|
2016-02-08 20:39:59 +00:00
|
|
|
start("unit", "test", "", test.name);
|
2015-01-21 23:50:13 +00:00
|
|
|
GrContextFactory factory;
|
2016-02-08 20:39:59 +00:00
|
|
|
test.proc(&reporter, &factory);
|
2014-02-26 23:01:57 +00:00
|
|
|
}
|
2016-02-25 03:07:07 +00:00
|
|
|
done("unit", "test", "", test.name);
|
2015-01-15 18:15:02 +00:00
|
|
|
}
|
2014-02-26 23:01:57 +00:00
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
2016-02-24 20:28:32 +00:00
|
|
|
DEFINE_int32(status_sec, 15, "Print status this often (and if we crash).");
|
|
|
|
|
|
|
|
SkThread* start_status_thread() {
|
|
|
|
auto thread = new SkThread([] (void*) {
|
|
|
|
for (;;) {
|
|
|
|
print_status();
|
|
|
|
#if defined(SK_BUILD_FOR_WIN)
|
|
|
|
Sleep(FLAGS_status_sec * 1000);
|
|
|
|
#else
|
|
|
|
sleep(FLAGS_status_sec);
|
|
|
|
#endif
|
2015-03-12 14:16:56 +00:00
|
|
|
}
|
2016-02-24 20:28:32 +00:00
|
|
|
});
|
|
|
|
thread->start();
|
|
|
|
return thread;
|
2015-03-12 13:28:54 +00:00
|
|
|
}
|
|
|
|
|
2015-06-10 16:31:09 +00:00
|
|
|
#define PORTABLE_FONT_PREFIX "Toy Liberation "
|
|
|
|
|
2016-05-31 18:42:36 +00:00
|
|
|
static sk_sp<SkTypeface> create_from_name(const char familyName[], SkFontStyle style) {
|
2015-06-10 16:31:09 +00:00
|
|
|
if (familyName && strlen(familyName) > sizeof(PORTABLE_FONT_PREFIX)
|
|
|
|
&& !strncmp(familyName, PORTABLE_FONT_PREFIX, sizeof(PORTABLE_FONT_PREFIX) - 1)) {
|
2015-07-24 19:09:25 +00:00
|
|
|
return sk_tool_utils::create_portable_typeface(familyName, style);
|
2015-06-10 16:31:09 +00:00
|
|
|
}
|
2015-08-27 14:41:13 +00:00
|
|
|
return nullptr;
|
2015-06-10 16:31:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef PORTABLE_FONT_PREFIX
|
|
|
|
|
2016-05-31 18:42:36 +00:00
|
|
|
extern sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char [], SkFontStyle );
|
2015-06-10 16:31:09 +00:00
|
|
|
|
2015-01-15 18:15:02 +00:00
|
|
|
int dm_main();
|
|
|
|
int dm_main() {
|
2016-04-26 21:27:21 +00:00
|
|
|
setbuf(stdout, nullptr);
|
2016-02-23 18:39:36 +00:00
|
|
|
setup_crash_handler();
|
2016-02-24 20:28:32 +00:00
|
|
|
|
2016-03-17 19:53:36 +00:00
|
|
|
if (FLAGS_verbose) {
|
|
|
|
gVLog = stderr;
|
|
|
|
} else if (!FLAGS_writePath.isEmpty()) {
|
2016-03-11 20:59:09 +00:00
|
|
|
sk_mkdir(FLAGS_writePath[0]);
|
2016-07-22 19:23:46 +00:00
|
|
|
gVLog = fopen(SkOSPath::Join(FLAGS_writePath[0], "verbose.log").c_str(), "w");
|
2016-03-08 17:01:39 +00:00
|
|
|
}
|
|
|
|
|
2016-01-22 16:18:14 +00:00
|
|
|
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
|
2015-01-15 18:15:02 +00:00
|
|
|
SkAutoGraphics ag;
|
|
|
|
SkTaskGroup::Enabler enabled(FLAGS_threads);
|
2015-06-10 16:31:09 +00:00
|
|
|
gCreateTypefaceDelegate = &create_from_name;
|
2015-01-15 16:30:25 +00:00
|
|
|
|
2016-02-25 01:59:16 +00:00
|
|
|
{
|
|
|
|
SkString testResourcePath = GetResourcePath("color_wheel.png");
|
|
|
|
SkFILEStream testResource(testResourcePath.c_str());
|
|
|
|
if (!testResource.isValid()) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("Some resources are missing. Do you need to set --resourcePath?\n");
|
2016-02-25 01:59:16 +00:00
|
|
|
}
|
|
|
|
}
|
2015-01-27 22:46:26 +00:00
|
|
|
gather_gold();
|
2015-04-03 21:15:33 +00:00
|
|
|
gather_uninteresting_hashes();
|
2015-01-27 22:46:26 +00:00
|
|
|
|
2016-02-03 20:19:11 +00:00
|
|
|
if (!gather_srcs()) {
|
|
|
|
return 1;
|
|
|
|
}
|
2016-05-09 20:42:16 +00:00
|
|
|
if (!gather_sinks()) {
|
|
|
|
return 1;
|
|
|
|
}
|
2015-01-15 18:56:12 +00:00
|
|
|
gather_tests();
|
2016-02-08 20:39:59 +00:00
|
|
|
gPending = gSrcs.count() * gSinks.count() + gParallelTests.count() + gSerialTests.count();
|
2016-03-08 17:01:39 +00:00
|
|
|
info("%d srcs * %d sinks + %d tests == %d tasks",
|
|
|
|
gSrcs.count(), gSinks.count(), gParallelTests.count() + gSerialTests.count(), gPending);
|
2016-02-24 20:28:32 +00:00
|
|
|
SkAutoTDelete<SkThread> statusThread(start_status_thread());
|
2014-02-26 23:01:57 +00:00
|
|
|
|
2016-02-08 20:39:59 +00:00
|
|
|
// Kick off as much parallel work as we can, making note of any serial work we'll need to do.
|
|
|
|
SkTaskGroup parallel;
|
|
|
|
SkTArray<Task> serial;
|
|
|
|
|
|
|
|
for (auto& sink : gSinks)
|
|
|
|
for (auto& src : gSrcs) {
|
2016-02-25 03:07:07 +00:00
|
|
|
if (src->veto(sink->flags()) ||
|
|
|
|
is_blacklisted(sink.tag.c_str(), src.tag.c_str(),
|
|
|
|
src.options.c_str(), src->name().c_str())) {
|
2016-06-10 20:56:35 +00:00
|
|
|
SkAutoMutexAcquire lock(gMutex);
|
2016-02-25 03:07:07 +00:00
|
|
|
gPending--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-02-08 20:39:59 +00:00
|
|
|
Task task(src, sink);
|
|
|
|
if (src->serial() || sink->serial()) {
|
|
|
|
serial.push_back(task);
|
|
|
|
} else {
|
|
|
|
parallel.add([task] { Task::Run(task); });
|
2015-01-15 20:46:02 +00:00
|
|
|
}
|
2015-01-21 23:50:13 +00:00
|
|
|
}
|
2016-02-08 20:39:59 +00:00
|
|
|
for (auto test : gParallelTests) {
|
|
|
|
parallel.add([test] { run_test(test); });
|
|
|
|
}
|
|
|
|
|
|
|
|
// With the parallel work running, run serial tasks and tests here on main thread.
|
|
|
|
for (auto task : serial) { Task::Run(task); }
|
|
|
|
for (auto test : gSerialTests) { run_test(test); }
|
|
|
|
|
|
|
|
// Wait for any remaining parallel work to complete (including any spun off of serial tasks).
|
|
|
|
parallel.wait();
|
2016-01-05 14:20:20 +00:00
|
|
|
gDefinitelyThreadSafeWork.wait();
|
|
|
|
|
2016-02-25 02:00:23 +00:00
|
|
|
// We'd better have run everything.
|
|
|
|
SkASSERT(gPending == 0);
|
2016-02-26 23:53:06 +00:00
|
|
|
// Make sure we've flushed all our results to disk.
|
|
|
|
JsonWriter::DumpJson();
|
2016-02-25 02:00:23 +00:00
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
// At this point we're back in single-threaded land.
|
2015-06-15 13:48:30 +00:00
|
|
|
sk_tool_utils::release_portable_typefaces();
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
if (gFailures.count() > 0) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("Failures:\n");
|
2015-01-15 18:56:12 +00:00
|
|
|
for (int i = 0; i < gFailures.count(); i++) {
|
2016-03-08 17:01:39 +00:00
|
|
|
info("\t%s\n", gFailures[i].c_str());
|
2015-01-15 18:56:12 +00:00
|
|
|
}
|
2016-03-08 17:01:39 +00:00
|
|
|
info("%d failures\n", gFailures.count());
|
2015-01-15 18:56:12 +00:00
|
|
|
return 1;
|
2014-12-13 00:41:12 +00:00
|
|
|
}
|
2016-02-24 20:28:32 +00:00
|
|
|
|
|
|
|
#ifdef SK_PDF_IMAGE_STATS
|
2015-10-01 14:28:13 +00:00
|
|
|
SkPDFImageDumpStats();
|
2016-02-24 20:28:32 +00:00
|
|
|
#endif // SK_PDF_IMAGE_STATS
|
|
|
|
|
|
|
|
print_status();
|
2016-03-08 17:01:39 +00:00
|
|
|
info("Finished!\n");
|
2015-01-15 18:56:12 +00:00
|
|
|
return 0;
|
2013-10-16 13:02:15 +00:00
|
|
|
}
|
2014-11-13 16:06:40 +00:00
|
|
|
|
Generate list of GPU contexts outside SurfaceTest tests
Add support for feeding the tests with contexts directly to the unit
test framework.
This fixes the problem where tests are more complex than needed just in
order to run the test code with multiple backends.
Also makes it possible to change the logic how contexts are
created. Instead of direct numbering, the different testable contexts
may be generated from filtered cross-product of context options. For
example: currently NVPR is a type of context. However, it could be also
an on/off feature of any context. In order to test this kind of context,
the enumeration can not be just of context type. It's simpler
to move the enumeration out of the tests.
A test targeting both normal and GPU backends would look like:
static void test_obj_behavior(skiatest::Reporter* reporter,
SkObj* obj, [other params] ) {
... test with obj and param ..
}
DEF_TEST(ObjBehavior, reporter) {
for (auto& object : generate_object) {
for (auto& other_param : generate_other_variant) {
test_obj_behavior(reporter, object, other_param);
}
}
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_ALL_CONTEXTS(ObjBehavior_Gpu, reporter, context) {
for (auto& object : generate_gpu_object) {
for (auto& other_param : generate_other_variant) {
test_obj_behavior(reporter, object, other_param);
}
}
}
#endif
Uses the feature in SurfaceTests as an example.
Moves SkSurface -related tests from ImageTest to SurfaceTest.
BUG=skia:2992
Review URL: https://codereview.chromium.org/1446453003
2015-11-20 21:32:24 +00:00
|
|
|
// TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
|
|
|
|
// Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
|
|
|
|
namespace skiatest {
|
2016-04-06 21:02:39 +00:00
|
|
|
|
Generate list of GPU contexts outside SurfaceTest tests
Add support for feeding the tests with contexts directly to the unit
test framework.
This fixes the problem where tests are more complex than needed just in
order to run the test code with multiple backends.
Also makes it possible to change the logic how contexts are
created. Instead of direct numbering, the different testable contexts
may be generated from filtered cross-product of context options. For
example: currently NVPR is a type of context. However, it could be also
an on/off feature of any context. In order to test this kind of context,
the enumeration can not be just of context type. It's simpler
to move the enumeration out of the tests.
A test targeting both normal and GPU backends would look like:
static void test_obj_behavior(skiatest::Reporter* reporter,
SkObj* obj, [other params] ) {
... test with obj and param ..
}
DEF_TEST(ObjBehavior, reporter) {
for (auto& object : generate_object) {
for (auto& other_param : generate_other_variant) {
test_obj_behavior(reporter, object, other_param);
}
}
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_ALL_CONTEXTS(ObjBehavior_Gpu, reporter, context) {
for (auto& object : generate_gpu_object) {
for (auto& other_param : generate_other_variant) {
test_obj_behavior(reporter, object, other_param);
}
}
}
#endif
Uses the feature in SurfaceTests as an example.
Moves SkSurface -related tests from ImageTest to SurfaceTest.
BUG=skia:2992
Review URL: https://codereview.chromium.org/1446453003
2015-11-20 21:32:24 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2016-04-06 21:02:39 +00:00
|
|
|
bool IsGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
|
|
|
|
return kOpenGL_GrBackend == GrContextFactory::ContextTypeBackend(type);
|
|
|
|
}
|
2016-04-11 21:21:33 +00:00
|
|
|
bool IsVulkanContextType(sk_gpu_test::GrContextFactory::ContextType type) {
|
|
|
|
return kVulkan_GrBackend == GrContextFactory::ContextTypeBackend(type);
|
|
|
|
}
|
2016-04-06 21:02:39 +00:00
|
|
|
bool IsRenderingGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
|
|
|
|
return IsGLContextType(type) && GrContextFactory::IsRenderingContext(type);
|
|
|
|
}
|
|
|
|
bool IsNullGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
|
|
|
|
return type == GrContextFactory::kNullGL_ContextType;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
bool IsGLContextType(int) { return false; }
|
2016-04-11 21:21:33 +00:00
|
|
|
bool IsVulkanContextType(int) { return false; }
|
2016-04-06 21:02:39 +00:00
|
|
|
bool IsRenderingGLContextType(int) { return false; }
|
|
|
|
bool IsNullGLContextType(int) { return false; }
|
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
Committed: https://skia.googlesource.com/skia/+/9ebc3f0ee6db215dde461dc4777d85988cf272dd
Review URL: https://codereview.chromium.org/1490113005
2015-12-23 09:33:00 +00:00
|
|
|
#endif
|
2016-04-06 21:02:39 +00:00
|
|
|
|
|
|
|
void RunWithGPUTestContexts(GrContextTestFn* test, GrContextTypeFilterFn* contextTypeFilter,
|
|
|
|
Reporter* reporter, GrContextFactory* factory) {
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
|
|
|
|
for (int typeInt = 0; typeInt < GrContextFactory::kContextTypeCnt; ++typeInt) {
|
|
|
|
GrContextFactory::ContextType contextType = (GrContextFactory::ContextType) typeInt;
|
|
|
|
ContextInfo ctxInfo = factory->getContextInfo(contextType);
|
2016-04-11 21:40:50 +00:00
|
|
|
if (contextTypeFilter && !(*contextTypeFilter)(contextType)) {
|
Generate list of GPU contexts outside SurfaceTest tests
Add support for feeding the tests with contexts directly to the unit
test framework.
This fixes the problem where tests are more complex than needed just in
order to run the test code with multiple backends.
Also makes it possible to change the logic how contexts are
created. Instead of direct numbering, the different testable contexts
may be generated from filtered cross-product of context options. For
example: currently NVPR is a type of context. However, it could be also
an on/off feature of any context. In order to test this kind of context,
the enumeration can not be just of context type. It's simpler
to move the enumeration out of the tests.
A test targeting both normal and GPU backends would look like:
static void test_obj_behavior(skiatest::Reporter* reporter,
SkObj* obj, [other params] ) {
... test with obj and param ..
}
DEF_TEST(ObjBehavior, reporter) {
for (auto& object : generate_object) {
for (auto& other_param : generate_other_variant) {
test_obj_behavior(reporter, object, other_param);
}
}
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_ALL_CONTEXTS(ObjBehavior_Gpu, reporter, context) {
for (auto& object : generate_gpu_object) {
for (auto& other_param : generate_other_variant) {
test_obj_behavior(reporter, object, other_param);
}
}
}
#endif
Uses the feature in SurfaceTests as an example.
Moves SkSurface -related tests from ImageTest to SurfaceTest.
BUG=skia:2992
Review URL: https://codereview.chromium.org/1446453003
2015-11-20 21:32:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
2016-04-06 21:02:39 +00:00
|
|
|
// Use "native" instead of explicitly trying OpenGL and OpenGL ES. Do not use GLES on,
|
|
|
|
// desktop since tests do not account for not fixing http://skbug.com/2809
|
|
|
|
if (contextType == GrContextFactory::kGL_ContextType ||
|
|
|
|
contextType == GrContextFactory::kGLES_ContextType) {
|
|
|
|
if (contextType != GrContextFactory::kNativeGL_ContextType) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2016-05-11 13:33:06 +00:00
|
|
|
if (ctxInfo.grContext()) {
|
2016-04-05 19:59:06 +00:00
|
|
|
(*test)(reporter, ctxInfo);
|
2015-12-10 14:28:13 +00:00
|
|
|
}
|
2016-04-05 19:59:06 +00:00
|
|
|
ctxInfo = factory->getContextInfo(contextType,
|
2016-04-05 18:06:27 +00:00
|
|
|
GrContextFactory::kEnableNVPR_ContextOptions);
|
2016-05-11 13:33:06 +00:00
|
|
|
if (ctxInfo.grContext()) {
|
2016-04-05 19:59:06 +00:00
|
|
|
(*test)(reporter, ctxInfo);
|
Generate list of GPU contexts outside SurfaceTest tests
Add support for feeding the tests with contexts directly to the unit
test framework.
This fixes the problem where tests are more complex than needed just in
order to run the test code with multiple backends.
Also makes it possible to change the logic how contexts are
created. Instead of direct numbering, the different testable contexts
may be generated from filtered cross-product of context options. For
example: currently NVPR is a type of context. However, it could be also
an on/off feature of any context. In order to test this kind of context,
the enumeration can not be just of context type. It's simpler
to move the enumeration out of the tests.
A test targeting both normal and GPU backends would look like:
static void test_obj_behavior(skiatest::Reporter* reporter,
SkObj* obj, [other params] ) {
... test with obj and param ..
}
DEF_TEST(ObjBehavior, reporter) {
for (auto& object : generate_object) {
for (auto& other_param : generate_other_variant) {
test_obj_behavior(reporter, object, other_param);
}
}
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_ALL_CONTEXTS(ObjBehavior_Gpu, reporter, context) {
for (auto& object : generate_gpu_object) {
for (auto& other_param : generate_other_variant) {
test_obj_behavior(reporter, object, other_param);
}
}
}
#endif
Uses the feature in SurfaceTests as an example.
Moves SkSurface -related tests from ImageTest to SurfaceTest.
BUG=skia:2992
Review URL: https://codereview.chromium.org/1446453003
2015-11-20 21:32:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} // namespace skiatest
|
|
|
|
|
2015-04-02 19:16:36 +00:00
|
|
|
#if !defined(SK_BUILD_FOR_IOS)
|
2014-11-13 16:06:40 +00:00
|
|
|
int main(int argc, char** argv) {
|
|
|
|
SkCommandLineFlags::Parse(argc, argv);
|
|
|
|
return dm_main();
|
|
|
|
}
|
|
|
|
#endif
|