xref: /aosp_15_r20/external/angle/src/libANGLE/Constants.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2013 The ANGLE Project Authors. All rights reserved.
3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file.
5*8975f5c5SAndroid Build Coastguard Worker //
6*8975f5c5SAndroid Build Coastguard Worker 
7*8975f5c5SAndroid Build Coastguard Worker // Contants.h: Defines some implementation specific and gl constants
8*8975f5c5SAndroid Build Coastguard Worker 
9*8975f5c5SAndroid Build Coastguard Worker #ifndef LIBANGLE_CONSTANTS_H_
10*8975f5c5SAndroid Build Coastguard Worker #define LIBANGLE_CONSTANTS_H_
11*8975f5c5SAndroid Build Coastguard Worker 
12*8975f5c5SAndroid Build Coastguard Worker #include "common/platform.h"
13*8975f5c5SAndroid Build Coastguard Worker 
14*8975f5c5SAndroid Build Coastguard Worker #include <stddef.h>
15*8975f5c5SAndroid Build Coastguard Worker 
16*8975f5c5SAndroid Build Coastguard Worker namespace gl
17*8975f5c5SAndroid Build Coastguard Worker {
18*8975f5c5SAndroid Build Coastguard Worker 
19*8975f5c5SAndroid Build Coastguard Worker // The binary cache is currently left disable by default, and the application can enable it.
20*8975f5c5SAndroid Build Coastguard Worker const size_t kDefaultMaxProgramCacheMemoryBytes = 0;
21*8975f5c5SAndroid Build Coastguard Worker 
22*8975f5c5SAndroid Build Coastguard Worker enum
23*8975f5c5SAndroid Build Coastguard Worker {
24*8975f5c5SAndroid Build Coastguard Worker     // Implementation upper limits, real maximums depend on the hardware
25*8975f5c5SAndroid Build Coastguard Worker 
26*8975f5c5SAndroid Build Coastguard Worker     // Only up to 32x MSAA supported.
27*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_SAMPLE_MASK_WORDS = 1,
28*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_SAMPLES           = 32,
29*8975f5c5SAndroid Build Coastguard Worker 
30*8975f5c5SAndroid Build Coastguard Worker     MAX_VERTEX_ATTRIBS         = 16,
31*8975f5c5SAndroid Build Coastguard Worker     MAX_VERTEX_ATTRIB_BINDINGS = 16,
32*8975f5c5SAndroid Build Coastguard Worker 
33*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
34*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_DRAW_BUFFERS    = 8,
35*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS =
36*8975f5c5SAndroid Build Coastguard Worker         IMPLEMENTATION_MAX_DRAW_BUFFERS + 2,  // 2 extra for depth and/or stencil buffers
37*8975f5c5SAndroid Build Coastguard Worker 
38*8975f5c5SAndroid Build Coastguard Worker     // The vast majority of devices support only one dual-source draw buffer
39*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_DUAL_SOURCE_DRAW_BUFFERS = 1,
40*8975f5c5SAndroid Build Coastguard Worker 
41*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS   = 16,
42*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_GEOMETRY_SHADER_UNIFORM_BUFFERS = 16,
43*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
44*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_COMPUTE_SHADER_UNIFORM_BUFFERS  = 16,
45*8975f5c5SAndroid Build Coastguard Worker 
46*8975f5c5SAndroid Build Coastguard Worker     // GL_EXT_geometry_shader increases the minimum value of GL_MAX_COMBINED_UNIFORM_BLOCKS to 36.
47*8975f5c5SAndroid Build Coastguard Worker     // GL_EXT_tessellation_shader increases the minimum value to 60.
48*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS = 60,
49*8975f5c5SAndroid Build Coastguard Worker 
50*8975f5c5SAndroid Build Coastguard Worker     // GL_EXT_geometry_shader increases the minimum value of GL_MAX_UNIFORM_BUFFER_BINDINGS to 48.
51*8975f5c5SAndroid Build Coastguard Worker     // GL_EXT_tessellation_shader increases the minimum value to 72.
52*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS = 72,
53*8975f5c5SAndroid Build Coastguard Worker 
54*8975f5c5SAndroid Build Coastguard Worker     // Transform feedback limits set to the minimum required by the spec.
55*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 128,
56*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS       = 4,
57*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS    = 4,
58*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS                = 4,
59*8975f5c5SAndroid Build Coastguard Worker 
60*8975f5c5SAndroid Build Coastguard Worker     // Maximum number of views which are supported by the multiview implementation.
61*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS = 4,
62*8975f5c5SAndroid Build Coastguard Worker 
63*8975f5c5SAndroid Build Coastguard Worker     // These are the maximums the implementation can support
64*8975f5c5SAndroid Build Coastguard Worker     // The actual GL caps are limited by the device caps
65*8975f5c5SAndroid Build Coastguard Worker     // and should be queried from the Context
66*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_2D_TEXTURE_SIZE         = 32768,
67*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE   = 32768,
68*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_3D_TEXTURE_SIZE         = 16384,
69*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
70*8975f5c5SAndroid Build Coastguard Worker 
71*8975f5c5SAndroid Build Coastguard Worker     // 1+log2 of max of MAX_*_TEXTURE_SIZE
72*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_TEXTURE_LEVELS = 16,
73*8975f5c5SAndroid Build Coastguard Worker 
74*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_SHADER_TEXTURES = 32,
75*8975f5c5SAndroid Build Coastguard Worker 
76*8975f5c5SAndroid Build Coastguard Worker     // In ES 3.1 and below, the limit for active textures is 64.
77*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_ES31_ACTIVE_TEXTURES = 64,
78*8975f5c5SAndroid Build Coastguard Worker 
79*8975f5c5SAndroid Build Coastguard Worker     // In ES 3.2 we need to support a minimum of 96 maximum textures.
80*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_ACTIVE_TEXTURES = 96,
81*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_IMAGE_UNITS     = IMPLEMENTATION_MAX_ACTIVE_TEXTURES,
82*8975f5c5SAndroid Build Coastguard Worker 
83*8975f5c5SAndroid Build Coastguard Worker     // Maximum framebuffer and renderbuffer size supported.
84*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_FRAMEBUFFER_SIZE  = 32768,
85*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_RENDERBUFFER_SIZE = 32768,
86*8975f5c5SAndroid Build Coastguard Worker 
87*8975f5c5SAndroid Build Coastguard Worker     // Maximum number of slots allocated for atomic counter buffers.
88*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 8,
89*8975f5c5SAndroid Build Coastguard Worker 
90*8975f5c5SAndroid Build Coastguard Worker     // Implementation upper limits, real maximums depend on the hardware.
91*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 64,
92*8975f5c5SAndroid Build Coastguard Worker 
93*8975f5c5SAndroid Build Coastguard Worker     // Implementation upper limits of max number of clip distances (minimum required per spec)
94*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_CLIP_DISTANCES = 8,
95*8975f5c5SAndroid Build Coastguard Worker 
96*8975f5c5SAndroid Build Coastguard Worker     // Implementation upper limit for layered framebuffer layer count
97*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_FRAMEBUFFER_LAYERS = 256,
98*8975f5c5SAndroid Build Coastguard Worker 
99*8975f5c5SAndroid Build Coastguard Worker     // ANGLE_shader_pixel_local_storage: keep the maximum number of supported planes reasonably
100*8975f5c5SAndroid Build Coastguard Worker     // similar on all platforms.
101*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_PIXEL_LOCAL_STORAGE_PLANES = 8,
102*8975f5c5SAndroid Build Coastguard Worker 
103*8975f5c5SAndroid Build Coastguard Worker     // QCOM foveated rendering constants
104*8975f5c5SAndroid Build Coastguard Worker     // We support a max of 1 layer and 2 focal points, for now
105*8975f5c5SAndroid Build Coastguard Worker     // TODO (anglebug.com/42266906): Implement support for multiple layers
106*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_NUM_LAYERS   = 1,
107*8975f5c5SAndroid Build Coastguard Worker     IMPLEMENTATION_MAX_FOCAL_POINTS = 2,
108*8975f5c5SAndroid Build Coastguard Worker };
109*8975f5c5SAndroid Build Coastguard Worker 
110*8975f5c5SAndroid Build Coastguard Worker namespace limits
111*8975f5c5SAndroid Build Coastguard Worker {
112*8975f5c5SAndroid Build Coastguard Worker // Almost all drivers use 2048 (the minimum value) as GL_MAX_VERTEX_ATTRIB_STRIDE.  ANGLE advertizes
113*8975f5c5SAndroid Build Coastguard Worker // the same limit.
114*8975f5c5SAndroid Build Coastguard Worker constexpr uint32_t kMaxVertexAttribStride = 2048;
115*8975f5c5SAndroid Build Coastguard Worker 
116*8975f5c5SAndroid Build Coastguard Worker // Some of the minimums required by GL, used to detect if the backend meets the minimum requirement.
117*8975f5c5SAndroid Build Coastguard Worker // Currently, there's no need to separate these values per spec version.
118*8975f5c5SAndroid Build Coastguard Worker constexpr uint32_t kMinimumComputeStorageBuffers = 4;
119*8975f5c5SAndroid Build Coastguard Worker 
120*8975f5c5SAndroid Build Coastguard Worker // OpenGL ES 3.0+ Minimum Values
121*8975f5c5SAndroid Build Coastguard Worker // Table 6.31 MAX_VERTEX_UNIFORM_BLOCKS minimum value = 12
122*8975f5c5SAndroid Build Coastguard Worker // Table 6.32 MAX_FRAGMENT_UNIFORM_BLOCKS minimum value = 12
123*8975f5c5SAndroid Build Coastguard Worker constexpr uint32_t kMinimumShaderUniformBlocks = 12;
124*8975f5c5SAndroid Build Coastguard Worker // Table 6.31 MAX_VERTEX_OUTPUT_COMPONENTS minimum value = 64
125*8975f5c5SAndroid Build Coastguard Worker constexpr uint32_t kMinimumVertexOutputComponents = 64;
126*8975f5c5SAndroid Build Coastguard Worker 
127*8975f5c5SAndroid Build Coastguard Worker // OpenGL ES 3.2+ Minimum Values
128*8975f5c5SAndroid Build Coastguard Worker // Table 21.42 TEXTURE_BUFFER_OFFSET_ALIGNMENT minimum value = 256
129*8975f5c5SAndroid Build Coastguard Worker constexpr uint32_t kMinTextureBufferOffsetAlignment = 256;
130*8975f5c5SAndroid Build Coastguard Worker 
131*8975f5c5SAndroid Build Coastguard Worker }  // namespace limits
132*8975f5c5SAndroid Build Coastguard Worker 
133*8975f5c5SAndroid Build Coastguard Worker }  // namespace gl
134*8975f5c5SAndroid Build Coastguard Worker 
135*8975f5c5SAndroid Build Coastguard Worker #endif  // LIBANGLE_CONSTANTS_H_
136