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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "include/gpu/GrDriverBugWorkarounds.h" |
Adrienne Walker | 1df7cd8 | 2018-04-18 13:46:25 -0700 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "include/core/SkTypes.h" |
Adrienne Walker | 1df7cd8 | 2018-04-18 13:46:25 -0700 | [diff] [blame] | 11 | |
| 12 | GrDriverBugWorkarounds::GrDriverBugWorkarounds() = default; |
Ben Wagner | e990fcc | 2020-03-27 17:10:35 -0400 | [diff] [blame^] | 13 | GrDriverBugWorkarounds::GrDriverBugWorkarounds(const GrDriverBugWorkarounds&) = default; |
| 14 | GrDriverBugWorkarounds& GrDriverBugWorkarounds::operator=(const GrDriverBugWorkarounds&) = default; |
| 15 | GrDriverBugWorkarounds::~GrDriverBugWorkarounds() = default; |
Adrienne Walker | 1df7cd8 | 2018-04-18 13:46:25 -0700 | [diff] [blame] | 16 | |
| 17 | GrDriverBugWorkarounds::GrDriverBugWorkarounds( |
| 18 | const std::vector<int>& enabled_driver_bug_workarounds) { |
| 19 | for (auto id : enabled_driver_bug_workarounds) { |
| 20 | switch (id) { |
| 21 | #define GPU_OP(type, name) \ |
| 22 | case GrDriverBugWorkaroundType::type: \ |
| 23 | name = true; \ |
| 24 | break; |
| 25 | |
| 26 | GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
| 27 | #undef GPU_OP |
| 28 | default: |
| 29 | SK_ABORT("Not implemented"); |
| 30 | break; |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | |
Adrienne Walker | ab7181d | 2018-05-14 14:02:03 -0700 | [diff] [blame] | 35 | void GrDriverBugWorkarounds::applyOverrides( |
| 36 | const GrDriverBugWorkarounds& workarounds) { |
| 37 | #define GPU_OP(type, name) \ |
| 38 | name |= workarounds.name; |
| 39 | |
| 40 | GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
| 41 | #undef GPU_OP |
| 42 | } |