Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(727)

Side by Side Diff: gpu/command_buffer/service/gl_utils.cc

Issue 2471853002: remove 'unsafe' from ES3 apis in gpu process (Closed)
Patch Set: forgot to save file Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gl_utils.h" 5 #include "gpu/command_buffer/service/gl_utils.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "gpu/command_buffer/common/capabilities.h" 8 #include "gpu/command_buffer/common/capabilities.h"
9 #include "gpu/command_buffer/service/feature_info.h" 9 #include "gpu/command_buffer/service/feature_info.h"
10 #include "ui/gl/gl_version_info.h" 10 #include "ui/gl/gl_version_info.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 glGetIntegerv(GL_MAX_VARYING_VECTORS, &caps->max_varying_vectors); 114 glGetIntegerv(GL_MAX_VARYING_VECTORS, &caps->max_varying_vectors);
115 glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &caps->max_vertex_attribs); 115 glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &caps->max_vertex_attribs);
116 glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 116 glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS,
117 &caps->max_vertex_texture_image_units); 117 &caps->max_vertex_texture_image_units);
118 glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, 118 glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS,
119 &caps->max_vertex_uniform_vectors); 119 &caps->max_vertex_uniform_vectors);
120 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, 120 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS,
121 &caps->num_compressed_texture_formats); 121 &caps->num_compressed_texture_formats);
122 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &caps->num_shader_binary_formats); 122 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &caps->num_shader_binary_formats);
123 123
124 if (feature_info->IsES3Enabled()) { 124 if (feature_info->IsWebGL2OrES3Context()) {
125 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &caps->max_3d_texture_size); 125 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &caps->max_3d_texture_size);
126 glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &caps->max_array_texture_layers); 126 glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &caps->max_array_texture_layers);
127 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &caps->max_color_attachments); 127 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &caps->max_color_attachments);
128 glGetInteger64v(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, 128 glGetInteger64v(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS,
129 &caps->max_combined_fragment_uniform_components); 129 &caps->max_combined_fragment_uniform_components);
130 glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, 130 glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS,
131 &caps->max_combined_uniform_blocks); 131 &caps->max_combined_uniform_blocks);
132 glGetInteger64v(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, 132 glGetInteger64v(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS,
133 &caps->max_combined_vertex_uniform_components); 133 &caps->max_combined_vertex_uniform_components);
134 glGetIntegerv(GL_MAX_DRAW_BUFFERS, &caps->max_draw_buffers); 134 glGetIntegerv(GL_MAX_DRAW_BUFFERS, &caps->max_draw_buffers);
(...skipping 29 matching lines...) Expand all
164 glGetIntegerv(GL_NUM_EXTENSIONS, &caps->num_extensions); 164 glGetIntegerv(GL_NUM_EXTENSIONS, &caps->num_extensions);
165 glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, 165 glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS,
166 &caps->num_program_binary_formats); 166 &caps->num_program_binary_formats);
167 glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, 167 glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT,
168 &caps->uniform_buffer_offset_alignment); 168 &caps->uniform_buffer_offset_alignment);
169 caps->major_version = 3; 169 caps->major_version = 3;
170 caps->minor_version = 0; 170 caps->minor_version = 0;
171 } 171 }
172 if (feature_info->feature_flags().multisampled_render_to_texture || 172 if (feature_info->feature_flags().multisampled_render_to_texture ||
173 feature_info->feature_flags().chromium_framebuffer_multisample || 173 feature_info->feature_flags().chromium_framebuffer_multisample ||
174 feature_info->IsES3Enabled()) { 174 feature_info->IsWebGL2OrES3Context()) {
175 glGetIntegerv(GL_MAX_SAMPLES, &caps->max_samples); 175 glGetIntegerv(GL_MAX_SAMPLES, &caps->max_samples);
176 } 176 }
177 } 177 }
178 178
179 bool CheckUniqueAndNonNullIds(GLsizei n, const GLuint* client_ids) { 179 bool CheckUniqueAndNonNullIds(GLsizei n, const GLuint* client_ids) {
180 if (n <= 0) 180 if (n <= 0)
181 return true; 181 return true;
182 std::unordered_set<uint32_t> unique_ids(client_ids, client_ids + n); 182 std::unordered_set<uint32_t> unique_ids(client_ids, client_ids + n);
183 return (unique_ids.size() == static_cast<size_t>(n)) && 183 return (unique_ids.size() == static_cast<size_t>(n)) &&
184 (unique_ids.find(0) == unique_ids.end()); 184 (unique_ids.find(0) == unique_ids.end());
185 } 185 }
186 186
187 } // namespace gles2 187 } // namespace gles2
188 } // namespace gpu 188 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager_unittest.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698