caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
Mike Klein | c6142d8 | 2019-03-25 10:54:59 -0500 | [diff] [blame] | 7 | #pragma once |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 8 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 9 | #include "include/core/SkString.h" |
Kevin Lubick | dc6cc02 | 2023-01-13 11:24:27 -0500 | [diff] [blame] | 10 | #include "include/private/base/SkTArray.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "tools/flags/CommandLineFlags.h" |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 12 | |
John Stiles | b5e8e34 | 2023-08-22 14:59:00 -0400 | [diff] [blame] | 13 | namespace skgpu::graphite { |
| 14 | struct ContextOptions; |
| 15 | }; |
| 16 | |
Kevin Lubick | 8f4e560 | 2021-10-14 09:50:00 -0400 | [diff] [blame] | 17 | namespace CommonFlags { |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 18 | /** |
Mike Klein | 88544fb | 2019-03-20 10:50:33 -0500 | [diff] [blame] | 19 | * Helper to assist in collecting image paths from |dir| specified through a command line |
| 20 | * flag. |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 21 | * |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 22 | * Populates |output|, an array of strings with paths to images to test. |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 23 | * |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 24 | * Returns true if each argument to the images flag is meaningful: |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 25 | * - If the file/directory does not exist, return false. |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 26 | * - If |dir| does not have any supported images (based on file type), return false. |
| 27 | * - If |dir| is a single file, assume the user is deliberately testing this image, |
| 28 | * regardless of file type. |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 29 | */ |
John Stiles | 26bf522 | 2023-10-17 10:29:41 -0400 | [diff] [blame] | 30 | bool CollectImages(const CommandLineFlags::StringArray& dir, |
| 31 | skia_private::TArray<SkString>* output); |
Mike Klein | 4932a5e | 2019-03-22 11:08:02 -0500 | [diff] [blame] | 32 | /** |
| 33 | * Helper to set GrContextOptions from common GPU flags, including |
| 34 | * --gpuThreads |
| 35 | * --cachePathMasks |
Chris Dalton | d1e6716 | 2020-09-23 11:55:27 -0600 | [diff] [blame] | 36 | * --allPathsVolatile |
Chris Dalton | ed6e827 | 2020-04-23 11:44:26 -0600 | [diff] [blame] | 37 | * --(no)gs |
| 38 | * --(no)ts |
Mike Klein | 4932a5e | 2019-03-22 11:08:02 -0500 | [diff] [blame] | 39 | * --pr |
Chris Dalton | 5258623 | 2019-12-27 13:47:25 -0700 | [diff] [blame] | 40 | * --internalSamples |
Mike Klein | 4932a5e | 2019-03-22 11:08:02 -0500 | [diff] [blame] | 41 | * --disableDriverCorrectnessWorkarounds |
Greg Daniel | f41b2bd | 2019-08-22 16:19:24 -0400 | [diff] [blame] | 42 | * --reduceOpsTaskSplitting |
| 43 | * --dontReduceOpsTaskSplitting |
James Godfrey-Kittle | 160bf90 | 2022-11-15 16:47:45 -0500 | [diff] [blame] | 44 | * --allowMSAAOnNewIntel |
Mike Klein | 4932a5e | 2019-03-22 11:08:02 -0500 | [diff] [blame] | 45 | */ |
Kevin Lubick | 8f4e560 | 2021-10-14 09:50:00 -0400 | [diff] [blame] | 46 | void SetCtxOptions(struct GrContextOptions*); |
Mike Klein | 4932a5e | 2019-03-22 11:08:02 -0500 | [diff] [blame] | 47 | |
Kevin Lubick | 8f4e560 | 2021-10-14 09:50:00 -0400 | [diff] [blame] | 48 | } // namespace CommonFlags |