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

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

Issue 2121293004: Reland of Fix initialization ordering in GLES2CmdDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/tests/gl_manager.h » ('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/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 2933 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 if (feature_info_->workarounds().disable_timestamp_queries) { 2944 if (feature_info_->workarounds().disable_timestamp_queries) {
2945 // Forcing time elapsed query for any GPU Timing Client forces it for all 2945 // Forcing time elapsed query for any GPU Timing Client forces it for all
2946 // clients in the context. 2946 // clients in the context.
2947 GetGLContext()->CreateGPUTimingClient()->ForceTimeElapsedQuery(); 2947 GetGLContext()->CreateGPUTimingClient()->ForceTimeElapsedQuery();
2948 } 2948 }
2949 2949
2950 // Save the loseContextWhenOutOfMemory context creation attribute. 2950 // Save the loseContextWhenOutOfMemory context creation attribute.
2951 lose_context_when_out_of_memory_ = 2951 lose_context_when_out_of_memory_ =
2952 attrib_helper.lose_context_when_out_of_memory; 2952 attrib_helper.lose_context_when_out_of_memory;
2953 2953
2954 // If the failIfMajorPerformanceCaveat context creation attribute was true
2955 // and we are using a software renderer, fail.
2956 if (attrib_helper.fail_if_major_perf_caveat &&
2957 feature_info_->feature_flags().is_swiftshader) {
2958 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2959 Destroy(true);
2960 return false;
2961 }
2962
2963 if (!group_->Initialize(this, attrib_helper.context_type,
2964 disallowed_features)) {
2965 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2966 Destroy(true);
2967 return false;
2968 }
2969 CHECK_GL_ERROR();
2970
2954 should_use_native_gmb_for_backbuffer_ = 2971 should_use_native_gmb_for_backbuffer_ =
2955 attrib_helper.should_use_native_gmb_for_backbuffer; 2972 attrib_helper.should_use_native_gmb_for_backbuffer;
2956 if (should_use_native_gmb_for_backbuffer_) { 2973 if (should_use_native_gmb_for_backbuffer_) {
2957 gpu::ImageFactory* image_factory = group_->image_factory(); 2974 gpu::ImageFactory* image_factory = group_->image_factory();
2958 bool supported = false; 2975 bool supported = false;
2959 if (image_factory) { 2976 if (image_factory) {
2960 switch (image_factory->RequiredTextureType()) { 2977 switch (image_factory->RequiredTextureType()) {
2961 case GL_TEXTURE_RECTANGLE_ARB: 2978 case GL_TEXTURE_RECTANGLE_ARB:
2962 supported = feature_info_->feature_flags().arb_texture_rectangle; 2979 supported = feature_info_->feature_flags().arb_texture_rectangle;
2963 break; 2980 break;
2964 case GL_TEXTURE_2D: 2981 case GL_TEXTURE_2D:
2965 supported = true; 2982 supported = true;
2966 break; 2983 break;
2967 default: 2984 default:
2968 break; 2985 break;
2969 } 2986 }
2970 } 2987 }
2971 2988
2972 if (!supported) { 2989 if (!supported) {
2973 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2974 Destroy(true); 2990 Destroy(true);
2975 return false; 2991 return false;
2976 } 2992 }
2977 } 2993 }
2978 2994
2979 // If the failIfMajorPerformanceCaveat context creation attribute was true
2980 // and we are using a software renderer, fail.
2981 if (attrib_helper.fail_if_major_perf_caveat &&
2982 feature_info_->feature_flags().is_swiftshader) {
2983 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2984 Destroy(true);
2985 return false;
2986 }
2987
2988 if (!group_->Initialize(this, attrib_helper.context_type,
2989 disallowed_features)) {
2990 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2991 Destroy(true);
2992 return false;
2993 }
2994 CHECK_GL_ERROR();
2995
2996 bool needs_emulation = feature_info_->gl_version_info().IsLowerThanGL(4, 2); 2995 bool needs_emulation = feature_info_->gl_version_info().IsLowerThanGL(4, 2);
2997 transform_feedback_manager_.reset(new TransformFeedbackManager( 2996 transform_feedback_manager_.reset(new TransformFeedbackManager(
2998 group_->max_transform_feedback_separate_attribs(), needs_emulation)); 2997 group_->max_transform_feedback_separate_attribs(), needs_emulation));
2999 2998
3000 if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || 2999 if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 ||
3001 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3) { 3000 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3) {
3002 if (!feature_info_->IsES3Capable()) { 3001 if (!feature_info_->IsES3Capable()) {
3003 LOG(ERROR) << "Underlying driver does not support ES3."; 3002 LOG(ERROR) << "Underlying driver does not support ES3.";
3004 Destroy(true); 3003 Destroy(true);
3005 return false; 3004 return false;
(...skipping 14082 matching lines...) Expand 10 before | Expand all | Expand 10 after
17088 } 17087 }
17089 17088
17090 // Include the auto-generated part of this file. We split this because it means 17089 // Include the auto-generated part of this file. We split this because it means
17091 // we can easily edit the non-auto generated parts right here in this file 17090 // we can easily edit the non-auto generated parts right here in this file
17092 // instead of having to edit some template or the code generator. 17091 // instead of having to edit some template or the code generator.
17093 #include "base/macros.h" 17092 #include "base/macros.h"
17094 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17093 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17095 17094
17096 } // namespace gles2 17095 } // namespace gles2
17097 } // namespace gpu 17096 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698