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

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

Issue 79123004: Implemented failIfMajorPerformanceCaveat WebGL context creation attribute. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More comments, logging updates Created 7 years 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 | Annotate | Revision Log
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/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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 GLuint /* service_id */) { 902 GLuint /* service_id */) {
903 } 903 }
904 template<typename T> 904 template<typename T>
905 void LogClientServiceForInfo( 905 void LogClientServiceForInfo(
906 T* /* info */, GLuint /* client_id */, const char* /* function_name */) { 906 T* /* info */, GLuint /* client_id */, const char* /* function_name */) {
907 } 907 }
908 #else 908 #else
909 void LogClientServiceMapping( 909 void LogClientServiceMapping(
910 const char* function_name, GLuint client_id, GLuint service_id) { 910 const char* function_name, GLuint client_id, GLuint service_id) {
911 if (service_logging_) { 911 if (service_logging_) {
912 DLOG(INFO) << "[" << logger_.GetLogPrefix() << "] " << function_name 912 VLOG(1) << "[" << logger_.GetLogPrefix() << "] " << function_name
913 << ": client_id = " << client_id 913 << ": client_id = " << client_id
914 << ", service_id = " << service_id; 914 << ", service_id = " << service_id;
915 } 915 }
916 } 916 }
917 template<typename T> 917 template<typename T>
918 void LogClientServiceForInfo( 918 void LogClientServiceForInfo(
919 T* info, GLuint client_id, const char* function_name) { 919 T* info, GLuint client_id, const char* function_name) {
920 if (info) { 920 if (info) {
921 LogClientServiceMapping(function_name, client_id, info->service_id()); 921 LogClientServiceMapping(function_name, client_id, info->service_id());
922 } 922 }
923 } 923 }
924 #endif 924 #endif
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 2208
2209 compile_shader_always_succeeds_ = CommandLine::ForCurrentProcess()->HasSwitch( 2209 compile_shader_always_succeeds_ = CommandLine::ForCurrentProcess()->HasSwitch(
2210 switches::kCompileShaderAlwaysSucceeds); 2210 switches::kCompileShaderAlwaysSucceeds);
2211 2211
2212 2212
2213 // Take ownership of the context and surface. The surface can be replaced with 2213 // Take ownership of the context and surface. The surface can be replaced with
2214 // SetSurface. 2214 // SetSurface.
2215 context_ = context; 2215 context_ = context;
2216 surface_ = surface; 2216 surface_ = surface;
2217 2217
2218 ContextCreationAttribHelper attrib_parser;
2219 if (!attrib_parser.Parse(attribs))
2220 return false;
2221
2222 // If the failIfMajorPerformanceCaveat context creation attribute was true
2223 // and we are using a software renderer, fail.
2224 if (attrib_parser.fail_if_major_perf_caveat_ &&
2225 feature_info_->feature_flags().is_swiftshader) {
2226 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2227 Destroy(true);
2228 return false;
2229 }
2230
2218 if (!group_->Initialize(this, disallowed_features)) { 2231 if (!group_->Initialize(this, disallowed_features)) {
2219 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " 2232 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group "
2220 << "failed to initialize."; 2233 << "failed to initialize.";
2221 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. 2234 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2222 Destroy(true); 2235 Destroy(true);
2223 return false; 2236 return false;
2224 } 2237 }
2225 CHECK_GL_ERROR(); 2238 CHECK_GL_ERROR();
2226 2239
2227 disallowed_features_ = disallowed_features; 2240 disallowed_features_ = disallowed_features;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP); 2283 ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP);
2271 state_.texture_units[tt].bound_texture_cube_map = ref; 2284 state_.texture_units[tt].bound_texture_cube_map = ref;
2272 glBindTexture(GL_TEXTURE_CUBE_MAP, ref->service_id()); 2285 glBindTexture(GL_TEXTURE_CUBE_MAP, ref->service_id());
2273 ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D); 2286 ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D);
2274 state_.texture_units[tt].bound_texture_2d = ref; 2287 state_.texture_units[tt].bound_texture_2d = ref;
2275 glBindTexture(GL_TEXTURE_2D, ref->service_id()); 2288 glBindTexture(GL_TEXTURE_2D, ref->service_id());
2276 } 2289 }
2277 glActiveTexture(GL_TEXTURE0); 2290 glActiveTexture(GL_TEXTURE0);
2278 CHECK_GL_ERROR(); 2291 CHECK_GL_ERROR();
2279 2292
2280 ContextCreationAttribHelper attrib_parser;
2281 if (!attrib_parser.Parse(attribs))
2282 return false;
2283
2284 if (offscreen) { 2293 if (offscreen) {
2285 if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 && 2294 if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 &&
2286 features().chromium_framebuffer_multisample) { 2295 features().chromium_framebuffer_multisample) {
2287 // Per ext_framebuffer_multisample spec, need max bound on sample count. 2296 // Per ext_framebuffer_multisample spec, need max bound on sample count.
2288 // max_sample_count must be initialized to a sane value. If 2297 // max_sample_count must be initialized to a sane value. If
2289 // glGetIntegerv() throws a GL error, it leaves its argument unchanged. 2298 // glGetIntegerv() throws a GL error, it leaves its argument unchanged.
2290 GLint max_sample_count = 1; 2299 GLint max_sample_count = 1;
2291 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); 2300 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count);
2292 offscreen_target_samples_ = std::min(attrib_parser.samples_, 2301 offscreen_target_samples_ = std::min(attrib_parser.samples_,
2293 max_sample_count); 2302 max_sample_count);
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3474 // Note: args is a pointer to the command buffer. As such, it could be changed 3483 // Note: args is a pointer to the command buffer. As such, it could be changed
3475 // by a (malicious) client at any time, so if validation has to happen, it 3484 // by a (malicious) client at any time, so if validation has to happen, it
3476 // should operate on a copy of them. 3485 // should operate on a copy of them.
3477 error::Error GLES2DecoderImpl::DoCommand( 3486 error::Error GLES2DecoderImpl::DoCommand(
3478 unsigned int command, 3487 unsigned int command,
3479 unsigned int arg_count, 3488 unsigned int arg_count,
3480 const void* cmd_data) { 3489 const void* cmd_data) {
3481 error::Error result = error::kNoError; 3490 error::Error result = error::kNoError;
3482 if (log_commands()) { 3491 if (log_commands()) {
3483 // TODO(notme): Change this to a LOG/VLOG that works in release. Tried 3492 // TODO(notme): Change this to a LOG/VLOG that works in release. Tried
3484 // LOG(INFO), tried VLOG(1), no luck. 3493 // VLOG(1), no luck.
3485 LOG(ERROR) << "[" << logger_.GetLogPrefix() << "]" << "cmd: " 3494 LOG(ERROR) << "[" << logger_.GetLogPrefix() << "]" << "cmd: "
3486 << GetCommandName(command); 3495 << GetCommandName(command);
3487 } 3496 }
3488 unsigned int command_index = command - kStartPoint - 1; 3497 unsigned int command_index = command - kStartPoint - 1;
3489 if (command_index < arraysize(g_command_info)) { 3498 if (command_index < arraysize(g_command_info)) {
3490 const CommandInfo& info = g_command_info[command_index]; 3499 const CommandInfo& info = g_command_info[command_index];
3491 unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count); 3500 unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count);
3492 if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) || 3501 if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) ||
3493 (info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) { 3502 (info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) {
3494 uint32 immediate_data_size = 3503 uint32 immediate_data_size =
(...skipping 7002 matching lines...) Expand 10 before | Expand all | Expand 10 after
10497 DoDidUseTexImageIfNeeded(texture, texture->target()); 10506 DoDidUseTexImageIfNeeded(texture, texture->target());
10498 } 10507 }
10499 10508
10500 // Include the auto-generated part of this file. We split this because it means 10509 // Include the auto-generated part of this file. We split this because it means
10501 // we can easily edit the non-auto generated parts right here in this file 10510 // we can easily edit the non-auto generated parts right here in this file
10502 // instead of having to edit some template or the code generator. 10511 // instead of having to edit some template or the code generator.
10503 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10512 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10504 10513
10505 } // namespace gles2 10514 } // namespace gles2
10506 } // namespace gpu 10515 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698