| Flutter Impeller |

capabilities_gles.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 #include "impeller/renderer/backend/gles/capabilities_gles.h"
6
7 #include "impeller/renderer/backend/gles/proc_table_gles.h"
8
9 namespace impeller {
10
11 CapabilitiesGLES::CapabilitiesGLES(const ProcTableGLES& gl) {
12 {
13 GLint value = 0;
14 gl.GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &value);
15 max_combined_texture_image_units = value;
16 }
17
18 {
19 GLint value = 0;
20 gl.GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &value);
21 max_cube_map_texture_size = value;
22 }
23
24 if (gl.GetDescription()->IsES()) {
25 GLint value = 0;
26 gl.GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &value);
27 max_fragment_uniform_vectors = value;
28 }
29
30 {
31 GLint value = 0;
32 gl.GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &value);
33 max_renderbuffer_size = value;
34 }
35
36 {
37 GLint value = 0;
38 gl.GetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &value);
39 max_texture_image_units = value;
40 }
41
42 {
43 GLint value = 0;
44 gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
45 max_texture_size = ISize{value, value};
46 }
47
48 if (gl.GetDescription()->IsES()) {
49 GLint value = 0;
50 gl.GetIntegerv(GL_MAX_VARYING_VECTORS, &value);
51 max_varying_vectors = value;
52 }
53
54 {
55 GLint value = 0;
56 gl.GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &value);
57 max_vertex_attribs = value;
58 }
59
60 {
61 GLint value = 0;
62 gl.GetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &value);
63 max_vertex_texture_image_units = value;
64 }
65
66 if (gl.GetDescription()->IsES()) {
67 GLint value = 0;
68 gl.GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &value);
69 max_vertex_uniform_vectors = value;
70 }
71
72 {
73 GLint values[2] = {};
74 gl.GetIntegerv(GL_MAX_VIEWPORT_DIMS, values);
75 max_viewport_dims = ISize{values[0], values[1]};
76 }
77
78 {
79 GLint value = 0;
80 gl.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &value);
81 num_compressed_texture_formats = value;
82 }
83
84 if (gl.GetDescription()->IsES()) {
85 GLint value = 0;
86 gl.GetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &value);
87 num_shader_binary_formats = value;
88 }
89 }
90
91 size_t CapabilitiesGLES::GetMaxTextureUnits(ShaderStage stage) const {
92 switch (stage) {
93 case ShaderStage::kVertex:
94 return max_vertex_texture_image_units;
95 case ShaderStage::kFragment:
96 return max_texture_image_units;
97 case ShaderStage::kUnknown:
98 case ShaderStage::kTessellationControl:
99 case ShaderStage::kTessellationEvaluation:
100 case ShaderStage::kCompute:
101 return 0u;
102 }
103 FML_UNREACHABLE();
104 }
105
106 } // namespace impeller
impeller::CapabilitiesGLES::max_combined_texture_image_units
size_t max_combined_texture_image_units
Definition: capabilities_gles.h:21
impeller::ShaderStage::kUnknown
@ kUnknown
impeller::CapabilitiesGLES::max_texture_image_units
size_t max_texture_image_units
Definition: capabilities_gles.h:33
impeller::DescriptionGLES::IsES
bool IsES() const
Definition: description_gles.cc:159
impeller::CapabilitiesGLES::max_vertex_texture_image_units
size_t max_vertex_texture_image_units
Definition: capabilities_gles.h:45
impeller::ShaderStage
ShaderStage
Definition: shader_types.h:20
impeller::CapabilitiesGLES::max_texture_size
ISize max_texture_size
Definition: capabilities_gles.h:36
impeller::CapabilitiesGLES::max_vertex_attribs
size_t max_vertex_attribs
Definition: capabilities_gles.h:42
impeller::CapabilitiesGLES::max_renderbuffer_size
size_t max_renderbuffer_size
Definition: capabilities_gles.h:30
impeller::TSize< int64_t >
impeller::CapabilitiesGLES::max_vertex_uniform_vectors
size_t max_vertex_uniform_vectors
Definition: capabilities_gles.h:48
impeller::CapabilitiesGLES::max_varying_vectors
size_t max_varying_vectors
Definition: capabilities_gles.h:39
impeller::ShaderStage::kTessellationEvaluation
@ kTessellationEvaluation
impeller::ProcTableGLES
Definition: proc_table_gles.h:188
impeller::ShaderStage::kFragment
@ kFragment
proc_table_gles.h
impeller::CapabilitiesGLES::CapabilitiesGLES
CapabilitiesGLES(const ProcTableGLES &gl)
Definition: capabilities_gles.cc:11
impeller::ShaderStage::kVertex
@ kVertex
impeller::CapabilitiesGLES::num_shader_binary_formats
size_t num_shader_binary_formats
Definition: capabilities_gles.h:57
impeller::CapabilitiesGLES::max_cube_map_texture_size
size_t max_cube_map_texture_size
Definition: capabilities_gles.h:24
impeller::ShaderStage::kCompute
@ kCompute
impeller::CapabilitiesGLES::max_fragment_uniform_vectors
size_t max_fragment_uniform_vectors
Definition: capabilities_gles.h:27
impeller::ShaderStage::kTessellationControl
@ kTessellationControl
capabilities_gles.h
impeller::CapabilitiesGLES::num_compressed_texture_formats
size_t num_compressed_texture_formats
Definition: capabilities_gles.h:54
impeller::CapabilitiesGLES::GetMaxTextureUnits
size_t GetMaxTextureUnits(ShaderStage stage) const
Definition: capabilities_gles.cc:91
impeller
Definition: aiks_context.cc:10
impeller::ProcTableGLES::GetDescription
const DescriptionGLES * GetDescription() const
Definition: proc_table_gles.cc:133
impeller::CapabilitiesGLES::max_viewport_dims
ISize max_viewport_dims
Definition: capabilities_gles.h:51