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

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

Issue 1950233002: Fix a bug in texture validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/framebuffer_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/context_group.h" 5 #include "gpu/command_buffer/service/context_group.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 mailbox_manager_ = new MailboxManagerImpl; 106 mailbox_manager_ = new MailboxManagerImpl;
107 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); 107 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get());
108 } 108 }
109 } 109 }
110 110
111 bool ContextGroup::Initialize(GLES2Decoder* decoder, 111 bool ContextGroup::Initialize(GLES2Decoder* decoder,
112 ContextType context_type, 112 ContextType context_type,
113 const DisallowedFeatures& disallowed_features) { 113 const DisallowedFeatures& disallowed_features) {
114 if (HaveContexts()) { 114 if (HaveContexts()) {
115 if (context_type != feature_info_->context_type()) { 115 if (context_type != feature_info_->context_type()) {
116 LOG(ERROR) << "ContextGroup::Initialize failed because the type of " 116 DLOG(ERROR) << "ContextGroup::Initialize failed because the type of "
117 << "the context does not fit with the group."; 117 << "the context does not fit with the group.";
118 return false; 118 return false;
119 } 119 }
120 // If we've already initialized the group just add the context. 120 // If we've already initialized the group just add the context.
121 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); 121 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder));
122 return true; 122 return true;
123 } 123 }
124 124
125 DisallowedFeatures adjusted_disallowed_features = 125 DisallowedFeatures adjusted_disallowed_features =
126 AdjustDisallowedFeatures(context_type, disallowed_features); 126 AdjustDisallowedFeatures(context_type, disallowed_features);
127 127
128 if (!feature_info_->Initialize(context_type, adjusted_disallowed_features)) { 128 if (!feature_info_->Initialize(context_type, adjusted_disallowed_features)) {
129 LOG(ERROR) << "ContextGroup::Initialize failed because FeatureInfo " 129 DLOG(ERROR) << "ContextGroup::Initialize failed because FeatureInfo "
130 << "initialization failed."; 130 << "initialization failed.";
131 return false; 131 return false;
132 } 132 }
133 133
134 transfer_buffer_manager_->Initialize(); 134 transfer_buffer_manager_->Initialize();
135 135
136 const GLint kMinRenderbufferSize = 512; // GL says 1 pixel! 136 const GLint kMinRenderbufferSize = 512; // GL says 1 pixel!
137 GLint max_renderbuffer_size = 0; 137 GLint max_renderbuffer_size = 0;
138 if (!QueryGLFeature( 138 if (!QueryGLFeature(
139 GL_MAX_RENDERBUFFER_SIZE, kMinRenderbufferSize, 139 GL_MAX_RENDERBUFFER_SIZE, kMinRenderbufferSize,
140 &max_renderbuffer_size)) { 140 &max_renderbuffer_size)) {
141 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 141 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
142 << "renderbuffer size too small (" << max_renderbuffer_size 142 << "renderbuffer size too small (" << max_renderbuffer_size
143 << ", should be " << kMinRenderbufferSize << ")."; 143 << ", should be " << kMinRenderbufferSize << ").";
144 return false; 144 return false;
145 } 145 }
146 GLint max_samples = 0; 146 GLint max_samples = 0;
147 if (feature_info_->feature_flags().chromium_framebuffer_multisample || 147 if (feature_info_->feature_flags().chromium_framebuffer_multisample ||
148 feature_info_->feature_flags().multisampled_render_to_texture) { 148 feature_info_->feature_flags().multisampled_render_to_texture) {
149 if (feature_info_->feature_flags( 149 if (feature_info_->feature_flags(
150 ).use_img_for_multisampled_render_to_texture) { 150 ).use_img_for_multisampled_render_to_texture) {
151 glGetIntegerv(GL_MAX_SAMPLES_IMG, &max_samples); 151 glGetIntegerv(GL_MAX_SAMPLES_IMG, &max_samples);
152 } else { 152 } else {
153 glGetIntegerv(GL_MAX_SAMPLES, &max_samples); 153 glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
(...skipping 12 matching lines...) Expand all
166 GetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT, 166 GetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT,
167 &max_dual_source_draw_buffers_); 167 &max_dual_source_draw_buffers_);
168 DCHECK(max_dual_source_draw_buffers_ >= 1); 168 DCHECK(max_dual_source_draw_buffers_ >= 1);
169 } 169 }
170 170
171 if (feature_info_->gl_version_info().IsES3Capable()) { 171 if (feature_info_->gl_version_info().IsES3Capable()) {
172 const GLint kMinTransformFeedbackSeparateAttribs = 4; 172 const GLint kMinTransformFeedbackSeparateAttribs = 4;
173 if (!QueryGLFeatureU(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, 173 if (!QueryGLFeatureU(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
174 kMinTransformFeedbackSeparateAttribs, 174 kMinTransformFeedbackSeparateAttribs,
175 &max_transform_feedback_separate_attribs_)) { 175 &max_transform_feedback_separate_attribs_)) {
176 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 176 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
177 << "transform feedback separate attribs is too small (" 177 << "transform feedback separate attribs is too small ("
178 << max_transform_feedback_separate_attribs_ << ", should be " 178 << max_transform_feedback_separate_attribs_ << ", should be "
179 << kMinTransformFeedbackSeparateAttribs << ")."; 179 << kMinTransformFeedbackSeparateAttribs << ").";
180 return false; 180 return false;
181 } 181 }
182 182
183 const GLint kMinUniformBufferBindings = 24; 183 const GLint kMinUniformBufferBindings = 24;
184 if (!QueryGLFeatureU(GL_MAX_UNIFORM_BUFFER_BINDINGS, 184 if (!QueryGLFeatureU(GL_MAX_UNIFORM_BUFFER_BINDINGS,
185 kMinUniformBufferBindings, 185 kMinUniformBufferBindings,
186 &max_uniform_buffer_bindings_)) { 186 &max_uniform_buffer_bindings_)) {
187 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 187 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
188 << "uniform buffer bindings is too small (" 188 << "uniform buffer bindings is too small ("
189 << max_uniform_buffer_bindings_ << ", should be " 189 << max_uniform_buffer_bindings_ << ", should be "
190 << kMinUniformBufferBindings << ")."; 190 << kMinUniformBufferBindings << ").";
191 return false; 191 return false;
192 } 192 }
193 193
194 // TODO(zmo): Should we check max UNIFORM_BUFFER_OFFSET_ALIGNMENT is 256? 194 // TODO(zmo): Should we check max UNIFORM_BUFFER_OFFSET_ALIGNMENT is 256?
195 GetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, 195 GetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT,
196 &uniform_buffer_offset_alignment_); 196 &uniform_buffer_offset_alignment_);
197 } 197 }
198 198
199 buffer_manager_.reset( 199 buffer_manager_.reset(
200 new BufferManager(memory_tracker_.get(), feature_info_.get())); 200 new BufferManager(memory_tracker_.get(), feature_info_.get()));
201 framebuffer_manager_.reset(new FramebufferManager( 201 framebuffer_manager_.reset(new FramebufferManager(
202 max_draw_buffers_, max_color_attachments_, feature_info_->context_type(), 202 max_draw_buffers_, max_color_attachments_, feature_info_->context_type(),
203 framebuffer_completeness_cache_)); 203 framebuffer_completeness_cache_));
204 renderbuffer_manager_.reset(new RenderbufferManager( 204 renderbuffer_manager_.reset(new RenderbufferManager(
205 memory_tracker_.get(), max_renderbuffer_size, max_samples, 205 memory_tracker_.get(), max_renderbuffer_size, max_samples,
206 feature_info_.get())); 206 feature_info_.get()));
207 shader_manager_.reset(new ShaderManager()); 207 shader_manager_.reset(new ShaderManager());
208 sampler_manager_.reset(new SamplerManager(feature_info_.get())); 208 sampler_manager_.reset(new SamplerManager(feature_info_.get()));
209 209
210 // Lookup GL things we need to know. 210 // Lookup GL things we need to know.
211 const GLint kGLES2RequiredMinimumVertexAttribs = 8u; 211 const GLint kGLES2RequiredMinimumVertexAttribs = 8u;
212 if (!QueryGLFeatureU( 212 if (!QueryGLFeatureU(
213 GL_MAX_VERTEX_ATTRIBS, kGLES2RequiredMinimumVertexAttribs, 213 GL_MAX_VERTEX_ATTRIBS, kGLES2RequiredMinimumVertexAttribs,
214 &max_vertex_attribs_)) { 214 &max_vertex_attribs_)) {
215 LOG(ERROR) << "ContextGroup::Initialize failed because too few " 215 DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
216 << "vertex attributes supported (" << max_vertex_attribs_ 216 << "vertex attributes supported (" << max_vertex_attribs_
217 << ", should be " << kGLES2RequiredMinimumVertexAttribs << ")."; 217 << ", should be " << kGLES2RequiredMinimumVertexAttribs << ").";
218 return false; 218 return false;
219 } 219 }
220 220
221 const GLuint kGLES2RequiredMinimumTextureUnits = 8u; 221 const GLuint kGLES2RequiredMinimumTextureUnits = 8u;
222 if (!QueryGLFeatureU( 222 if (!QueryGLFeatureU(
223 GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, kGLES2RequiredMinimumTextureUnits, 223 GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, kGLES2RequiredMinimumTextureUnits,
224 &max_texture_units_)) { 224 &max_texture_units_)) {
225 LOG(ERROR) << "ContextGroup::Initialize failed because too few " 225 DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
226 << "texture units supported (" << max_texture_units_ 226 << "texture units supported (" << max_texture_units_
227 << ", should be " << kGLES2RequiredMinimumTextureUnits << ")."; 227 << ", should be " << kGLES2RequiredMinimumTextureUnits << ").";
228 return false; 228 return false;
229 } 229 }
230 230
231 GLint max_texture_size = 0; 231 GLint max_texture_size = 0;
232 GLint max_cube_map_texture_size = 0; 232 GLint max_cube_map_texture_size = 0;
233 GLint max_rectangle_texture_size = 0; 233 GLint max_rectangle_texture_size = 0;
234 GLint max_3d_texture_size = 0; 234 GLint max_3d_texture_size = 0;
235 GLint max_array_texture_layers = 0;
235 236
236 const GLint kMinTextureSize = 2048; // GL actually says 64!?!? 237 const GLint kMinTextureSize = 2048; // GL actually says 64!?!?
237 const GLint kMinCubeMapSize = 256; // GL actually says 16!?!? 238 const GLint kMinCubeMapSize = 256; // GL actually says 16!?!?
238 const GLint kMinRectangleTextureSize = 64; 239 const GLint kMinRectangleTextureSize = 64;
239 const GLint kMin3DTextureSize = 256; 240 const GLint kMin3DTextureSize = 256;
241 const GLint kMinArrayTextureLayers = 256;
240 242
241 if (!QueryGLFeature(GL_MAX_TEXTURE_SIZE, kMinTextureSize, 243 if (!QueryGLFeature(GL_MAX_TEXTURE_SIZE, kMinTextureSize,
242 &max_texture_size)) { 244 &max_texture_size)) {
243 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 245 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
244 << "2d texture size is too small (" << max_texture_size 246 << "2d texture size is too small (" << max_texture_size
245 << ", should be " << kMinTextureSize << ")."; 247 << ", should be " << kMinTextureSize << ").";
246 return false; 248 return false;
247 } 249 }
248 if (!QueryGLFeature(GL_MAX_CUBE_MAP_TEXTURE_SIZE, kMinCubeMapSize, 250 if (!QueryGLFeature(GL_MAX_CUBE_MAP_TEXTURE_SIZE, kMinCubeMapSize,
249 &max_cube_map_texture_size)) { 251 &max_cube_map_texture_size)) {
250 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 252 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
251 << "cube texture size is too small (" 253 << "cube texture size is too small ("
252 << max_cube_map_texture_size << ", should be " << kMinCubeMapSize 254 << max_cube_map_texture_size << ", should be "
253 << ")."; 255 << kMinCubeMapSize << ").";
254 return false; 256 return false;
255 } 257 }
256 if (feature_info_->gl_version_info().IsES3Capable() && 258 if (feature_info_->gl_version_info().IsES3Capable() &&
257 !QueryGLFeature(GL_MAX_3D_TEXTURE_SIZE, kMin3DTextureSize, 259 !QueryGLFeature(GL_MAX_3D_TEXTURE_SIZE, kMin3DTextureSize,
258 &max_3d_texture_size)) { 260 &max_3d_texture_size)) {
259 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 261 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
260 << "3d texture size is too small (" << max_3d_texture_size 262 << "3d texture size is too small (" << max_3d_texture_size
261 << ", should be " << kMin3DTextureSize << ")."; 263 << ", should be " << kMin3DTextureSize << ").";
264 return false;
265 }
266 if (feature_info_->gl_version_info().IsES3Capable() &&
267 !QueryGLFeature(GL_MAX_ARRAY_TEXTURE_LAYERS, kMinArrayTextureLayers,
268 &max_array_texture_layers)) {
269 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
270 << "array texture layers is too small ("
271 << max_array_texture_layers
272 << ", should be " << kMinArrayTextureLayers << ").";
262 return false; 273 return false;
263 } 274 }
264 if (feature_info_->feature_flags().arb_texture_rectangle && 275 if (feature_info_->feature_flags().arb_texture_rectangle &&
265 !QueryGLFeature(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, 276 !QueryGLFeature(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB,
266 kMinRectangleTextureSize, &max_rectangle_texture_size)) { 277 kMinRectangleTextureSize, &max_rectangle_texture_size)) {
267 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 278 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
268 << "rectangle texture size is too small (" 279 << "rectangle texture size is too small ("
269 << max_rectangle_texture_size << ", should be " 280 << max_rectangle_texture_size << ", should be "
270 << kMinRectangleTextureSize << ")."; 281 << kMinRectangleTextureSize << ").";
271 return false; 282 return false;
272 } 283 }
273 284
274 if (feature_info_->workarounds().max_texture_size) { 285 if (feature_info_->workarounds().max_texture_size) {
275 max_texture_size = std::min( 286 max_texture_size = std::min(
276 max_texture_size, 287 max_texture_size,
277 feature_info_->workarounds().max_texture_size); 288 feature_info_->workarounds().max_texture_size);
278 max_rectangle_texture_size = std::min( 289 max_rectangle_texture_size = std::min(
279 max_rectangle_texture_size, 290 max_rectangle_texture_size,
280 feature_info_->workarounds().max_texture_size); 291 feature_info_->workarounds().max_texture_size);
281 } 292 }
282 if (feature_info_->workarounds().max_cube_map_texture_size) { 293 if (feature_info_->workarounds().max_cube_map_texture_size) {
283 max_cube_map_texture_size = std::min( 294 max_cube_map_texture_size = std::min(
284 max_cube_map_texture_size, 295 max_cube_map_texture_size,
285 feature_info_->workarounds().max_cube_map_texture_size); 296 feature_info_->workarounds().max_cube_map_texture_size);
286 } 297 }
287 298
288 texture_manager_.reset(new TextureManager(memory_tracker_.get(), 299 texture_manager_.reset(new TextureManager(memory_tracker_.get(),
289 feature_info_.get(), 300 feature_info_.get(),
290 max_texture_size, 301 max_texture_size,
291 max_cube_map_texture_size, 302 max_cube_map_texture_size,
292 max_rectangle_texture_size, 303 max_rectangle_texture_size,
293 max_3d_texture_size, 304 max_3d_texture_size,
305 max_array_texture_layers,
294 bind_generates_resource_)); 306 bind_generates_resource_));
295 texture_manager_->set_framebuffer_manager(framebuffer_manager_.get()); 307 texture_manager_->set_framebuffer_manager(framebuffer_manager_.get());
296 308
297 const GLint kMinTextureImageUnits = 8; 309 const GLint kMinTextureImageUnits = 8;
298 const GLint kMinVertexTextureImageUnits = 0; 310 const GLint kMinVertexTextureImageUnits = 0;
299 if (!QueryGLFeatureU(GL_MAX_TEXTURE_IMAGE_UNITS, kMinTextureImageUnits, 311 if (!QueryGLFeatureU(GL_MAX_TEXTURE_IMAGE_UNITS, kMinTextureImageUnits,
300 &max_texture_image_units_)) { 312 &max_texture_image_units_)) {
301 LOG(ERROR) << "ContextGroup::Initialize failed because too few " 313 DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
302 << "texture image units supported (" << max_texture_image_units_ 314 << "texture image units supported ("
303 << ", should be " << kMinTextureImageUnits << ")."; 315 << max_texture_image_units_
316 << ", should be " << kMinTextureImageUnits << ").";
304 } 317 }
305 if (!QueryGLFeatureU(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 318 if (!QueryGLFeatureU(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS,
306 kMinVertexTextureImageUnits, 319 kMinVertexTextureImageUnits,
307 &max_vertex_texture_image_units_)) { 320 &max_vertex_texture_image_units_)) {
308 LOG(ERROR) << "ContextGroup::Initialize failed because too few " 321 DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
309 << "vertex texture image units supported (" 322 << "vertex texture image units supported ("
310 << max_vertex_texture_image_units_ << ", should be " 323 << max_vertex_texture_image_units_ << ", should be "
311 << kMinTextureImageUnits << ")."; 324 << kMinTextureImageUnits << ").";
312 return false; 325 return false;
313 } 326 }
314 327
315 if (feature_info_->gl_version_info().BehavesLikeGLES()) { 328 if (feature_info_->gl_version_info().BehavesLikeGLES()) {
316 GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, 329 GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS,
317 &max_fragment_uniform_vectors_); 330 &max_fragment_uniform_vectors_);
318 GetIntegerv(GL_MAX_VARYING_VECTORS, &max_varying_vectors_); 331 GetIntegerv(GL_MAX_VARYING_VECTORS, &max_varying_vectors_);
319 GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &max_vertex_uniform_vectors_); 332 GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &max_vertex_uniform_vectors_);
320 } else { 333 } else {
321 GetIntegerv( 334 GetIntegerv(
322 GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max_fragment_uniform_vectors_); 335 GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max_fragment_uniform_vectors_);
323 max_fragment_uniform_vectors_ /= 4; 336 max_fragment_uniform_vectors_ /= 4;
324 GetIntegerv(GL_MAX_VARYING_FLOATS, &max_varying_vectors_); 337 GetIntegerv(GL_MAX_VARYING_FLOATS, &max_varying_vectors_);
325 max_varying_vectors_ /= 4; 338 max_varying_vectors_ /= 4;
326 GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &max_vertex_uniform_vectors_); 339 GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &max_vertex_uniform_vectors_);
327 max_vertex_uniform_vectors_ /= 4; 340 max_vertex_uniform_vectors_ /= 4;
328 } 341 }
329 342
330 const GLint kMinFragmentUniformVectors = 16; 343 const GLint kMinFragmentUniformVectors = 16;
331 const GLint kMinVaryingVectors = 8; 344 const GLint kMinVaryingVectors = 8;
332 const GLint kMinVertexUniformVectors = 128; 345 const GLint kMinVertexUniformVectors = 128;
333 if (!CheckGLFeatureU( 346 if (!CheckGLFeatureU(
334 kMinFragmentUniformVectors, &max_fragment_uniform_vectors_) || 347 kMinFragmentUniformVectors, &max_fragment_uniform_vectors_) ||
335 !CheckGLFeatureU(kMinVaryingVectors, &max_varying_vectors_) || 348 !CheckGLFeatureU(kMinVaryingVectors, &max_varying_vectors_) ||
336 !CheckGLFeatureU( 349 !CheckGLFeatureU(
337 kMinVertexUniformVectors, &max_vertex_uniform_vectors_)) { 350 kMinVertexUniformVectors, &max_vertex_uniform_vectors_)) {
338 LOG(ERROR) << "ContextGroup::Initialize failed because too few " 351 DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
339 << "uniforms or varyings supported."; 352 << "uniforms or varyings supported.";
340 return false; 353 return false;
341 } 354 }
342 355
343 // Some shaders in Skia need more than the min available vertex and 356 // Some shaders in Skia need more than the min available vertex and
344 // fragment shader uniform vectors in case of OSMesa GL Implementation 357 // fragment shader uniform vectors in case of OSMesa GL Implementation
345 if (feature_info_->workarounds().max_fragment_uniform_vectors) { 358 if (feature_info_->workarounds().max_fragment_uniform_vectors) {
346 max_fragment_uniform_vectors_ = std::min( 359 max_fragment_uniform_vectors_ = std::min(
347 max_fragment_uniform_vectors_, 360 max_fragment_uniform_vectors_,
348 static_cast<uint32_t>( 361 static_cast<uint32_t>(
349 feature_info_->workarounds().max_fragment_uniform_vectors)); 362 feature_info_->workarounds().max_fragment_uniform_vectors));
(...skipping 14 matching lines...) Expand all
364 if (context_type != CONTEXT_TYPE_WEBGL1 && 377 if (context_type != CONTEXT_TYPE_WEBGL1 &&
365 context_type != CONTEXT_TYPE_OPENGLES2) { 378 context_type != CONTEXT_TYPE_OPENGLES2) {
366 const GLuint kMinVertexOutputComponents = 64; 379 const GLuint kMinVertexOutputComponents = 64;
367 const GLuint kMinFragmentInputComponents = 60; 380 const GLuint kMinFragmentInputComponents = 60;
368 const GLint kMin_MaxProgramTexelOffset = 7; 381 const GLint kMin_MaxProgramTexelOffset = 7;
369 const GLint kMax_MinProgramTexelOffset = -8; 382 const GLint kMax_MinProgramTexelOffset = -8;
370 383
371 if (!QueryGLFeatureU(GL_MAX_VERTEX_OUTPUT_COMPONENTS, 384 if (!QueryGLFeatureU(GL_MAX_VERTEX_OUTPUT_COMPONENTS,
372 kMinVertexOutputComponents, 385 kMinVertexOutputComponents,
373 &max_vertex_output_components_)) { 386 &max_vertex_output_components_)) {
374 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 387 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
375 << "vertex output components is too small (" 388 << "vertex output components is too small ("
376 << max_vertex_output_components_ << ", should be " 389 << max_vertex_output_components_ << ", should be "
377 << kMinVertexOutputComponents << ")."; 390 << kMinVertexOutputComponents << ").";
378 return false; 391 return false;
379 } 392 }
380 if (!QueryGLFeatureU(GL_MAX_FRAGMENT_INPUT_COMPONENTS, 393 if (!QueryGLFeatureU(GL_MAX_FRAGMENT_INPUT_COMPONENTS,
381 kMinFragmentInputComponents, 394 kMinFragmentInputComponents,
382 &max_fragment_input_components_)) { 395 &max_fragment_input_components_)) {
383 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 396 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
384 << "fragment input components is too small (" 397 << "fragment input components is too small ("
385 << max_fragment_input_components_ << ", should be " 398 << max_fragment_input_components_ << ", should be "
386 << kMinFragmentInputComponents << ")."; 399 << kMinFragmentInputComponents << ").";
387 return false; 400 return false;
388 } 401 }
389 if (!QueryGLFeature(GL_MAX_PROGRAM_TEXEL_OFFSET, kMin_MaxProgramTexelOffset, 402 if (!QueryGLFeature(GL_MAX_PROGRAM_TEXEL_OFFSET, kMin_MaxProgramTexelOffset,
390 &max_program_texel_offset_)) { 403 &max_program_texel_offset_)) {
391 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 404 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
392 << "program texel offset is too small (" 405 << "program texel offset is too small ("
393 << max_program_texel_offset_ << ", should be " 406 << max_program_texel_offset_ << ", should be "
394 << kMin_MaxProgramTexelOffset << ")."; 407 << kMin_MaxProgramTexelOffset << ").";
395 return false; 408 return false;
396 } 409 }
397 glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &min_program_texel_offset_); 410 glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &min_program_texel_offset_);
398 if (enforce_gl_minimums_) { 411 if (enforce_gl_minimums_) {
399 min_program_texel_offset_ = 412 min_program_texel_offset_ =
400 std::max(min_program_texel_offset_, kMax_MinProgramTexelOffset); 413 std::max(min_program_texel_offset_, kMax_MinProgramTexelOffset);
401 } 414 }
402 if (min_program_texel_offset_ > kMax_MinProgramTexelOffset) { 415 if (min_program_texel_offset_ > kMax_MinProgramTexelOffset) {
403 LOG(ERROR) << "ContextGroup::Initialize failed because minimum " 416 DLOG(ERROR) << "ContextGroup::Initialize failed because minimum "
404 << "program texel offset is too big (" 417 << "program texel offset is too big ("
405 << min_program_texel_offset_ << ", should be " 418 << min_program_texel_offset_ << ", should be "
406 << kMax_MinProgramTexelOffset << ")."; 419 << kMax_MinProgramTexelOffset << ").";
407 return false; 420 return false;
408 } 421 }
409 422
410 const GLint kES3MinCubeMapSize = 2048; 423 const GLint kES3MinCubeMapSize = 2048;
411 if (max_cube_map_texture_size < kES3MinCubeMapSize) { 424 if (max_cube_map_texture_size < kES3MinCubeMapSize) {
412 LOG(ERROR) << "ContextGroup::Initialize failed because maximum " 425 DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
413 << "cube texture size is too small (" 426 << "cube texture size is too small ("
414 << max_cube_map_texture_size << ", should be " 427 << max_cube_map_texture_size << ", should be "
415 << kES3MinCubeMapSize << ")."; 428 << kES3MinCubeMapSize << ").";
416 return false; 429 return false;
417 } 430 }
418 } 431 }
419 432
420 path_manager_.reset(new PathManager()); 433 path_manager_.reset(new PathManager());
421 434
422 program_manager_.reset( 435 program_manager_.reset(
423 new ProgramManager(program_cache_, max_varying_vectors_, 436 new ProgramManager(program_cache_, max_varying_vectors_,
424 max_dual_source_draw_buffers_, gpu_preferences_, 437 max_dual_source_draw_buffers_, gpu_preferences_,
425 feature_info_.get())); 438 feature_info_.get()));
426 439
427 if (!texture_manager_->Initialize()) { 440 if (!texture_manager_->Initialize()) {
428 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " 441 DLOG(ERROR) << "Context::Group::Initialize failed because texture manager "
429 << "failed to initialize."; 442 << "failed to initialize.";
430 return false; 443 return false;
431 } 444 }
432 445
433 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); 446 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder));
434 return true; 447 return true;
435 } 448 }
436 449
437 namespace { 450 namespace {
438 451
439 bool IsNull(const base::WeakPtr<gles2::GLES2Decoder>& decoder) { 452 bool IsNull(const base::WeakPtr<gles2::GLES2Decoder>& decoder) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 GLuint client_id, GLuint* service_id) const { 597 GLuint client_id, GLuint* service_id) const {
585 Buffer* buffer = buffer_manager_->GetBuffer(client_id); 598 Buffer* buffer = buffer_manager_->GetBuffer(client_id);
586 if (!buffer) 599 if (!buffer)
587 return false; 600 return false;
588 *service_id = buffer->service_id(); 601 *service_id = buffer->service_id();
589 return true; 602 return true;
590 } 603 }
591 604
592 } // namespace gles2 605 } // namespace gles2
593 } // namespace gpu 606 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/framebuffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698