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