| 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 |
// or invoke `bazel run //tools:generate_workarounds` |
| 18 |
// This is not rebuilt by default to avoid embedders having to have extra |
| 19 |
// build steps. |
| 20 |
#include "include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h" |
| 21 |
#endif |
| 22 |
|
| 23 |
#include "include/core/SkTypes.h" |
| 24 |
|
| 25 |
#include <cstdint> |
| 26 |
#include <vector> |
| 27 |
|
| 28 |
enum GrDriverBugWorkaroundType { |
| 29 |
#define GPU_OP(type, name) type, |
| 30 |
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
| 31 |
#undef GPU_OP |
| 32 |
NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES |
| 33 |
}; |
| 34 |
|
| 35 |
class SK_API GrDriverBugWorkarounds { |
| 36 |
public: |
| 37 |
GrDriverBugWorkarounds() = default; |
| 38 |
GrDriverBugWorkarounds(const GrDriverBugWorkarounds&) = default; |
| 39 |
~GrDriverBugWorkarounds() = default; |
| 40 |
|
| 41 |
explicit GrDriverBugWorkarounds(const std::vector<int32_t>& workarounds); |
| 42 |
|
| 43 |
GrDriverBugWorkarounds& operator=(const GrDriverBugWorkarounds&) = default; |
| 44 |
|
| 45 |
// Turn on any workarounds listed in |workarounds| (but don't turn any off). |
| 46 |
void applyOverrides(const GrDriverBugWorkarounds& workarounds); |
| 47 |
|
| 48 |
#define GPU_OP(type, name) bool name = false; |
| 49 |
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
| 50 |
#undef GPU_OP |
| 51 |
}; |
| 52 |
|
| 53 |
#endif |