Adrienne Walker | 1df7cd8 | 2018-04-18 13:46:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 | */ |
| 7 | |
| 8 | #ifndef GrDriverBugWorkarounds_DEFINED |
| 9 | #define GrDriverBugWorkarounds_DEFINED |
| 10 | |
| 11 | // External embedders of Skia can override this to use their own list |
| 12 | // of workaround names. |
| 13 | #ifdef SK_GPU_WORKAROUNDS_HEADER |
| 14 | #include SK_GPU_WORKAROUNDS_HEADER |
| 15 | #else |
| 16 | // To regenerate this file, set gn arg "skia_generate_workarounds = true". |
| 17 | // This is not rebuilt by default to avoid embedders having to have extra |
| 18 | // build steps. |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 19 | #include "include/gpu/GrDriverBugWorkaroundsAutogen.h" |
Adrienne Walker | 1df7cd8 | 2018-04-18 13:46:25 -0700 | [diff] [blame] | 20 | #endif |
| 21 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 22 | #include "include/core/SkTypes.h" |
Adrienne Walker | ab7181d | 2018-05-14 14:02:03 -0700 | [diff] [blame] | 23 | |
Adrienne Walker | 1df7cd8 | 2018-04-18 13:46:25 -0700 | [diff] [blame] | 24 | #include <stdint.h> |
| 25 | #include <vector> |
| 26 | |
| 27 | enum GrDriverBugWorkaroundType { |
| 28 | #define GPU_OP(type, name) type, |
| 29 | GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
| 30 | #undef GPU_OP |
| 31 | NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES |
| 32 | }; |
| 33 | |
Adrienne Walker | ab7181d | 2018-05-14 14:02:03 -0700 | [diff] [blame] | 34 | class SK_API GrDriverBugWorkarounds { |
Adrienne Walker | 1df7cd8 | 2018-04-18 13:46:25 -0700 | [diff] [blame] | 35 | public: |
| 36 | GrDriverBugWorkarounds(); |
| 37 | explicit GrDriverBugWorkarounds(const std::vector<int32_t>& workarounds); |
| 38 | |
Adrienne Walker | ab7181d | 2018-05-14 14:02:03 -0700 | [diff] [blame] | 39 | GrDriverBugWorkarounds& operator=(const GrDriverBugWorkarounds&) = default; |
| 40 | |
| 41 | // Turn on any workarounds listed in |workarounds| (but don't turn any off). |
| 42 | void applyOverrides(const GrDriverBugWorkarounds& workarounds); |
| 43 | |
Adrienne Walker | 1df7cd8 | 2018-04-18 13:46:25 -0700 | [diff] [blame] | 44 | ~GrDriverBugWorkarounds(); |
| 45 | |
| 46 | #define GPU_OP(type, name) bool name = false; |
| 47 | GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
| 48 | #undef GPU_OP |
| 49 | }; |
| 50 | |
| 51 | #endif |