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