2019-03-20 15:50:33 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SK_COMMON_FLAGS_CONFIG_H
|
|
|
|
#define SK_COMMON_FLAGS_CONFIG_H
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tools/flags/CommandLineFlags.h"
|
|
|
|
#include "tools/gpu/GrContextFactory.h"
|
2019-03-20 15:50:33 +00:00
|
|
|
|
|
|
|
DECLARE_string(config);
|
|
|
|
|
|
|
|
class SkCommandLineConfigGpu;
|
|
|
|
class SkCommandLineConfigSvg;
|
|
|
|
|
|
|
|
// SkCommandLineConfig represents a Skia rendering configuration string.
|
|
|
|
// The string has following form:
|
|
|
|
// tag:
|
|
|
|
// [via-]*backend
|
|
|
|
// where 'backend' consists of chars excluding hyphen
|
|
|
|
// and each 'via' consists of chars excluding hyphen.
|
|
|
|
class SkCommandLineConfig {
|
|
|
|
public:
|
|
|
|
SkCommandLineConfig(const SkString& tag,
|
|
|
|
const SkString& backend,
|
|
|
|
const SkTArray<SkString>& viaParts);
|
|
|
|
virtual ~SkCommandLineConfig();
|
|
|
|
virtual const SkCommandLineConfigGpu* asConfigGpu() const { return nullptr; }
|
|
|
|
virtual const SkCommandLineConfigSvg* asConfigSvg() const { return nullptr; }
|
|
|
|
const SkString& getTag() const { return fTag; }
|
|
|
|
const SkString& getBackend() const { return fBackend; }
|
|
|
|
const SkTArray<SkString>& getViaParts() const { return fViaParts; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
SkString fTag;
|
|
|
|
SkString fBackend;
|
|
|
|
SkTArray<SkString> fViaParts;
|
|
|
|
};
|
|
|
|
|
|
|
|
// SkCommandLineConfigGpu is a SkCommandLineConfig that extracts information out of the backend
|
|
|
|
// part of the tag. It is constructed tags that have:
|
|
|
|
// * backends of form "gpu[option=value,option2=value,...]"
|
|
|
|
// * backends that represent a shorthand of above (such as "glmsaa16" representing
|
|
|
|
// "gpu(api=gl,samples=16)")
|
|
|
|
class SkCommandLineConfigGpu : public SkCommandLineConfig {
|
|
|
|
public:
|
|
|
|
enum class SurfType { kDefault, kBackendTexture, kBackendRenderTarget };
|
|
|
|
typedef sk_gpu_test::GrContextFactory::ContextType ContextType;
|
|
|
|
typedef sk_gpu_test::GrContextFactory::ContextOverrides ContextOverrides;
|
|
|
|
|
|
|
|
SkCommandLineConfigGpu(const SkString& tag,
|
|
|
|
const SkTArray<SkString>& viaParts,
|
|
|
|
ContextType contextType,
|
2020-08-26 19:27:03 +00:00
|
|
|
bool fakeGLESVer2,
|
2021-03-17 02:49:15 +00:00
|
|
|
uint32_t surfaceFlags,
|
2019-03-20 15:50:33 +00:00
|
|
|
int samples,
|
|
|
|
SkColorType colorType,
|
|
|
|
SkAlphaType alphaType,
|
|
|
|
sk_sp<SkColorSpace> colorSpace,
|
|
|
|
bool useStencilBuffers,
|
|
|
|
bool testThreading,
|
2019-04-03 17:04:16 +00:00
|
|
|
int testPersistentCache,
|
2019-09-06 18:42:43 +00:00
|
|
|
bool testPrecompile,
|
2020-02-19 19:14:47 +00:00
|
|
|
bool useDDLSink,
|
2020-06-15 17:12:32 +00:00
|
|
|
bool OOPRish,
|
2019-03-20 15:50:33 +00:00
|
|
|
SurfType);
|
|
|
|
|
|
|
|
const SkCommandLineConfigGpu* asConfigGpu() const override { return this; }
|
|
|
|
ContextType getContextType() const { return fContextType; }
|
|
|
|
ContextOverrides getContextOverrides() const { return fContextOverrides; }
|
2021-03-17 02:49:15 +00:00
|
|
|
uint32_t getSurfaceFlags() const { return fSurfaceFlags; }
|
2019-03-20 15:50:33 +00:00
|
|
|
int getSamples() const { return fSamples; }
|
|
|
|
SkColorType getColorType() const { return fColorType; }
|
|
|
|
SkAlphaType getAlphaType() const { return fAlphaType; }
|
|
|
|
SkColorSpace* getColorSpace() const { return fColorSpace.get(); }
|
|
|
|
bool getTestThreading() const { return fTestThreading; }
|
2019-04-03 17:04:16 +00:00
|
|
|
int getTestPersistentCache() const { return fTestPersistentCache; }
|
2019-09-06 18:42:43 +00:00
|
|
|
bool getTestPrecompile() const { return fTestPrecompile; }
|
2020-02-19 19:14:47 +00:00
|
|
|
bool getUseDDLSink() const { return fUseDDLSink; }
|
2020-06-15 17:12:32 +00:00
|
|
|
bool getOOPRish() const { return fOOPRish; }
|
2019-03-20 15:50:33 +00:00
|
|
|
SurfType getSurfType() const { return fSurfType; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
ContextType fContextType;
|
|
|
|
ContextOverrides fContextOverrides;
|
2021-03-17 02:49:15 +00:00
|
|
|
uint32_t fSurfaceFlags;
|
2019-03-20 15:50:33 +00:00
|
|
|
int fSamples;
|
|
|
|
SkColorType fColorType;
|
|
|
|
SkAlphaType fAlphaType;
|
|
|
|
sk_sp<SkColorSpace> fColorSpace;
|
|
|
|
bool fTestThreading;
|
2019-04-03 17:04:16 +00:00
|
|
|
int fTestPersistentCache;
|
2019-09-06 18:42:43 +00:00
|
|
|
bool fTestPrecompile;
|
2020-02-19 19:14:47 +00:00
|
|
|
bool fUseDDLSink;
|
2020-06-15 17:12:32 +00:00
|
|
|
bool fOOPRish;
|
2019-03-20 15:50:33 +00:00
|
|
|
SurfType fSurfType;
|
|
|
|
};
|
|
|
|
|
|
|
|
// SkCommandLineConfigSvg is a SkCommandLineConfig that extracts information out of the backend
|
|
|
|
// part of the tag. It is constructed tags that have:
|
|
|
|
// * backends of form "svg[option=value,option2=value,...]"
|
|
|
|
class SkCommandLineConfigSvg : public SkCommandLineConfig {
|
|
|
|
public:
|
|
|
|
SkCommandLineConfigSvg(const SkString& tag, const SkTArray<SkString>& viaParts, int pageIndex);
|
|
|
|
const SkCommandLineConfigSvg* asConfigSvg() const override { return this; }
|
|
|
|
|
|
|
|
int getPageIndex() const { return fPageIndex; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int fPageIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef SkTArray<std::unique_ptr<SkCommandLineConfig>, true> SkCommandLineConfigArray;
|
|
|
|
void ParseConfigs(const CommandLineFlags::StringArray& configList,
|
|
|
|
SkCommandLineConfigArray* outResult);
|
|
|
|
|
|
|
|
#endif
|