aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-04-05 11:06:27 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-05 11:06:27 -0700
commit85b4b53e78dcdeae2a51935ca5e214b0f1a06492 (patch)
tree909cb8ef0862154b2e6bc6c66e0e40cd5d018bae /dm
parent3a15fd4a9a019dc781368c26499ff899c2f03e3f (diff)
Rename enums in GrContextFactory to remove "GL"
Also, remove kNative as a separate context type and instead make it an alias for kGL or kGLES based on OS. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1845923004 Committed: https://skia.googlesource.com/skia/+/2d9c6f81353597aebf5934547e5cba7a872196fb Review URL: https://codereview.chromium.org/1845923004
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp45
-rw-r--r--dm/DMGpuSupport.h38
-rw-r--r--dm/DMSrcSink.cpp4
-rw-r--r--dm/DMSrcSink.h8
4 files changed, 49 insertions, 46 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 97b6eb8f6a..00cb279e81 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -814,17 +814,17 @@ static Sink* create_sink(const SkCommandLineConfig* config) {
#if SK_SUPPORT_GPU
if (gpu_supported()) {
if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) {
- GrContextFactory::GLContextType contextType = gpuConfig->getContextType();
- GrContextFactory::GLContextOptions contextOptions =
- GrContextFactory::kNone_GLContextOptions;
+ GrContextFactory::ContextType contextType = gpuConfig->getContextType();
+ GrContextFactory::ContextOptions contextOptions =
+ GrContextFactory::kNone_ContextOptions;
if (gpuConfig->getUseNVPR()) {
- contextOptions = static_cast<GrContextFactory::GLContextOptions>(
- contextOptions | GrContextFactory::kEnableNVPR_GLContextOptions);
+ contextOptions = static_cast<GrContextFactory::ContextOptions>(
+ contextOptions | GrContextFactory::kEnableNVPR_ContextOptions);
}
if (kSRGB_SkColorProfileType == gpuConfig->getProfileType() ||
kRGBA_F16_SkColorType == gpuConfig->getColorType()) {
- contextOptions = static_cast<GrContextFactory::GLContextOptions>(
- contextOptions | GrContextFactory::kRequireSRGBSupport_GLContextOptions);
+ contextOptions = static_cast<GrContextFactory::ContextOptions>(
+ contextOptions | GrContextFactory::kRequireSRGBSupport_ContextOptions);
}
GrContextFactory testFactory;
if (!testFactory.get(contextType, contextOptions)) {
@@ -1441,35 +1441,36 @@ void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
// Iterate over context types, except 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
- GrContextFactory::GLContextType contextTypes[] = {
- GrContextFactory::kNative_GLContextType,
+ GrContextFactory::ContextType contextTypes[] = {
+ GrContextFactory::kNativeGL_ContextType,
#if SK_ANGLE
#ifdef SK_BUILD_FOR_WIN
- GrContextFactory::kANGLE_GLContextType,
+ GrContextFactory::kANGLE_ContextType,
#endif
- GrContextFactory::kANGLE_GL_GLContextType,
+ GrContextFactory::kANGLE_GL_ContextType,
#endif
#if SK_COMMAND_BUFFER
- GrContextFactory::kCommandBuffer_GLContextType,
+ GrContextFactory::kCommandBuffer_ContextType,
#endif
#if SK_MESA
- GrContextFactory::kMESA_GLContextType,
+ GrContextFactory::kMESA_ContextType,
#endif
- GrContextFactory::kNull_GLContextType,
- GrContextFactory::kDebug_GLContextType,
+ GrContextFactory::kNullGL_ContextType,
+ GrContextFactory::kDebugGL_ContextType,
};
- static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kGLContextTypeCnt - 2,
- "Skipping unexpected GLContextType for GPU tests");
+ // Should have named all the context types except one of GL or GLES.
+ static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kContextTypeCnt - 1,
+ "Skipping unexpected ContextType for GPU tests");
for (auto& contextType : contextTypes) {
int contextSelector = kNone_GPUTestContexts;
- if (GrContextFactory::IsRenderingGLContext(contextType)) {
+ if (GrContextFactory::IsRenderingContext(contextType)) {
contextSelector |= kAllRendering_GPUTestContexts;
- } else if (contextType == GrContextFactory::kNative_GLContextType) {
+ } else if (contextType == GrContextFactory::kNativeGL_ContextType) {
contextSelector |= kNative_GPUTestContexts;
- } else if (contextType == GrContextFactory::kNull_GLContextType) {
+ } else if (contextType == GrContextFactory::kNullGL_ContextType) {
contextSelector |= kNull_GPUTestContexts;
- } else if (contextType == GrContextFactory::kDebug_GLContextType) {
+ } else if (contextType == GrContextFactory::kDebugGL_ContextType) {
contextSelector |= kDebug_GPUTestContexts;
}
if ((testContexts & contextSelector) == 0) {
@@ -1480,7 +1481,7 @@ void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
call_test(test, reporter, context);
}
context = factory->getContextInfo(contextType,
- GrContextFactory::kEnableNVPR_GLContextOptions);
+ GrContextFactory::kEnableNVPR_ContextOptions);
if (context.fGrContext) {
call_test(test, reporter, context);
}
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
index 490737f41e..2352f83ae4 100644
--- a/dm/DMGpuSupport.h
+++ b/dm/DMGpuSupport.h
@@ -30,8 +30,8 @@ static const bool kGPUDisabled = false;
static inline sk_sp<SkSurface> NewGpuSurface(
sk_gpu_test::GrContextFactory* grFactory,
- sk_gpu_test::GrContextFactory::GLContextType type,
- sk_gpu_test::GrContextFactory::GLContextOptions options,
+ sk_gpu_test::GrContextFactory::ContextType type,
+ sk_gpu_test::GrContextFactory::ContextOptions options,
SkImageInfo info,
int samples,
bool useDIText) {
@@ -66,20 +66,22 @@ public:
GrContextFactory() {};
explicit GrContextFactory(const GrContextOptions&) {}
- typedef int GLContextType;
-
- static const GLContextType kANGLE_GLContextType = 0,
- kANGLE_GL_GLContextType = 0,
- kCommandBuffer_GLContextType = 0,
- kDebug_GLContextType = 0,
- kMESA_GLContextType = 0,
- kNVPR_GLContextType = 0,
- kNative_GLContextType = 0,
- kNull_GLContextType = 0;
- static const int kGLContextTypeCnt = 1;
- enum GLContextOptions {
- kNone_GLContextOptions = 0,
- kEnableNVPR_GLContextOptions = 0x1,
+ typedef int ContextType;
+
+ static const ContextType kANGLE_ContextType = 0,
+ kANGLE_GL_ContextType = 0,
+ kCommandBuffer_ContextType = 0,
+ kDebugGL_ContextType = 0,
+ kMESA_ContextType = 0,
+ kNVPR_ContextType = 0,
+ kNativeGL_ContextType = 0,
+ kGL_ContextType = 0,
+ kGLES_ContextType = 0,
+ kNullGL_ContextType = 0;
+ static const int kContextTypeCnt = 1;
+ enum ContextOptions {
+ kNone_ContextOptions = 0,
+ kEnableNVPR_ContextOptions = 0x1,
};
void destroyContexts() {}
@@ -94,8 +96,8 @@ namespace DM {
static const bool kGPUDisabled = true;
static inline SkSurface* NewGpuSurface(sk_gpu_test::GrContextFactory*,
- sk_gpu_test::GrContextFactory::GLContextType,
- sk_gpu_test::GrContextFactory::GLContextOptions,
+ sk_gpu_test::GrContextFactory::ContextType,
+ sk_gpu_test::GrContextFactory::ContextOptions,
SkImageInfo,
int,
bool) {
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 5f8727f60e..0862967554 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -941,8 +941,8 @@ Error NullSink::draw(const Src& src, SkBitmap*, SkWStream*, SkString*) const {
DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?");
-GPUSink::GPUSink(GrContextFactory::GLContextType ct,
- GrContextFactory::GLContextOptions options,
+GPUSink::GPUSink(GrContextFactory::ContextType ct,
+ GrContextFactory::ContextOptions options,
int samples,
bool diText,
SkColorType colorType,
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index c4df845853..743bd1e467 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -232,8 +232,8 @@ public:
class GPUSink : public Sink {
public:
- GPUSink(sk_gpu_test::GrContextFactory::GLContextType,
- sk_gpu_test::GrContextFactory::GLContextOptions,
+ GPUSink(sk_gpu_test::GrContextFactory::ContextType,
+ sk_gpu_test::GrContextFactory::ContextOptions,
int samples, bool diText, SkColorType colorType, SkColorProfileType profileType,
bool threaded);
@@ -242,8 +242,8 @@ public:
const char* fileExtension() const override { return "png"; }
SinkFlags flags() const override { return SinkFlags{ SinkFlags::kGPU, SinkFlags::kDirect }; }
private:
- sk_gpu_test::GrContextFactory::GLContextType fContextType;
- sk_gpu_test::GrContextFactory::GLContextOptions fContextOptions;
+ sk_gpu_test::GrContextFactory::ContextType fContextType;
+ sk_gpu_test::GrContextFactory::ContextOptions fContextOptions;
int fSampleCount;
bool fUseDIText;
SkColorType fColorType;