Chromium Code Reviews| 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 <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 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2945 if (feature_info_->workarounds().disable_timestamp_queries) { | 2945 if (feature_info_->workarounds().disable_timestamp_queries) { |
| 2946 // Forcing time elapsed query for any GPU Timing Client forces it for all | 2946 // Forcing time elapsed query for any GPU Timing Client forces it for all |
| 2947 // clients in the context. | 2947 // clients in the context. |
| 2948 GetGLContext()->CreateGPUTimingClient()->ForceTimeElapsedQuery(); | 2948 GetGLContext()->CreateGPUTimingClient()->ForceTimeElapsedQuery(); |
| 2949 } | 2949 } |
| 2950 | 2950 |
| 2951 // Save the loseContextWhenOutOfMemory context creation attribute. | 2951 // Save the loseContextWhenOutOfMemory context creation attribute. |
| 2952 lose_context_when_out_of_memory_ = | 2952 lose_context_when_out_of_memory_ = |
| 2953 attrib_helper.lose_context_when_out_of_memory; | 2953 attrib_helper.lose_context_when_out_of_memory; |
| 2954 | 2954 |
| 2955 // If the failIfMajorPerformanceCaveat context creation attribute was true | |
| 2956 // and we are using a software renderer, fail. | |
| 2957 if (attrib_helper.fail_if_major_perf_caveat && | |
| 2958 feature_info_->feature_flags().is_swiftshader) { | |
| 2959 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | |
| 2960 Destroy(true); | |
| 2961 return false; | |
| 2962 } | |
| 2963 | |
| 2964 if (!group_->Initialize(this, attrib_helper.context_type, | |
| 2965 disallowed_features)) { | |
| 2966 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | |
| 2967 Destroy(true); | |
| 2968 return false; | |
| 2969 } | |
| 2970 CHECK_GL_ERROR(); | |
| 2971 | |
| 2955 should_use_native_gmb_for_backbuffer_ = | 2972 should_use_native_gmb_for_backbuffer_ = |
| 2956 attrib_helper.should_use_native_gmb_for_backbuffer; | 2973 attrib_helper.should_use_native_gmb_for_backbuffer; |
| 2957 if (should_use_native_gmb_for_backbuffer_) { | 2974 if (should_use_native_gmb_for_backbuffer_) { |
| 2958 gpu::ImageFactory* image_factory = group_->image_factory(); | 2975 gpu::ImageFactory* image_factory = group_->image_factory(); |
| 2959 bool supported = false; | 2976 bool supported = false; |
| 2960 if (image_factory) { | 2977 if (image_factory) { |
| 2961 switch (image_factory->RequiredTextureType()) { | 2978 switch (image_factory->RequiredTextureType()) { |
| 2962 case GL_TEXTURE_RECTANGLE_ARB: | 2979 case GL_TEXTURE_RECTANGLE_ARB: |
| 2963 supported = feature_info_->feature_flags().arb_texture_rectangle; | 2980 supported = feature_info_->feature_flags().arb_texture_rectangle; |
| 2964 break; | 2981 break; |
| 2965 case GL_TEXTURE_2D: | 2982 case GL_TEXTURE_2D: |
| 2966 supported = true; | 2983 supported = true; |
| 2967 break; | 2984 break; |
| 2968 default: | 2985 default: |
| 2969 break; | 2986 break; |
| 2970 } | 2987 } |
| 2971 } | 2988 } |
| 2972 | 2989 |
| 2973 if (!supported) { | 2990 if (!supported) { |
| 2974 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | 2991 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
|
piman
2016/06/28 23:07:33
group_ is initialized at this point, so this line
erikchen
2016/07/06 21:32:09
Done.
| |
| 2975 Destroy(true); | 2992 Destroy(true); |
| 2976 return false; | 2993 return false; |
| 2977 } | 2994 } |
| 2978 } | 2995 } |
| 2979 | 2996 |
| 2980 // If the failIfMajorPerformanceCaveat context creation attribute was true | |
| 2981 // and we are using a software renderer, fail. | |
| 2982 if (attrib_helper.fail_if_major_perf_caveat && | |
| 2983 feature_info_->feature_flags().is_swiftshader) { | |
| 2984 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | |
| 2985 Destroy(true); | |
| 2986 return false; | |
| 2987 } | |
| 2988 | |
| 2989 if (!group_->Initialize(this, attrib_helper.context_type, | |
| 2990 disallowed_features)) { | |
| 2991 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | |
| 2992 Destroy(true); | |
| 2993 return false; | |
| 2994 } | |
| 2995 CHECK_GL_ERROR(); | |
| 2996 | |
| 2997 bool needs_emulation = feature_info_->gl_version_info().IsLowerThanGL(4, 2); | 2997 bool needs_emulation = feature_info_->gl_version_info().IsLowerThanGL(4, 2); |
| 2998 transform_feedback_manager_.reset(new TransformFeedbackManager( | 2998 transform_feedback_manager_.reset(new TransformFeedbackManager( |
| 2999 group_->max_transform_feedback_separate_attribs(), needs_emulation)); | 2999 group_->max_transform_feedback_separate_attribs(), needs_emulation)); |
| 3000 | 3000 |
| 3001 if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || | 3001 if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || |
| 3002 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3) { | 3002 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3) { |
| 3003 if (!feature_info_->IsES3Capable()) { | 3003 if (!feature_info_->IsES3Capable()) { |
| 3004 LOG(ERROR) << "Underlying driver does not support ES3."; | 3004 LOG(ERROR) << "Underlying driver does not support ES3."; |
| 3005 Destroy(true); | 3005 Destroy(true); |
| 3006 return false; | 3006 return false; |
| (...skipping 14040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17047 } | 17047 } |
| 17048 | 17048 |
| 17049 // Include the auto-generated part of this file. We split this because it means | 17049 // Include the auto-generated part of this file. We split this because it means |
| 17050 // we can easily edit the non-auto generated parts right here in this file | 17050 // we can easily edit the non-auto generated parts right here in this file |
| 17051 // instead of having to edit some template or the code generator. | 17051 // instead of having to edit some template or the code generator. |
| 17052 #include "base/macros.h" | 17052 #include "base/macros.h" |
| 17053 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17053 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17054 | 17054 |
| 17055 } // namespace gles2 | 17055 } // namespace gles2 |
| 17056 } // namespace gpu | 17056 } // namespace gpu |
| OLD | NEW |