aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpucts/gm_runner.h
blob: cd0d7d32bb06ffa1f091c58f5b32a39ef8c8561d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef gm_runner_DEFINED
#define gm_runner_DEFINED

#include <memory>
#include <string>
#include <vector>

#include "gm_knowledge.h"

/**
A Skia GM is a single rendering test that can be executed on any Skia backend Canvas.
*/
namespace skiagm {
   class GM;
}

namespace sk_gpu_test {
    class GrContextFactory;
}

namespace gm_runner {

using GMFactory = skiagm::GM* (*)(void*);

enum class SkiaBackend {
    kGL,
    kGLES,
    kVulkan,
};

bool BackendSupported(SkiaBackend);

/**
@return a list of all Skia GMs in lexicographic order.
*/
std::vector<GMFactory> GetGMFactories();

/**
@return a descriptive name for the GM.
*/
std::string GetGMName(GMFactory);
/**
@return a descriptive name for the backend.
*/
const char* GetBackendName(SkiaBackend);

/**
Execute the given GM on the given Skia backend.  Then copy the pixels into the
storage (overwriting existing contents of storage).

@return the rendered image.  Return a null ImageData on error.
*/
GMK_ImageData Evaluate(SkiaBackend,
                       GMFactory,
                       std::vector<uint32_t>* storage);

}  // namespace gm_runner

#endif  // gm_runner_DEFINED