skia2/tools/flags/SkCommonFlagsConfig.h
csmartdalton e0d362929d Add test configs for instanced rendering
Adds the following configs and enables them on select bots:

  glinst, glinst4, glinstdit4, glinst16, glinstdit16,
  esinst, esinst4, esinstdit4

Makes general changes to GrContextOptions, GrCaps, etc. to facilitate
this.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2182783004

Review-Url: https://codereview.chromium.org/2182783004
2016-07-29 08:14:20 -07:00

82 lines
2.8 KiB
C++

/*
* 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
#include "SkCommandLineFlags.h"
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
#endif
DECLARE_string(config);
#if SK_SUPPORT_GPU
class SkCommandLineConfigGpu;
#endif
// SkCommandLineConfig represents a Skia rendering configuration string.
// The string has following form:
// tag:
// [via-]*backend
// where 'backend' consists of chars excluding hyphen or "angle-gl"
// and each 'via' consists of chars excluding hyphen.
class SkCommandLineConfig {
public:
SkCommandLineConfig(const SkString& tag, const SkString& backend,
const SkTArray<SkString>& viaParts);
virtual ~SkCommandLineConfig();
#if SK_SUPPORT_GPU
virtual const SkCommandLineConfigGpu* asConfigGpu() const { return nullptr; }
#endif
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;
};
#if SK_SUPPORT_GPU
// 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 "msaa16" representing "gpu(samples=16)")
class SkCommandLineConfigGpu : public SkCommandLineConfig {
public:
typedef sk_gpu_test::GrContextFactory::ContextType ContextType;
SkCommandLineConfigGpu(const SkString& tag, const SkTArray<SkString>& viaParts,
ContextType contextType, bool useNVPR, bool useInstanced, bool useDIText,
int samples, SkColorType colorType, sk_sp<SkColorSpace> colorSpace);
const SkCommandLineConfigGpu* asConfigGpu() const override { return this; }
ContextType getContextType() const { return fContextType; }
bool getUseNVPR() const { return fUseNVPR; }
bool getUseInstanced() const { return fUseInstanced; }
bool getUseDIText() const { return fUseDIText; }
int getSamples() const { return fSamples; }
SkColorType getColorType() const { return fColorType; }
SkColorSpace* getColorSpace() const { return fColorSpace.get(); }
private:
ContextType fContextType;
bool fUseNVPR;
bool fUseInstanced;
bool fUseDIText;
int fSamples;
SkColorType fColorType;
sk_sp<SkColorSpace> fColorSpace;
};
#endif
typedef SkTArray<SkAutoTDelete<SkCommandLineConfig>, true> SkCommandLineConfigArray;
void ParseConfigs(const SkCommandLineFlags::StringArray& configList,
SkCommandLineConfigArray* outResult);
#endif