• 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 <stddef.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 
26     // Only up to 32x MSAA supported.
27     IMPLEMENTATION_MAX_SAMPLE_MASK_WORDS = 1,
28     IMPLEMENTATION_MAX_SAMPLES           = 32,
29 
30     MAX_VERTEX_ATTRIBS         = 16,
31     MAX_VERTEX_ATTRIB_BINDINGS = 16,
32 
33     IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
34     IMPLEMENTATION_MAX_DRAW_BUFFERS    = 8,
35     IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS =
36         IMPLEMENTATION_MAX_DRAW_BUFFERS + 2,  // 2 extra for depth and/or stencil buffers
37 
38     // The vast majority of devices support only one dual-source draw buffer
39     IMPLEMENTATION_MAX_DUAL_SOURCE_DRAW_BUFFERS = 1,
40 
41     IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS   = 16,
42     IMPLEMENTATION_MAX_GEOMETRY_SHADER_UNIFORM_BUFFERS = 16,
43     IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
44     IMPLEMENTATION_MAX_COMPUTE_SHADER_UNIFORM_BUFFERS  = 16,
45 
46     // GL_EXT_geometry_shader increases the minimum value of GL_MAX_COMBINED_UNIFORM_BLOCKS to 36.
47     // GL_EXT_tessellation_shader increases the minimum value to 60.
48     IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS = 60,
49 
50     // GL_EXT_geometry_shader increases the minimum value of GL_MAX_UNIFORM_BUFFER_BINDINGS to 48.
51     // GL_EXT_tessellation_shader increases the minimum value to 72.
52     IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS = 72,
53 
54     // Transform feedback limits set to the minimum required by the spec.
55     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 128,
56     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS       = 4,
57     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS    = 4,
58     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS                = 4,
59 
60     // Maximum number of views which are supported by the multiview implementation.
61     IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS = 4,
62 
63     // These are the maximums the implementation can support
64     // The actual GL caps are limited by the device caps
65     // and should be queried from the Context
66     IMPLEMENTATION_MAX_2D_TEXTURE_SIZE         = 32768,
67     IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE   = 32768,
68     IMPLEMENTATION_MAX_3D_TEXTURE_SIZE         = 16384,
69     IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
70 
71     // 1+log2 of max of MAX_*_TEXTURE_SIZE
72     IMPLEMENTATION_MAX_TEXTURE_LEVELS = 16,
73 
74     IMPLEMENTATION_MAX_SHADER_TEXTURES = 32,
75 
76     // In ES 3.1 and below, the limit for active textures is 64.
77     IMPLEMENTATION_MAX_ES31_ACTIVE_TEXTURES = 64,
78 
79     // In ES 3.2 we need to support a minimum of 96 maximum textures.
80     IMPLEMENTATION_MAX_ACTIVE_TEXTURES = 96,
81     IMPLEMENTATION_MAX_IMAGE_UNITS     = IMPLEMENTATION_MAX_ACTIVE_TEXTURES,
82 
83     // Maximum framebuffer and renderbuffer size supported.
84     IMPLEMENTATION_MAX_FRAMEBUFFER_SIZE  = 32768,
85     IMPLEMENTATION_MAX_RENDERBUFFER_SIZE = 32768,
86 
87     // Maximum number of slots allocated for atomic counter buffers.
88     IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 8,
89 
90     // Implementation upper limits, real maximums depend on the hardware.
91     IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 64,
92 
93     // Implementation upper limits of max number of clip distances (minimum required per spec)
94     IMPLEMENTATION_MAX_CLIP_DISTANCES = 8,
95 
96     // Implementation upper limit for layered framebuffer layer count
97     IMPLEMENTATION_MAX_FRAMEBUFFER_LAYERS = 256,
98 
99     // ANGLE_shader_pixel_local_storage: keep the maximum number of supported planes reasonably
100     // similar on all platforms.
101     IMPLEMENTATION_MAX_PIXEL_LOCAL_STORAGE_PLANES = 8,
102 };
103 
104 namespace limits
105 {
106 // Almost all drivers use 2048 (the minimum value) as GL_MAX_VERTEX_ATTRIB_STRIDE.  ANGLE advertizes
107 // the same limit.
108 constexpr uint32_t kMaxVertexAttribStride = 2048;
109 
110 // Some of the minimums required by GL, used to detect if the backend meets the minimum requirement.
111 // Currently, there's no need to separate these values per spec version.
112 constexpr uint32_t kMinimumComputeStorageBuffers = 4;
113 
114 // OpenGL ES 3.0+ Minimum Values
115 // Table 6.31 MAX_VERTEX_UNIFORM_BLOCKS minimum value = 12
116 // Table 6.32 MAX_FRAGMENT_UNIFORM_BLOCKS minimum value = 12
117 constexpr uint32_t kMinimumShaderUniformBlocks = 12;
118 // Table 6.31 MAX_VERTEX_OUTPUT_COMPONENTS minimum value = 64
119 constexpr uint32_t kMinimumVertexOutputComponents = 64;
120 
121 // OpenGL ES 3.2+ Minimum Values
122 // Table 21.42 TEXTURE_BUFFER_OFFSET_ALIGNMENT minimum value = 256
123 constexpr uint32_t kMinTextureBufferOffsetAlignment = 256;
124 
125 }  // namespace limits
126 
127 }  // namespace gl
128 
129 #endif  // LIBANGLE_CONSTANTS_H_
130