| 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 2933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | |
| 2971 should_use_native_gmb_for_backbuffer_ = | 2954 should_use_native_gmb_for_backbuffer_ = |
| 2972 attrib_helper.should_use_native_gmb_for_backbuffer; | 2955 attrib_helper.should_use_native_gmb_for_backbuffer; |
| 2973 if (should_use_native_gmb_for_backbuffer_) { | 2956 if (should_use_native_gmb_for_backbuffer_) { |
| 2974 gpu::ImageFactory* image_factory = group_->image_factory(); | 2957 gpu::ImageFactory* image_factory = group_->image_factory(); |
| 2975 bool supported = false; | 2958 bool supported = false; |
| 2976 if (image_factory) { | 2959 if (image_factory) { |
| 2977 switch (image_factory->RequiredTextureType()) { | 2960 switch (image_factory->RequiredTextureType()) { |
| 2978 case GL_TEXTURE_RECTANGLE_ARB: | 2961 case GL_TEXTURE_RECTANGLE_ARB: |
| 2979 supported = feature_info_->feature_flags().arb_texture_rectangle; | 2962 supported = feature_info_->feature_flags().arb_texture_rectangle; |
| 2980 break; | 2963 break; |
| 2981 case GL_TEXTURE_2D: | 2964 case GL_TEXTURE_2D: |
| 2982 supported = true; | 2965 supported = true; |
| 2983 break; | 2966 break; |
| 2984 default: | 2967 default: |
| 2985 break; | 2968 break; |
| 2986 } | 2969 } |
| 2987 } | 2970 } |
| 2988 | 2971 |
| 2989 if (!supported) { | 2972 if (!supported) { |
| 2973 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
| 2990 Destroy(true); | 2974 Destroy(true); |
| 2991 return false; | 2975 return false; |
| 2992 } | 2976 } |
| 2993 } | 2977 } |
| 2994 | 2978 |
| 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 |
| 2995 bool needs_emulation = feature_info_->gl_version_info().IsLowerThanGL(4, 2); | 2996 bool needs_emulation = feature_info_->gl_version_info().IsLowerThanGL(4, 2); |
| 2996 transform_feedback_manager_.reset(new TransformFeedbackManager( | 2997 transform_feedback_manager_.reset(new TransformFeedbackManager( |
| 2997 group_->max_transform_feedback_separate_attribs(), needs_emulation)); | 2998 group_->max_transform_feedback_separate_attribs(), needs_emulation)); |
| 2998 | 2999 |
| 2999 if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || | 3000 if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || |
| 3000 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3) { | 3001 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3) { |
| 3001 if (!feature_info_->IsES3Capable()) { | 3002 if (!feature_info_->IsES3Capable()) { |
| 3002 LOG(ERROR) << "Underlying driver does not support ES3."; | 3003 LOG(ERROR) << "Underlying driver does not support ES3."; |
| 3003 Destroy(true); | 3004 Destroy(true); |
| 3004 return false; | 3005 return false; |
| (...skipping 14082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17087 } | 17088 } |
| 17088 | 17089 |
| 17089 // Include the auto-generated part of this file. We split this because it means | 17090 // Include the auto-generated part of this file. We split this because it means |
| 17090 // we can easily edit the non-auto generated parts right here in this file | 17091 // we can easily edit the non-auto generated parts right here in this file |
| 17091 // instead of having to edit some template or the code generator. | 17092 // instead of having to edit some template or the code generator. |
| 17092 #include "base/macros.h" | 17093 #include "base/macros.h" |
| 17093 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17094 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17094 | 17095 |
| 17095 } // namespace gles2 | 17096 } // namespace gles2 |
| 17096 } // namespace gpu | 17097 } // namespace gpu |
| OLD | NEW |