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#include "include/gpu/GrDriverBugWorkarounds.h"
9
10#include "include/core/SkTypes.h"
11
12GrDriverBugWorkarounds::GrDriverBugWorkarounds() = default;
13
14GrDriverBugWorkarounds::GrDriverBugWorkarounds(
15        const std::vector<int>& enabled_driver_bug_workarounds) {
16    for (auto id : enabled_driver_bug_workarounds) {
17        switch (id) {
18#define GPU_OP(type, name)                        \
19            case GrDriverBugWorkaroundType::type: \
20                name = true;                      \
21                break;
22
23            GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
24#undef GPU_OP
25            default:
26                SK_ABORT("Not implemented");
27                break;
28        }
29    }
30}
31
32void GrDriverBugWorkarounds::applyOverrides(
33        const GrDriverBugWorkarounds& workarounds) {
34#define GPU_OP(type, name) \
35    name |= workarounds.name;
36
37    GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
38#undef GPU_OP
39}
40
41GrDriverBugWorkarounds::~GrDriverBugWorkarounds() = default;
42