 Chromium Code Reviews
 Chromium Code Reviews Issue 79123004:
  Implemented failIfMajorPerformanceCaveat WebGL context creation attribute.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 79123004:
  Implemented failIfMajorPerformanceCaveat WebGL context creation attribute.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| OLD | NEW | 
|---|---|
| 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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 
| 6 | 6 | 
| 7 #include <stdio.h> | 7 #include <stdio.h> | 
| 8 | 8 | 
| 9 #include <algorithm> | 9 #include <algorithm> | 
| 10 #include <list> | 10 #include <list> | 
| (...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2274 state_.texture_units[tt].bound_texture_2d = ref; | 2274 state_.texture_units[tt].bound_texture_2d = ref; | 
| 2275 glBindTexture(GL_TEXTURE_2D, ref->service_id()); | 2275 glBindTexture(GL_TEXTURE_2D, ref->service_id()); | 
| 2276 } | 2276 } | 
| 2277 glActiveTexture(GL_TEXTURE0); | 2277 glActiveTexture(GL_TEXTURE0); | 
| 2278 CHECK_GL_ERROR(); | 2278 CHECK_GL_ERROR(); | 
| 2279 | 2279 | 
| 2280 ContextCreationAttribHelper attrib_parser; | 2280 ContextCreationAttribHelper attrib_parser; | 
| 2281 if (!attrib_parser.Parse(attribs)) | 2281 if (!attrib_parser.Parse(attribs)) | 
| 2282 return false; | 2282 return false; | 
| 2283 | 2283 | 
| 2284 // If the failIfMajorPerformanceCaveat context creation attribute was true | |
| 2285 // and we are using a software renderer, fail. | |
| 2286 if (attrib_parser.fail_if_major_perf_caveat_) { | |
| 2287 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 2288 if (command_line->HasSwitch(switches::kUseGL)) { | |
| 
Zhenyao Mo
2013/11/20 22:44:57
You don't have to check here.  If kUseGL is not th
 | |
| 2289 std::string requested_implementation_name = | |
| 2290 command_line->GetSwitchValueASCII(switches::kUseGL); | |
| 2291 if (requested_implementation_name == "swiftshader") { | |
| 
piman
2013/11/20 22:44:55
Can we move the logic about "is this swiftshader"
 | |
| 2292 Destroy(true); | |
| 2293 return false; | |
| 
Ken Russell (switch to Gerrit)
2013/11/20 22:39:02
How has this been tested?
 | |
| 2294 } | |
| 2295 } | |
| 2296 } | |
| 2297 | |
| 2284 if (offscreen) { | 2298 if (offscreen) { | 
| 2285 if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 && | 2299 if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 && | 
| 2286 features().chromium_framebuffer_multisample) { | 2300 features().chromium_framebuffer_multisample) { | 
| 2287 // Per ext_framebuffer_multisample spec, need max bound on sample count. | 2301 // Per ext_framebuffer_multisample spec, need max bound on sample count. | 
| 2288 // max_sample_count must be initialized to a sane value. If | 2302 // max_sample_count must be initialized to a sane value. If | 
| 2289 // glGetIntegerv() throws a GL error, it leaves its argument unchanged. | 2303 // glGetIntegerv() throws a GL error, it leaves its argument unchanged. | 
| 2290 GLint max_sample_count = 1; | 2304 GLint max_sample_count = 1; | 
| 2291 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); | 2305 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); | 
| 2292 offscreen_target_samples_ = std::min(attrib_parser.samples_, | 2306 offscreen_target_samples_ = std::min(attrib_parser.samples_, | 
| 2293 max_sample_count); | 2307 max_sample_count); | 
| (...skipping 8217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10511 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10525 DoDidUseTexImageIfNeeded(texture, texture->target()); | 
| 10512 } | 10526 } | 
| 10513 | 10527 | 
| 10514 // Include the auto-generated part of this file. We split this because it means | 10528 // Include the auto-generated part of this file. We split this because it means | 
| 10515 // we can easily edit the non-auto generated parts right here in this file | 10529 // we can easily edit the non-auto generated parts right here in this file | 
| 10516 // instead of having to edit some template or the code generator. | 10530 // instead of having to edit some template or the code generator. | 
| 10517 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10531 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 
| 10518 | 10532 | 
| 10519 } // namespace gles2 | 10533 } // namespace gles2 | 
| 10520 } // namespace gpu | 10534 } // namespace gpu | 
| OLD | NEW |