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. 19 #include "include/gpu/GrDriverBugWorkaroundsAutogen.h" 20 #endif 21 22 #include "include/core/SkTypes.h" 23 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 34 class SK_API GrDriverBugWorkarounds { 35 public: 36 GrDriverBugWorkarounds(); 37 GrDriverBugWorkarounds(const GrDriverBugWorkarounds&) = default; 38 explicit GrDriverBugWorkarounds(const std::vector<int32_t>& workarounds); 39 40 GrDriverBugWorkarounds& operator=(const GrDriverBugWorkarounds&) = default; 41 42 // Turn on any workarounds listed in |workarounds| (but don't turn any off). 43 void applyOverrides(const GrDriverBugWorkarounds& workarounds); 44 45 ~GrDriverBugWorkarounds(); 46 47 #define GPU_OP(type, name) bool name = false; 48 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) 49 #undef GPU_OP 50 }; 51 52 #endif 53