Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index 2b792130c00fe8cfa55c2bff58e1790879ceacc6..c121fa2fc507a97616cf44d2984ed440a3e91c88 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -2215,6 +2215,19 @@ bool GLES2DecoderImpl::Initialize( |
context_ = context; |
surface_ = surface; |
+ ContextCreationAttribHelper attrib_parser; |
+ if (!attrib_parser.Parse(attribs)) |
+ return false; |
+ |
+ // If the failIfMajorPerformanceCaveat context creation attribute was true |
+ // and we are using a software renderer, fail. |
+ if (attrib_parser.fail_if_major_perf_caveat_ && |
+ feature_info_->feature_flags().is_swiftshader) { |
+ group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
+ Destroy(true); |
+ return false; |
+ } |
+ |
if (!group_->Initialize(this, disallowed_features)) { |
LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
<< "failed to initialize."; |
@@ -2277,10 +2290,6 @@ bool GLES2DecoderImpl::Initialize( |
glActiveTexture(GL_TEXTURE0); |
CHECK_GL_ERROR(); |
- ContextCreationAttribHelper attrib_parser; |
- if (!attrib_parser.Parse(attribs)) |
- return false; |
- |
if (offscreen) { |
if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 && |
features().chromium_framebuffer_multisample) { |