• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2013 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // Contants.h: Defines some implementation specific and gl constants
8 
9 #ifndef LIBANGLE_CONSTANTS_H_
10 #define LIBANGLE_CONSTANTS_H_
11 
12 #include "common/platform.h"
13 
14 #include <stdint.h>
15 
16 namespace gl
17 {
18 
19 // The binary cache is currently left disable by default, and the application can enable it.
20 const size_t kDefaultMaxProgramCacheMemoryBytes = 0;
21 
22 enum
23 {
24     // Implementation upper limits, real maximums depend on the hardware
25     MAX_SAMPLE_MASK_WORDS = 2,
26 
27     MAX_VERTEX_ATTRIBS         = 16,
28     MAX_VERTEX_ATTRIB_BINDINGS = 16,
29 
30     // Implementation upper limits, real maximums depend on the hardware
31     IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
32     IMPLEMENTATION_MAX_DRAW_BUFFERS    = 8,
33     IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS =
34         IMPLEMENTATION_MAX_DRAW_BUFFERS + 2,  // 2 extra for depth and/or stencil buffers
35 
36     IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS   = 16,
37     IMPLEMENTATION_MAX_GEOMETRY_SHADER_UNIFORM_BUFFERS = 16,
38     IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
39     IMPLEMENTATION_MAX_COMPUTE_SHADER_UNIFORM_BUFFERS  = 16,
40     // GL_EXT_geometry_shader increases the minimum value of GL_MAX_COMBINED_UNIFORM_BLOCKS to 36.
41     IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS = 36,
42 
43     // GL_EXT_geometry_shader increases the minimum value of GL_MAX_UNIFORM_BUFFER_BINDINGS to 48.
44     IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS = 48,
45 
46     // Transform feedback limits set to the minimum required by the spec.
47     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 128,
48     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS       = 4,
49     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS    = 4,
50     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS                = 4,
51 
52     // Maximum number of views which are supported by the implementation of ANGLE_multiview.
53     IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS = 4,
54 
55     // These are the maximums the implementation can support
56     // The actual GL caps are limited by the device caps
57     // and should be queried from the Context
58     IMPLEMENTATION_MAX_2D_TEXTURE_SIZE         = 32768,
59     IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE   = 32768,
60     IMPLEMENTATION_MAX_3D_TEXTURE_SIZE         = 16384,
61     IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
62 
63     // 1+log2 of max of MAX_*_TEXTURE_SIZE
64     IMPLEMENTATION_MAX_TEXTURE_LEVELS = 16,
65 
66     // Limit active textures so we can use fast bitsets.
67     IMPLEMENTATION_MAX_SHADER_TEXTURES = 32,
68     IMPLEMENTATION_MAX_ACTIVE_TEXTURES = IMPLEMENTATION_MAX_SHADER_TEXTURES * 2,
69     IMPLEMENTATION_MAX_IMAGE_UNITS     = IMPLEMENTATION_MAX_ACTIVE_TEXTURES,
70 
71     // Maximum number of slots allocated for atomic counter buffers.
72     IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFERS = 8,
73 
74     // Implementation upper limits, real maximums depend on the hardware.
75     IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 64,
76 };
77 
78 namespace limits
79 {
80 // Almost all drivers use 2048 (the minimum value) as GL_MAX_VERTEX_ATTRIB_STRIDE.  ANGLE advertizes
81 // the same limit.
82 constexpr uint32_t kMaxVertexAttribStride = 2048;
83 
84 // Some of the minimums required by GL, used to detect if the backend meets the minimum requirement.
85 // Currently, there's no need to separate these values per spec version.
86 constexpr uint32_t kMinimumComputeStorageBuffers = 4;
87 
88 // OpenGL ES 3.0+ Minimum Values
89 // Table 6.31 MAX_VERTEX_UNIFORM_BLOCKS minimum value = 12
90 // Table 6.32 MAX_FRAGMENT_UNIFORM_BLOCKS minimum value = 12
91 constexpr uint32_t kMinimumShaderUniformBlocks = 12;
92 // Table 6.31 MAX_VERTEX_OUTPUT_COMPONENTS minimum value = 64
93 constexpr uint32_t kMinimumVertexOutputComponents = 64;
94 }  // namespace limits
95 
96 }  // namespace gl
97 
98 #endif  // LIBANGLE_CONSTANTS_H_
99