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