Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
SkQP Class Reference

#include <skqp.h>

Classes

struct  SkSLErrorTest
 

Public Types

using UnitTest = const skiatest::Test *
 

Public Member Functions

 SkQP ()
 
 ~SkQP ()
 
void init (SkQPAssetManager *assetManager, const char *reportDirectory)
 
std::vector< std::string > executeTest (UnitTest)
 
void makeReport ()
 
const std::vector< UnitTest > & getUnitTests () const
 
const std::vector< SkSLErrorTest > & getSkSLErrorTests () const
 

Static Public Member Functions

static const char * GetUnitTestName (UnitTest)
 

Detailed Description

Definition at line 42 of file skqp.h.

Member Typedef Documentation

◆ UnitTest

Definition at line 44 of file skqp.h.

Constructor & Destructor Documentation

◆ SkQP()

SkQP::SkQP ( )

Definition at line 116 of file skqp.cpp.

116{}

◆ ~SkQP()

SkQP::~SkQP ( )

Definition at line 118 of file skqp.cpp.

118{}

Member Function Documentation

◆ executeTest()

std::vector< std::string > SkQP::executeTest ( SkQP::UnitTest  test)
Returns
a (hopefully empty) list of errors produced by this unit test.

Definition at line 147 of file skqp.cpp.

147 {
148 struct : public skiatest::Reporter {
149 std::vector<std::string> fErrors;
150 void reportFailed(const skiatest::Failure& failure) override {
151 SkString desc = failure.toString();
152 fErrors.push_back(std::string(desc.c_str(), desc.size()));
153 }
154 } r;
155
156 if (test->fTestType == skiatest::TestType::kGanesh) {
158 if (test->fCTSEnforcement.eval(fEnforcedAndroidAPILevel) ==
161 }
162 if (test->fGaneshContextOptionsProc) {
163 test->fGaneshContextOptionsProc(&options);
164 }
165 test->ganesh(&r, options);
166 }
167#ifdef SK_GRAPHITE
168 else if (test->fTestType == skiatest::TestType::kGraphite) {
170 if (test->fCTSEnforcement.eval(fEnforcedAndroidAPILevel) ==
173 }
174 if (test->fGraphiteContextOptionsProc) {
175 test->fGraphiteContextOptionsProc(&options.fContextOptions);
176 }
177 test->graphite(&r, options);
178 }
179#endif
180
181 fTestResults.push_back(TestResult{test->fName, r.fErrors});
182 return r.fErrors;
183}
const char * options
bool fDisableDriverCorrectnessWorkarounds
SkString toString() const
Definition Test.cpp:41
skgpu::graphite::ContextOptions fContextOptions
Definition TestOptions.h:22

◆ getSkSLErrorTests()

const std::vector< SkSLErrorTest > & SkQP::getSkSLErrorTests ( ) const
inline
Returns
a sorted list of all SkSL error tests

Definition at line 77 of file skqp.h.

77{ return fSkSLErrorTests; }

◆ GetUnitTestName()

const char * SkQP::GetUnitTestName ( SkQP::UnitTest  t)
static

These functions provide a descriptive name for the given value.

Definition at line 114 of file skqp.cpp.

114{ return t->fName; }
const char * fName
Definition Test.h:146

◆ getUnitTests()

const std::vector< UnitTest > & SkQP::getUnitTests ( ) const
inline
Returns
a sorted list of all Skia GPU unit tests

Definition at line 74 of file skqp.h.

74{ return fUnitTests; }

◆ init()

void SkQP::init ( SkQPAssetManager assetManager,
const char *  reportDirectory 
)

Initialize Skia and the SkQP. Should be executed only once.

Parameters
assetManager- provides assets for the models. Does not take ownership.
reportDirectory- where to write out report.

Definition at line 120 of file skqp.cpp.

120 {
121 SkASSERT_RELEASE(assetManager);
122 fReportDirectory = reportDirectory;
123
126
127#ifdef SK_BUILD_FOR_ANDROID
128 // ro.vendor.api_level contains the minAPI level based on the order defined in
129 // docs.partner.android.com/gms/building/integrating/extending-os-upgrade-support-windows
130 // 1. board's current api level (for boards that have been upgraded by the SoC vendor)
131 // 2. board's first api level (for devices that initially shipped with an older version)
132 // 3. product's first api level
133 // 4. product's current api level
134 char minAPIVersionStr[PROP_VALUE_MAX];
135 int strLength = __system_property_get("ro.vendor.api_level", minAPIVersionStr);
136 if (strLength != 0) {
137 fEnforcedAndroidAPILevel = atoi(minAPIVersionStr);
138 }
139#endif
140
141 fUnitTests = get_unit_tests(fEnforcedAndroidAPILevel);
142 fSkSLErrorTests = get_sksl_error_tests(assetManager, fEnforcedAndroidAPILevel);
143
144 printBackendInfo((fReportDirectory + "/grdump.txt").c_str());
145}
#define SkASSERT_RELEASE(cond)
Definition SkAssert.h:100
static void Init()
void UsePortableFontMgr()
static std::vector< SkQP::UnitTest > get_unit_tests(int enforcedAndroidAPILevel)
Definition skqp.cpp:43
static std::vector< SkQP::SkSLErrorTest > get_sksl_error_tests(SkQPAssetManager *assetManager, int enforcedAndroidAPILevel)
Definition skqp.cpp:70

◆ makeReport()

void SkQP::makeReport ( )

Call this after running all checks to write a report into the given report directory.

Definition at line 192 of file skqp.cpp.

192 {
193 if (!sk_isdir(fReportDirectory.c_str())) {
194 SkDebugf("Report destination does not exist: '%s'\n", fReportDirectory.c_str());
195 return;
196 }
197 SkFILEWStream report(SkOSPath::Join(fReportDirectory.c_str(), kUnitTestReportPath).c_str());
198 SkASSERT_RELEASE(report.isValid());
199 for (const SkQP::TestResult& result : fTestResults) {
200 report.writeText(result.name.c_str());
201 if (result.errors.empty()) {
202 report.writeText(" PASSED\n* * *\n");
203 } else {
204 write(&report, SkStringPrintf(" FAILED (%zu errors)\n", result.errors.size()));
205 for (const std::string& err : result.errors) {
206 write(&report, err);
207 report.newline();
208 }
209 report.writeText("* * *\n");
210 }
211 }
212}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
bool sk_isdir(const char *path)
SK_API SkString static SkString SkStringPrintf()
Definition SkString.h:287
static SkString Join(const char *rootPath, const char *relativePath)
Definition SkOSPath.cpp:14
const char * c_str() const
Definition SkString.h:133
GAsyncResult * result
void write(SkWStream *wStream, const T &text)
Definition skqp.cpp:188
static constexpr char kUnitTestReportPath[]
Definition skqp.cpp:40

The documentation for this class was generated from the following files: