Debian Codegraph @

tools/flags/CommonFlagsGraphite.cpp

raw
1 /*
2 * Copyright 2024 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "tools/flags/CommonFlagsGraphite.h"
9
10 #include "include/core/SkExecutor.h"
11 #include "tools/graphite/TestOptions.h"
12
13 // Defined in CommonFlagsConfig
14 DECLARE_int(gpuThreads)
15 DECLARE_int(internalSamples)
16
17 namespace CommonFlags {
18 #if defined(SK_DAWN)
19 static DEFINE_bool(disable_tint_symbol_renaming, false, "Disable Tint WGSL symbol renaming when "
20 "using Dawn");
21 static DEFINE_bool(neverYieldToWebGPU, false, "Run Graphite with never-yield context option.");
22 static DEFINE_bool(useWGPUTextureView, false, "Run Graphite w/ a wrapped WGPU texture view as "
23 "the destination");
24 #endif // SK_DAWN
25
26 DEFINE_int(internalMSAATileSize, 0, "Run Graphite w/ limited MSAA texture's size");
27 DEFINE_int(minMSAAPathSize, -1,
28 "Graphite uses raster atlas for paths smaller than this, or default value if negative");
29
30 void SetTestOptions(skiatest::graphite::TestOptions* testOptions) {
31 static std::unique_ptr<SkExecutor> gGpuExecutor =
32 (0 != FLAGS_gpuThreads) ? SkExecutor::MakeFIFOThreadPool(FLAGS_gpuThreads)
33 : nullptr;
34
35 testOptions->fContextOptions.fExecutor = gGpuExecutor.get();
36
37 if (FLAGS_internalSamples >= 0) {
38 testOptions->fContextOptions.fInternalMultisampleCount =
39 skgpu::graphite::ToSampleCount(FLAGS_internalSamples);
40 }
41 if (FLAGS_internalMSAATileSize > 0) {
42 testOptions->fContextOptions.fInternalMSAATileSize = {FLAGS_internalMSAATileSize,
43 FLAGS_internalMSAATileSize};
44 }
45 if (FLAGS_minMSAAPathSize >= 0) {
46 testOptions->fContextOptions.fMinimumPathSizeForMSAA = FLAGS_minMSAAPathSize;
47 }
48
49 #if defined(SK_DAWN)
50 testOptions->fDisableTintSymbolRenaming = FLAGS_disable_tint_symbol_renaming;
51 testOptions->fNeverYieldToWebGPU = FLAGS_neverYieldToWebGPU;
52 testOptions->fUseWGPUTextureView = FLAGS_useWGPUTextureView;
53 #endif // SK_DAWN
54 }
55
56 } // namespace CommonFlags