aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/nanobench.cpp2
-rw-r--r--dm/DM.cpp8
-rw-r--r--fuzz/FuzzCanvas.cpp9
-rw-r--r--site/dev/testing/testing.md33
-rw-r--r--site/user/build.md2
-rw-r--r--tests/GLProgramsTest.cpp3
-rw-r--r--tests/ImageTest.cpp21
-rw-r--r--tests/TestConfigParsing.cpp168
-rw-r--r--tools/flags/SkCommonFlagsConfig.cpp42
-rw-r--r--tools/flags/SkCommonFlagsConfig.h4
-rw-r--r--tools/gpu/GrContextFactory.cpp8
-rw-r--r--tools/gpu/GrContextFactory.h15
-rw-r--r--tools/skiaserve/Request.cpp14
13 files changed, 171 insertions, 158 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 5e13a29671..2f271dbbcf 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -395,7 +395,7 @@ static int setup_gpu_bench(Target* target, Benchmark* bench, int maxGpuFrameLag)
}
#if SK_SUPPORT_GPU
-#define kBogusContextType GrContextFactory::kNativeGL_ContextType
+#define kBogusContextType GrContextFactory::kGL_ContextType
#define kBogusContextOverrides GrContextFactory::ContextOverrides::kNone
#else
#define kBogusContextType 0
diff --git a/dm/DM.cpp b/dm/DM.cpp
index d3d12393a6..7c504baf3b 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -1491,13 +1491,19 @@ void RunWithGPUTestContexts(GrContextTestFn* test, GrContextTypeFilterFn* contex
Reporter* reporter, GrContextFactory* factory) {
#if SK_SUPPORT_GPU
+#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC)
+ static constexpr auto kNativeGLType = GrContextFactory::kGL_ContextType;
+#else
+ static constexpr auto kNativeGLType = GrContextFactory::kGLES_ContextType;
+#endif
+
for (int typeInt = 0; typeInt < GrContextFactory::kContextTypeCnt; ++typeInt) {
GrContextFactory::ContextType contextType = (GrContextFactory::ContextType) typeInt;
// 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
if (contextType == GrContextFactory::kGL_ContextType ||
contextType == GrContextFactory::kGLES_ContextType) {
- if (contextType != GrContextFactory::kNativeGL_ContextType) {
+ if (contextType != kNativeGLType) {
continue;
}
}
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index 33b932bfba..dc3338e972 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -1787,9 +1787,14 @@ DEF_FUZZ(RasterN32Canvas, fuzz) {
#if SK_SUPPORT_GPU
DEF_FUZZ(NativeGLCanvas, fuzz) {
+ GrContext* context = sk_gpu_test::GrContextFactory().get(
+ sk_gpu_test::GrContextFactory::kGL_ContextType);
+ if (!context) {
+ context = sk_gpu_test::GrContextFactory().get(
+ sk_gpu_test::GrContextFactory::kGLES_ContextType);
+ }
auto surface = SkSurface::MakeRenderTarget(
- sk_gpu_test::GrContextFactory().get(
- sk_gpu_test::GrContextFactory::kNativeGL_ContextType),
+ context,
SkBudgeted::kNo,
SkImageInfo::Make(kCanvasSize.width(), kCanvasSize.height(), kRGBA_8888_SkColorType, kPremul_SkAlphaType));
SkASSERT(surface && surface->getCanvas());
diff --git a/site/dev/testing/testing.md b/site/dev/testing/testing.md
index c14ca72f68..d58abfb400 100644
--- a/site/dev/testing/testing.md
+++ b/site/dev/testing/testing.md
@@ -66,16 +66,15 @@ files (from `--skps`, which defaults to "skps"). You can control the types of
sources DM will use with `--src` (default, "tests gm image skp").
DM has found 3 usable ways to draw those 492 sources. This is controlled by
-`--config`, which today defaults to "565 8888 gpu nonrendering angle nvprmsaa4".
-DM has skipped nonrendering, angle, and nvprmssa4, leaving three usable configs:
-565, 8888, and gpu. These three name different ways to draw using Skia:
+`--config`. The defaults are operating system dependent. On Linux they are "8888 gl nonrendering".
+DM has skipped nonrendering leaving two usable configs:
+8888 and gl. These two name different ways to draw using Skia:
- - 565: draw using the software backend into a 16-bit RGB bitmap
- 8888: draw using the software backend into a 32-bit RGBA bitmap
- - gpu: draw using the GPU backend (Ganesh) into a 32-bit RGBA bitmap
+ - gl: draw using the OpenGL backend (Ganesh) into a 32-bit RGBA bitmap
Sometimes DM calls these configs, sometimes sinks. Sorry. There are many
-possible configs but generally we pay most attention to 8888 and gpu.
+possible configs but generally we pay most attention to 8888 and gl.
DM always tries to draw all sources into all sinks, which is why we multiply
492 by 3. The unit tests don't really fit into this source-sink model, so they
@@ -110,19 +109,19 @@ When DM finishes running, you should find a directory with file named dm.json,
and some nested directories filled with lots of images.
~~~
$ ls dm_output
-565 8888 dm.json gpu
+8888 dm.json gl
$ find dm_output -name '*.png'
-dm_output/565/gm/3x3bitmaprect.png
-dm_output/565/gm/aaclip.png
-dm_output/565/gm/aarectmodes.png
-dm_output/565/gm/alphagradients.png
-dm_output/565/gm/arcofzorro.png
-dm_output/565/gm/arithmode.png
-dm_output/565/gm/astcbitmap.png
-dm_output/565/gm/bezier_conic_effects.png
-dm_output/565/gm/bezier_cubic_effects.png
-dm_output/565/gm/bezier_quad_effects.png
+dm_output/8888/gm/3x3bitmaprect.png
+dm_output/8888/gm/aaclip.png
+dm_output/8888/gm/aarectmodes.png
+dm_output/8888/gm/alphagradients.png
+dm_output/8888/gm/arcofzorro.png
+dm_output/8888/gm/arithmode.png
+dm_output/8888/gm/astcbitmap.png
+dm_output/8888/gm/bezier_conic_effects.png
+dm_output/8888/gm/bezier_cubic_effects.png
+dm_output/8888/gm/bezier_quad_effects.png
...
~~~
diff --git a/site/user/build.md b/site/user/build.md
index 36ef63c89d..eaf56c24f1 100644
--- a/site/user/build.md
+++ b/site/user/build.md
@@ -99,7 +99,7 @@ and run it as normal. You may find `bin/droid` convenient.
ninja -C out/arm64
adb push out/arm64/dm /data/local/tmp
adb push resources /data/local/tmp
- adb shell "cd /data/local/tmp; ./dm --src gm --config gpu"
+ adb shell "cd /data/local/tmp; ./dm --src gm --config gl"
Mac
---
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 688c59290d..a8434eca86 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -422,7 +422,8 @@ static void test_glprograms_other_contexts(
}
static bool is_native_gl_context_type(sk_gpu_test::GrContextFactory::ContextType type) {
- return type == sk_gpu_test::GrContextFactory::kNativeGL_ContextType;
+ return type == sk_gpu_test::GrContextFactory::kGL_ContextType ||
+ type == sk_gpu_test::GrContextFactory::kGLES_ContextType;
}
static bool is_other_rendering_gl_context_type(sk_gpu_test::GrContextFactory::ContextType type) {
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index e0e64ead10..55f200a3d0 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -466,13 +466,26 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(c, reporter, ctxInfo) {
}
}
+GrContextFactory::ContextType pick_second_context_type(const sk_gpu_test::ContextInfo& info) {
+ switch (info.backend()) {
+ case kOpenGL_GrBackend:
+ if (info.glContext()->gl()->fStandard == kGLES_GrGLStandard) {
+ return GrContextFactory::kGLES_ContextType;
+ } else {
+ return GrContextFactory::kGL_ContextType;
+ }
+ case kVulkan_GrBackend:
+ return GrContextFactory::kVulkan_ContextType;
+ }
+ SkFAIL("Unknown backend type.");
+ return GrContextFactory::kGL_ContextType;
+}
+
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_makeTextureImage, reporter, contextInfo) {
GrContext* context = contextInfo.grContext();
sk_gpu_test::TestContext* testContext = contextInfo.testContext();
-
GrContextFactory otherFactory;
- GrContextFactory::ContextType otherContextType =
- GrContextFactory::NativeContextTypeForBackend(testContext->backend());
+ GrContextFactory::ContextType otherContextType = pick_second_context_type(contextInfo);
ContextInfo otherContextInfo = otherFactory.getContextInfo(otherContextType);
testContext->makeCurrent();
@@ -932,7 +945,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
GrContextFactory otherFactory;
ContextInfo otherContextInfo =
- otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType);
+ otherFactory.getContextInfo(pick_second_context_type(ctxInfo));
testContext->makeCurrent();
REPORTER_ASSERT(reporter, proxy);
diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp
index 0f884d160c..8cc3df272f 100644
--- a/tests/TestConfigParsing.cpp
+++ b/tests/TestConfigParsing.cpp
@@ -31,18 +31,18 @@ SkCommandLineFlags::StringArray make_string_array(std::initializer_list<const ch
}
DEF_TEST(ParseConfigs_Gpu, reporter) {
// Parses a normal config and returns correct "tag".
- // Gpu config defaults work.
- SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"});
+ // Simple GL config works
+ SkCommandLineFlags::StringArray config1 = make_string_array({"gl"});
SkCommandLineConfigArray configs;
ParseConfigs(config1, &configs);
REPORTER_ASSERT(reporter, configs.count() == 1);
- REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu"));
+ REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl"));
REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0);
#if SK_SUPPORT_GPU
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType()
- == GrContextFactory::kNativeGL_ContextType);
+ == GrContextFactory::kGL_ContextType);
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false);
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseInstanced() == false);
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false);
@@ -54,11 +54,11 @@ DEF_TEST(ParseConfigs_Gpu, reporter) {
DEF_TEST(ParseConfigs_OutParam, reporter) {
// Clears the out parameter.
- SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"});
+ SkCommandLineFlags::StringArray config1 = make_string_array({"gles"});
SkCommandLineConfigArray configs;
ParseConfigs(config1, &configs);
REPORTER_ASSERT(reporter, configs.count() == 1);
- REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu"));
+ REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gles"));
SkCommandLineFlags::StringArray config2 = make_string_array({"8888"});
ParseConfigs(config2, &configs);
@@ -75,10 +75,10 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
// Parses all default configs and returns correct "tag".
SkCommandLineFlags::StringArray config1 = make_string_array({
- "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "glmsaa16", "glmsaa4",
- "nonrendering", "null", "nullgpu", "glnvpr16", "glnvpr4", "glnvprdit16", "glesnvprdit4",
+ "565", "8888", "debuggl", "gl", "gldft", "nullgl", "glmsaa16", "glmsaa4",
+ "nonrendering", "nullgl", "gles", "glnvpr16", "glnvpr4", "glnvprdit16", "glesnvprdit4",
"pdf", "skp", "svg", "xps", "angle_d3d11_es2", "angle_gl_es2", "commandbuffer", "mesa",
- "hwui", "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4", "vk",
+ "hwui", "glf16", "glessrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4", "vk",
"glinst", "glinst4", "glinstdit4", "glinst16", "glinstdit16", "glesinst", "glesinst4",
"glesinstdit4", "glwide", "glnarrow"
});
@@ -98,122 +98,120 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[2]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[3]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[4]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[6]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 16);
- REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getSamples() == 4);
- REPORTER_ASSERT(reporter, !configs[9]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[10]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[11]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getSamples() == 16);
+ REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getUseDIText());
+ REPORTER_ASSERT(reporter, configs[5]->asConfigGpu());
+ REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 16);
+ REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 4);
+ REPORTER_ASSERT(reporter, !configs[8]->asConfigGpu());
+ REPORTER_ASSERT(reporter, configs[9]->asConfigGpu());
+ REPORTER_ASSERT(reporter, configs[10]->asConfigGpu());
+ REPORTER_ASSERT(reporter, configs[11]->asConfigGpu()->getSamples() == 16);
+ REPORTER_ASSERT(reporter, configs[11]->asConfigGpu()->getUseNVPR());
+ REPORTER_ASSERT(reporter, !configs[11]->asConfigGpu()->getUseDIText());
+ REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getSamples() == 4);
REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, !configs[12]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getSamples() == 4);
+ REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getSamples() == 16);
REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[13]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getSamples() == 16);
+ REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseDIText());
+ REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getSamples() == 4);
REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getSamples() == 4);
- REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseDIText());
+ REPORTER_ASSERT(reporter, !configs[15]->asConfigGpu());
REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu());
REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu());
REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
- REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace());
- REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace()->gammaIsLinear());
+ REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu());
+ REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
+ REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getColorSpace());
+ REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getColorSpace()->gammaIsLinear());
const SkMatrix44* srgbXYZ = as_CSB(srgbColorSpace)->toXYZD50();
SkASSERT(srgbXYZ);
const SkMatrix44* config25XYZ =
- as_CSB(configs[25]->asConfigGpu()->getColorSpace())->toXYZD50();
+ as_CSB(configs[24]->asConfigGpu()->getColorSpace())->toXYZD50();
SkASSERT(config25XYZ);
REPORTER_ASSERT(reporter, *config25XYZ == *srgbXYZ);
- REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
- REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
- REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
- REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorSpace());
- REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorSpace()->gammaIsLinear());
+ REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
+ REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
+ REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
+ REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getColorSpace());
+ REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getColorSpace()->gammaIsLinear());
const SkMatrix44* config41XYZ =
- as_CSB(configs[41]->asConfigGpu()->getColorSpace())->toXYZD50();
+ as_CSB(configs[40]->asConfigGpu()->getColorSpace())->toXYZD50();
SkASSERT(config41XYZ);
REPORTER_ASSERT(reporter, *config41XYZ != *srgbXYZ);
- REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getContextType() ==
+ REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()->getContextType() ==
GrContextFactory::kGL_ContextType);
- REPORTER_ASSERT(reporter, configs[42]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
- REPORTER_ASSERT(reporter, configs[42]->asConfigGpu()->getColorSpace());
- REPORTER_ASSERT(reporter, configs[42]->asConfigGpu()->getColorSpace()->gammaIsLinear());
- REPORTER_ASSERT(reporter, *as_CSB(configs[42]->asConfigGpu()->getColorSpace())->toXYZD50() !=
+ REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorType() == kRGBA_F16_SkColorType);
+ REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorSpace());
+ REPORTER_ASSERT(reporter, configs[41]->asConfigGpu()->getColorSpace()->gammaIsLinear());
+ REPORTER_ASSERT(reporter, *as_CSB(configs[41]->asConfigGpu()->getColorSpace())->toXYZD50() !=
*as_CSB(srgbColorSpace)->toXYZD50());
+ REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()->getUseInstanced());
+ REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getContextType() ==
+ GrContextFactory::kGL_ContextType);
REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getUseInstanced());
+ REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getSamples() == 4);
REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getContextType() ==
GrContextFactory::kGL_ContextType);
REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getUseInstanced());
+ REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getSamples() == 4);
REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getContextType() ==
GrContextFactory::kGL_ContextType);
REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getUseInstanced());
- REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getSamples() == 4);
+ REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getSamples() == 16);
REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getContextType() ==
GrContextFactory::kGL_ContextType);
REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getUseInstanced());
+ REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getSamples() == 16);
REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGL_ContextType);
+ GrContextFactory::kGLES_ContextType);
REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getUseInstanced());
- REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getSamples() == 16);
REPORTER_ASSERT(reporter, configs[38]->asConfigGpu()->getContextType() ==
GrContextFactory::kGLES_ContextType);
REPORTER_ASSERT(reporter, configs[38]->asConfigGpu()->getUseInstanced());
+ REPORTER_ASSERT(reporter, configs[38]->asConfigGpu()->getSamples() == 4);
REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getContextType() ==
GrContextFactory::kGLES_ContextType);
REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getUseInstanced());
+ REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getSamples() == 4);
- REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGLES_ContextType);
- REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getUseInstanced());
- REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getSamples() == 4);
+ REPORTER_ASSERT(reporter, configs[19]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[20]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[21]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[22]->asConfigGpu());
#if SK_MESA
REPORTER_ASSERT(reporter, configs[23]->asConfigGpu());
#else
- REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu());
+ REPORTER_ASSERT(reporter, !configs[22]->asConfigGpu());
#endif
+ REPORTER_ASSERT(reporter, configs[26]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[27]->asConfigGpu());
+ REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()->getSamples() == 4);
+ REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, configs[28]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getSamples() == 4);
REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getUseNVPR());
+ REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[29]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getSamples() == 4);
- REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseDIText());
+ REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
+ REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
REPORTER_ASSERT(reporter, configs[30]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType);
- REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getColorSpace() == srgbColorSpace.get());
- REPORTER_ASSERT(reporter, configs[31]->asConfigGpu());
- REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getSamples() == 4);
+ REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getSamples() == 4);
#ifdef SK_VULKAN
- REPORTER_ASSERT(reporter, configs[32]->asConfigGpu());
+ REPORTER_ASSERT(reporter, configs[31]->asConfigGpu());
#endif
#endif
}
DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
SkCommandLineFlags::StringArray config1 = make_string_array({
- "gpu[nvpr=true,dit=false]",
+ "gpu[api=gl,nvpr=true,dit=false]",
"gpu[api=angle_d3d9_es2]",
"gpu[api=angle_gl_es3]",
"gpu[api=mesa,samples=77]",
"gpu[dit=true,api=commandbuffer]",
- "gpu[]",
"gpu[api=gles]",
"gpu[api=gl]",
"gpu[api=vulkan]",
@@ -227,7 +225,7 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
}
#if SK_SUPPORT_GPU
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() ==
- GrContextFactory::kNativeGL_ContextType);
+ GrContextFactory::kGL_ContextType);
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0);
@@ -245,24 +243,18 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
#endif
REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getContextType() ==
GrContextFactory::kCommandBuffer_ContextType);
-
REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() ==
- GrContextFactory::kNativeGL_ContextType);
+ GrContextFactory::kGLES_ContextType);
REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0);
REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGLES_ContextType);
+ GrContextFactory::kGL_ContextType);
REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0);
- REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() ==
- GrContextFactory::kGL_ContextType);
- REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR());
- REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText());
- REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0);
#ifdef SK_VULKAN
- REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getContextType() ==
+ REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() ==
GrContextFactory::kVulkan_ContextType);
REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText());
@@ -273,15 +265,17 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) {
SkCommandLineFlags::StringArray config1 = make_string_array({
- "gpu[nvpr=1]", // Number as bool.
+ "gpu[api=gl,nvpr=1]", // Number as bool.
"gpu[api=gl,]", // Trailing in comma.
"gpu[api=angle_glu]", // Unknown api.
"gpu[api=,samples=0]", // Empty api.
- "gpu[samples=true]", // Value true as a number.
- "gpu[samples=0,samples=0]", // Duplicate option key.
- "gpu[,samples=0]", // Leading comma.
+ "gpu[api=gl,samples=true]", // Value true as a number.
+ "gpu[api=gl,samples=0,samples=0]", // Duplicate option key.
+ "gpu[,api=gl,samples=0]", // Leading comma.
"gpu[samples=54", // Missing closing parenthesis.
",,",
+ "gpu[]", // Missing required api specifier
+ "gpu[samples=4]", // Missing required api specifier
"gpu[", // Missing bracket.
"samples=54" // No backend.
"gpu[nvpr=true ]", // Space.
@@ -303,9 +297,9 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises, reporter) {
// These just list explicitly some properties of the system.
SkCommandLineFlags::StringArray config1 = make_string_array({
// Options are not canonized -> two same configs have a different tag.
- "gpu[nvpr=true,dit=true]", "gpu[dit=true,nvpr=true]",
- "gpu[api=debug]", "gpu[api=gl]", "gpu[api=gles]", ""
- "gpu", "gpu[]", "gpu[samples=0]", "gpu[api=gles,samples=0]"
+ "gpu[api=gl,nvpr=true,dit=true]", "gpu[api=gl,dit=true,nvpr=true]",
+ "gpu[api=debuggl]", "gpu[api=gl]", "gpu[api=gles]", ""
+ "gpu[api=gl]", "gpu[api=gl,samples=0]", "gpu[api=gles,samples=0]"
});
SkCommandLineConfigArray configs;
ParseConfigs(config1, &configs);
@@ -355,8 +349,8 @@ DEF_TEST(ParseConfigs_ViaParsingExtendedForm, reporter) {
SkCommandLineFlags::StringArray config1 = make_string_array({
"zz-qq-gpu[api=gles]",
"abc-nbc-cbs-gpu[api=angle_d3d9_es2,samples=1]",
- "a-gpu[samples=1",
- "abc-def-angle_gl_es2[samples=1]",
+ "a-gpu[api=gl",
+ "abc-def-angle_gl_es2[api=gles]",
});
SkCommandLineConfigArray configs;
@@ -372,11 +366,11 @@ DEF_TEST(ParseConfigs_ViaParsingExtendedForm, reporter) {
{"gpu[api=gles]", {"zz", "qq", nullptr}},
{"gpu[api=angle_d3d9_es2,samples=1]", {"abc", "nbc", "cbs"}},
#endif
- {"gpu[samples=1", {"a", nullptr, nullptr}}, // Missing bracket makes this is not extended
- // form but via still works as expected.
- {"angle_gl_es2[samples=1]", {"abc", "def", nullptr}} // This is not extended form.
- // angle_gl_es2 is an api type not a
- // backend.
+ {"gpu[api=gl", {"a", nullptr, nullptr}}, // Missing bracket makes this is not extended
+ // form but via still works as expected.
+ {"angle_gl_es2[api=gles]", {"abc", "def", nullptr}} // This is not extended form.
+ // angle_gl_es2 is an api type not a
+ // backend.
};
for (int i = 0; i < config1.count(); ++i) {
REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp
index 46aec7dcc6..b827e89665 100644
--- a/tools/flags/SkCommonFlagsConfig.cpp
+++ b/tools/flags/SkCommonFlagsConfig.cpp
@@ -15,20 +15,27 @@
using sk_gpu_test::GrContextFactory;
#endif
+#if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS)
+# define DEFAULT_GPU_CONFIG "gles"
+#else
+# define DEFAULT_GPU_CONFIG "gl"
+#endif
+
static const char defaultConfigs[] =
- "8888 gpu nonrendering"
+ "8888 " DEFAULT_GPU_CONFIG " nonrendering "
#if defined(SK_BUILD_FOR_WIN)
" angle_d3d11_es2"
#endif
;
+#undef DEFAULT_GPU_CONFIG
+
static const struct {
const char* predefinedConfig;
const char* backend;
const char* options;
} gPredefinedConfigs[] ={
#if SK_SUPPORT_GPU
- { "gpu", "gpu", "" },
{ "gl", "gpu", "api=gl" },
{ "gles", "gpu", "api=gles" },
{ "glmsaa4", "gpu", "api=gl,samples=4" },
@@ -48,22 +55,22 @@ static const struct {
{ "glesinst", "gpu", "api=gles,inst=true" },
{ "glesinst4", "gpu", "api=gles,inst=true,samples=4" },
{ "glesinstdit4", "gpu", "api=gles,inst=true,samples=4,dit=true" },
- { "gpuf16", "gpu", "color=f16" },
- { "gpusrgb", "gpu", "color=srgb" },
- { "gpusrgbnl", "gpu", "color=srgbnl" },
+ { "glf16", "gpu", "api=gl,color=f16" },
+ { "glsrgb", "gpu", "api=gl,color=srgb" },
+ { "glsrgbnl", "gpu", "api=gl,color=srgbnl" },
+ { "glesf16", "gpu", "api=gles,color=f16" },
+ { "glessrgb", "gpu", "api=gles,color=srgb" },
+ { "glessrgbnl", "gpu", "api=gles,color=srgbnl" },
{ "glsrgb", "gpu", "api=gl,color=srgb" },
{ "glwide", "gpu", "api=gl,color=f16_wide" },
{ "glnarrow", "gpu", "api=gl,color=f16_narrow" },
{ "glessrgb", "gpu", "api=gles,color=srgb" },
{ "gleswide", "gpu", "api=gles,color=f16_wide" },
{ "glesnarrow", "gpu", "api=gles,color=f16_narrow" },
- { "gpudft", "gpu", "dit=true" },
{ "gldft", "gpu", "api=gl,dit=true" },
{ "glesdft", "gpu", "api=gles,dit=true" },
- { "gpudebug", "gpu", "api=debug" },
- { "gpunull", "gpu", "api=null" },
- { "debug", "gpu", "api=debug" },
- { "nullgpu", "gpu", "api=null" },
+ { "debuggl", "gpu", "api=debuggl" },
+ { "nullgl", "gpu", "api=nullgl" },
{ "angle_d3d11_es2", "gpu", "api=angle_d3d11_es2" },
{ "angle_d3d11_es3", "gpu", "api=angle_d3d11_es3" },
{ "angle_d3d9_es2", "gpu", "api=angle_d3d9_es2" },
@@ -106,14 +113,14 @@ static const char configExtendedHelp[] =
#if SK_SUPPORT_GPU
"\n"
"gpu[api=string,color=string,dit=bool,nvpr=bool,inst=bool,samples=int]\n"
- "\tapi\ttype: string\tdefault: native.\n"
+ "\tapi\ttype: string\trequired\n"
"\t Select graphics API to use with gpu backend.\n"
"\t Options:\n"
"\t\tnative\t\t\tUse platform default OpenGL or OpenGL ES backend.\n"
"\t\tgl \t\t\tUse OpenGL.\n"
"\t\tgles \t\t\tUse OpenGL ES.\n"
- "\t\tdebug \t\t\tUse debug OpenGL.\n"
- "\t\tnull \t\t\tUse null OpenGL.\n"
+ "\t\tdebuggl \t\t\tUse debug OpenGL.\n"
+ "\t\tnullgl \t\t\tUse null OpenGL.\n"
"\t\tangle_d3d9_es2\t\t\tUse OpenGL ES2 on the ANGLE Direct3D9 backend.\n"
"\t\tangle_d3d11_es2\t\t\tUse OpenGL ES2 on the ANGLE Direct3D11 backend.\n"
"\t\tangle_d3d11_es3\t\t\tUse OpenGL ES3 on the ANGLE Direct3D11 backend.\n"
@@ -236,11 +243,11 @@ static bool parse_option_gpu_api(const SkString& value,
*outContextType = GrContextFactory::kGLES_ContextType;
return true;
}
- if (value.equals("debug")) {
+ if (value.equals("debuggl")) {
*outContextType = GrContextFactory::kDebugGL_ContextType;
return true;
}
- if (value.equals("null")) {
+ if (value.equals("nullgl")) {
*outContextType = GrContextFactory::kNullGL_ContextType;
return true;
}
@@ -354,7 +361,7 @@ SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString& tag,
const SkString& options) {
// Defaults for GPU backend.
bool seenAPI = false;
- SkCommandLineConfigGpu::ContextType contextType = GrContextFactory::kNativeGL_ContextType;
+ SkCommandLineConfigGpu::ContextType contextType = GrContextFactory::kGL_ContextType;
bool seenUseNVPR = false;
bool useNVPR = false;
bool seenUseInstanced = false;
@@ -401,6 +408,9 @@ SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString& tag,
return nullptr;
}
}
+ if (!seenAPI) {
+ return nullptr;
+ }
return new SkCommandLineConfigGpu(tag, vias, contextType, useNVPR, useInstanced, useDIText,
samples, colorType, colorSpace);
}
diff --git a/tools/flags/SkCommonFlagsConfig.h b/tools/flags/SkCommonFlagsConfig.h
index d562376fa2..e6ebefd864 100644
--- a/tools/flags/SkCommonFlagsConfig.h
+++ b/tools/flags/SkCommonFlagsConfig.h
@@ -46,9 +46,9 @@ class SkCommandLineConfig {
#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 of form "gpu[option=value,option2=value,...]"
// * backends that represent a shorthand of above (such as "glmsaa16" representing
-// "gpu(samples=16)")
+// "gpu(api=gl,samples=16)")
class SkCommandLineConfigGpu : public SkCommandLineConfig {
public:
typedef sk_gpu_test::GrContextFactory::ContextType ContextType;
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index 0c6c87ad6f..6ed89542c9 100644
--- a/tools/gpu/GrContextFactory.cpp
+++ b/tools/gpu/GrContextFactory.cpp
@@ -95,14 +95,6 @@ void GrContextFactory::releaseResourcesAndAbandonContexts() {
}
}
-#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC)
-const GrContextFactory::ContextType GrContextFactory::kNativeGL_ContextType =
- GrContextFactory::kGL_ContextType;
-#else
-const GrContextFactory::ContextType GrContextFactory::kNativeGL_ContextType =
- GrContextFactory::kGLES_ContextType;
-#endif
-
ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOverrides overrides,
GrContext* shareContext, uint32_t shareIndex) {
// (shareIndex != 0) -> (shareContext != nullptr)
diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h
index b1a4e1a6b4..0067e52144 100644
--- a/tools/gpu/GrContextFactory.h
+++ b/tools/gpu/GrContextFactory.h
@@ -83,9 +83,6 @@ public:
kLastContextType = kVulkan_ContextType
};
- //! OpenGL or OpenGL ES context depending on the platform. To be removed.
- static const ContextType kNativeGL_ContextType;
-
static const int kContextTypeCnt = kLastContextType + 1;
/**
@@ -102,18 +99,6 @@ public:
kRequireSRGBSupport = 0x10
};
- static ContextType NativeContextTypeForBackend(GrBackend backend) {
- switch (backend) {
- case kOpenGL_GrBackend:
- return kNativeGL_ContextType;
- case kVulkan_GrBackend:
- return kVulkan_ContextType;
- default:
- SkFAIL("Unknown backend");
- return kNullGL_ContextType;
- }
- }
-
static bool IsRenderingContext(ContextType type) {
switch (type) {
case kNullGL_ContextType:
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 125302b376..7c2b893ef2 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -73,8 +73,12 @@ sk_sp<SkData> Request::writeCanvasToPng(SkCanvas* canvas) {
SkCanvas* Request::getCanvas() {
#if SK_SUPPORT_GPU
GrContextFactory* factory = fContextFactory;
- GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNativeGL_ContextType,
- GrContextFactory::ContextOverrides::kNone).glContext();
+ GLTestContext* gl = factory->getContextInfo(GrContextFactory::kGL_ContextType,
+ GrContextFactory::ContextOverrides::kNone).glContext();
+ if (!gl) {
+ gl = factory->getContextInfo(GrContextFactory::kGLES_ContextType,
+ GrContextFactory::ContextOverrides::kNone).glContext();
+ }
if (!gl) {
gl = factory->getContextInfo(GrContextFactory::kMESA_ContextType,
GrContextFactory::ContextOverrides::kNone).glContext();
@@ -126,9 +130,13 @@ sk_sp<SkData> Request::writeOutSkp() {
GrContext* Request::getContext() {
#if SK_SUPPORT_GPU
- GrContext* result = fContextFactory->get(GrContextFactory::kNativeGL_ContextType,
+ GrContext* result = fContextFactory->get(GrContextFactory::kGL_ContextType,
GrContextFactory::ContextOverrides::kNone);
if (!result) {
+ result = fContextFactory->get(GrContextFactory::kGLES_ContextType,
+ GrContextFactory::ContextOverrides::kNone);
+ }
+ if (!result) {
result = fContextFactory->get(GrContextFactory::kMESA_ContextType,
GrContextFactory::ContextOverrides::kNone);
}