1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUNDS_H_
6 #define GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUNDS_H_
7 
8 #include <vector>
9 
10 #include "base/macros.h"
11 #include "build/build_config.h"
12 #include "gpu/config/gpu_driver_bug_workaround_type.h"
13 #include "gpu/gpu_export.h"
14 
15 // Forwardly declare a few GL types to avoid including GL header files.
16 typedef int GLint;
17 
18 namespace gpu {
19 
20 class GPU_EXPORT GpuDriverBugWorkarounds {
21  public:
22   GpuDriverBugWorkarounds();
23   explicit GpuDriverBugWorkarounds(const std::vector<int32_t>&);
24 
25   GpuDriverBugWorkarounds(const GpuDriverBugWorkarounds& other);
26 
27   ~GpuDriverBugWorkarounds();
28 
29   // For boolean members, || is applied.
30   // For int members, the min() is applied if both are non-zero; if one is
31   // zero, then the other is applied.
32   void Append(const GpuDriverBugWorkarounds& extra);
33 
34   std::vector<int32_t> ToIntSet() const;
35 
36 #define GPU_OP(type, name) bool name = false;
37   GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
38 #undef GPU_OP
39 
40   // Note: 0 here means use driver limit.
41   GLint max_texture_size = 0;
42   GLint max_3d_array_texture_size = 0;
43   GLint max_copy_texture_chromium_size = 0;
44 };
45 
46 }  // namespace gpu
47 
48 #endif  // GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUNDS_H_
49