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

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

Issue 1143393007: Teach GPU command buffer whether a context is webgl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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 <cmath> 10 #include <cmath>
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 } 834 }
835 835
836 bool EnsureGPUMemoryAvailable(size_t estimated_size) { 836 bool EnsureGPUMemoryAvailable(size_t estimated_size) {
837 MemoryTracker* tracker = memory_tracker(); 837 MemoryTracker* tracker = memory_tracker();
838 if (tracker) { 838 if (tracker) {
839 return tracker->EnsureGPUMemoryAvailable(estimated_size); 839 return tracker->EnsureGPUMemoryAvailable(estimated_size);
840 } 840 }
841 return true; 841 return true;
842 } 842 }
843 843
844 bool IsWebGLContext() const {
845 return webgl_version_ == 1 || webgl_version_ == 2;
846 }
847
844 bool IsOffscreenBufferMultisampled() const { 848 bool IsOffscreenBufferMultisampled() const {
845 return offscreen_target_samples_ > 1; 849 return offscreen_target_samples_ > 1;
846 } 850 }
847 851
848 // Creates a Texture for the given texture. 852 // Creates a Texture for the given texture.
849 TextureRef* CreateTexture( 853 TextureRef* CreateTexture(
850 GLuint client_id, GLuint service_id) { 854 GLuint client_id, GLuint service_id) {
851 return texture_manager()->CreateTexture(client_id, service_id); 855 return texture_manager()->CreateTexture(client_id, service_id);
852 } 856 }
853 857
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 1942
1939 // Number of commands remaining to be processed in DoCommands(). 1943 // Number of commands remaining to be processed in DoCommands().
1940 int commands_to_process_; 1944 int commands_to_process_;
1941 1945
1942 bool has_robustness_extension_; 1946 bool has_robustness_extension_;
1943 error::ContextLostReason context_lost_reason_; 1947 error::ContextLostReason context_lost_reason_;
1944 bool context_was_lost_; 1948 bool context_was_lost_;
1945 bool reset_by_robustness_extension_; 1949 bool reset_by_robustness_extension_;
1946 bool supports_post_sub_buffer_; 1950 bool supports_post_sub_buffer_;
1947 1951
1952 // Indicates whether this is a context for WebGL1, WebGL2, or others.
1953 // 0: other types
1954 // 1: WebGL 1
1955 // 2: WebGL 2
1956 unsigned webgl_version_;
1957
1948 // These flags are used to override the state of the shared feature_info_ 1958 // These flags are used to override the state of the shared feature_info_
1949 // member. Because the same FeatureInfo instance may be shared among many 1959 // member. Because the same FeatureInfo instance may be shared among many
1950 // contexts, the assumptions on the availablity of extensions in WebGL 1960 // contexts, the assumptions on the availablity of extensions in WebGL
1951 // contexts may be broken. These flags override the shared state to preserve 1961 // contexts may be broken. These flags override the shared state to preserve
1952 // WebGL semantics. 1962 // WebGL semantics.
1953 bool force_webgl_glsl_validation_;
1954 bool derivatives_explicitly_enabled_; 1963 bool derivatives_explicitly_enabled_;
1955 bool frag_depth_explicitly_enabled_; 1964 bool frag_depth_explicitly_enabled_;
1956 bool draw_buffers_explicitly_enabled_; 1965 bool draw_buffers_explicitly_enabled_;
1957 bool shader_texture_lod_explicitly_enabled_; 1966 bool shader_texture_lod_explicitly_enabled_;
1958 1967
1959 bool compile_shader_always_succeeds_; 1968 bool compile_shader_always_succeeds_;
1960 1969
1961 // An optional behaviour to lose the context and group when OOM. 1970 // An optional behaviour to lose the context and group when OOM.
1962 bool lose_context_when_out_of_memory_; 1971 bool lose_context_when_out_of_memory_;
1963 1972
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 current_decoder_error_(error::kNoError), 2491 current_decoder_error_(error::kNoError),
2483 use_shader_translator_(true), 2492 use_shader_translator_(true),
2484 validators_(group_->feature_info()->validators()), 2493 validators_(group_->feature_info()->validators()),
2485 feature_info_(group_->feature_info()), 2494 feature_info_(group_->feature_info()),
2486 frame_number_(0), 2495 frame_number_(0),
2487 has_robustness_extension_(false), 2496 has_robustness_extension_(false),
2488 context_lost_reason_(error::kUnknown), 2497 context_lost_reason_(error::kUnknown),
2489 context_was_lost_(false), 2498 context_was_lost_(false),
2490 reset_by_robustness_extension_(false), 2499 reset_by_robustness_extension_(false),
2491 supports_post_sub_buffer_(false), 2500 supports_post_sub_buffer_(false),
2492 force_webgl_glsl_validation_(false), 2501 webgl_version_(0),
2493 derivatives_explicitly_enabled_(false), 2502 derivatives_explicitly_enabled_(false),
2494 frag_depth_explicitly_enabled_(false), 2503 frag_depth_explicitly_enabled_(false),
2495 draw_buffers_explicitly_enabled_(false), 2504 draw_buffers_explicitly_enabled_(false),
2496 shader_texture_lod_explicitly_enabled_(false), 2505 shader_texture_lod_explicitly_enabled_(false),
2497 compile_shader_always_succeeds_(false), 2506 compile_shader_always_succeeds_(false),
2498 lose_context_when_out_of_memory_(false), 2507 lose_context_when_out_of_memory_(false),
2499 service_logging_(base::CommandLine::ForCurrentProcess()->HasSwitch( 2508 service_logging_(base::CommandLine::ForCurrentProcess()->HasSwitch(
2500 switches::kEnableGPUServiceLoggingGPU)), 2509 switches::kEnableGPUServiceLoggingGPU)),
2501 viewport_max_width_(0), 2510 viewport_max_width_(0),
2502 viewport_max_height_(0), 2511 viewport_max_height_(0),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2539 const DisallowedFeatures& disallowed_features, 2548 const DisallowedFeatures& disallowed_features,
2540 const std::vector<int32>& attribs) { 2549 const std::vector<int32>& attribs) {
2541 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); 2550 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize");
2542 DCHECK(context->IsCurrent(surface.get())); 2551 DCHECK(context->IsCurrent(surface.get()));
2543 DCHECK(!context_.get()); 2552 DCHECK(!context_.get());
2544 DCHECK(!offscreen || !offscreen_size.IsEmpty()); 2553 DCHECK(!offscreen || !offscreen_size.IsEmpty());
2545 2554
2546 ContextCreationAttribHelper attrib_parser; 2555 ContextCreationAttribHelper attrib_parser;
2547 if (!attrib_parser.Parse(attribs)) 2556 if (!attrib_parser.Parse(attribs))
2548 return false; 2557 return false;
2558 webgl_version_ = attrib_parser.webgl_version;
2549 2559
2550 surfaceless_ = surface->IsSurfaceless() && !offscreen; 2560 surfaceless_ = surface->IsSurfaceless() && !offscreen;
2551 2561
2552 set_initialized(); 2562 set_initialized();
2553 gpu_state_tracer_ = GPUStateTracer::Create(&state_); 2563 gpu_state_tracer_ = GPUStateTracer::Create(&state_);
2554 2564
2555 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2565 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2556 switches::kEnableGPUDebugging)) { 2566 switches::kEnableGPUDebugging)) {
2557 set_debug(true); 2567 set_debug(true);
2558 } 2568 }
(...skipping 21 matching lines...) Expand all
2580 2590
2581 // If the failIfMajorPerformanceCaveat context creation attribute was true 2591 // If the failIfMajorPerformanceCaveat context creation attribute was true
2582 // and we are using a software renderer, fail. 2592 // and we are using a software renderer, fail.
2583 if (attrib_parser.fail_if_major_perf_caveat && 2593 if (attrib_parser.fail_if_major_perf_caveat &&
2584 feature_info_->feature_flags().is_swiftshader) { 2594 feature_info_->feature_flags().is_swiftshader) {
2585 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. 2595 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2586 Destroy(true); 2596 Destroy(true);
2587 return false; 2597 return false;
2588 } 2598 }
2589 2599
2590 if (!group_->Initialize(this, disallowed_features)) { 2600 disallowed_features_ = disallowed_features;
2601 if (webgl_version_ == 1) {
2602 disallowed_features_.npot_support = true;
2603 }
2604
2605 if (!group_->Initialize(this, disallowed_features_)) {
2591 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " 2606 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group "
2592 << "failed to initialize."; 2607 << "failed to initialize.";
2593 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. 2608 group_ = NULL; // Must not destroy ContextGroup if it is not initialized.
2594 Destroy(true); 2609 Destroy(true);
2595 return false; 2610 return false;
2596 } 2611 }
2597 CHECK_GL_ERROR(); 2612 CHECK_GL_ERROR();
2598 2613
2599 if (attrib_parser.es3_context_required && 2614 if (feature_info_->IsES3Capable()) {
piman 2015/06/08 21:40:21 Don't we want to keep this? I assume we don't want
Zhenyao Mo 2015/06/08 22:23:22 I am OK with only exposing ES3 for WebGL 2 for now
2600 feature_info_->IsES3Capable()) {
2601 feature_info_->EnableES3Validators(); 2615 feature_info_->EnableES3Validators();
2602 set_unsafe_es3_apis_enabled(true); 2616 set_unsafe_es3_apis_enabled(true);
2603 } 2617 }
2604 2618
2605 disallowed_features_ = disallowed_features;
2606
2607 state_.attrib_values.resize(group_->max_vertex_attribs()); 2619 state_.attrib_values.resize(group_->max_vertex_attribs());
2608 vertex_array_manager_.reset(new VertexArrayManager()); 2620 vertex_array_manager_.reset(new VertexArrayManager());
2609 2621
2610 GLuint default_vertex_attrib_service_id = 0; 2622 GLuint default_vertex_attrib_service_id = 0;
2611 if (features().native_vertex_array_object) { 2623 if (features().native_vertex_array_object) {
2612 glGenVertexArraysOES(1, &default_vertex_attrib_service_id); 2624 glGenVertexArraysOES(1, &default_vertex_attrib_service_id);
2613 glBindVertexArrayOES(default_vertex_attrib_service_id); 2625 glBindVertexArrayOES(default_vertex_attrib_service_id);
2614 } 2626 }
2615 2627
2616 state_.default_vertex_attrib_manager = 2628 state_.default_vertex_attrib_manager =
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 resources.MaxExpressionComplexity = 256; 3135 resources.MaxExpressionComplexity = 256;
3124 resources.MaxCallStackDepth = 256; 3136 resources.MaxCallStackDepth = 256;
3125 3137
3126 GLint range[2] = { 0, 0 }; 3138 GLint range[2] = { 0, 0 };
3127 GLint precision = 0; 3139 GLint precision = 0;
3128 GetShaderPrecisionFormatImpl(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, 3140 GetShaderPrecisionFormatImpl(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT,
3129 range, &precision); 3141 range, &precision);
3130 resources.FragmentPrecisionHigh = 3142 resources.FragmentPrecisionHigh =
3131 PrecisionMeetsSpecForHighpFloat(range[0], range[1], precision); 3143 PrecisionMeetsSpecForHighpFloat(range[0], range[1], precision);
3132 3144
3133 if (force_webgl_glsl_validation_) { 3145 if (IsWebGLContext()) {
3134 resources.OES_standard_derivatives = derivatives_explicitly_enabled_; 3146 resources.OES_standard_derivatives = derivatives_explicitly_enabled_;
3135 resources.EXT_frag_depth = frag_depth_explicitly_enabled_; 3147 resources.EXT_frag_depth = frag_depth_explicitly_enabled_;
3136 resources.EXT_draw_buffers = draw_buffers_explicitly_enabled_; 3148 resources.EXT_draw_buffers = draw_buffers_explicitly_enabled_;
3137 if (!draw_buffers_explicitly_enabled_) 3149 if (!draw_buffers_explicitly_enabled_)
3138 resources.MaxDrawBuffers = 1; 3150 resources.MaxDrawBuffers = 1;
3139 resources.EXT_shader_texture_lod = shader_texture_lod_explicitly_enabled_; 3151 resources.EXT_shader_texture_lod = shader_texture_lod_explicitly_enabled_;
3140 resources.NV_draw_buffers = 3152 resources.NV_draw_buffers =
3141 draw_buffers_explicitly_enabled_ && features().nv_draw_buffers; 3153 draw_buffers_explicitly_enabled_ && features().nv_draw_buffers;
3142 } else { 3154 } else {
3143 resources.OES_standard_derivatives = 3155 resources.OES_standard_derivatives =
3144 features().oes_standard_derivatives ? 1 : 0; 3156 features().oes_standard_derivatives ? 1 : 0;
3145 resources.ARB_texture_rectangle = 3157 resources.ARB_texture_rectangle =
3146 features().arb_texture_rectangle ? 1 : 0; 3158 features().arb_texture_rectangle ? 1 : 0;
3147 resources.OES_EGL_image_external = 3159 resources.OES_EGL_image_external =
3148 features().oes_egl_image_external ? 1 : 0; 3160 features().oes_egl_image_external ? 1 : 0;
3149 resources.EXT_draw_buffers = 3161 resources.EXT_draw_buffers =
3150 features().ext_draw_buffers ? 1 : 0; 3162 features().ext_draw_buffers ? 1 : 0;
3151 resources.EXT_frag_depth = 3163 resources.EXT_frag_depth =
3152 features().ext_frag_depth ? 1 : 0; 3164 features().ext_frag_depth ? 1 : 0;
3153 resources.EXT_shader_texture_lod = 3165 resources.EXT_shader_texture_lod =
3154 features().ext_shader_texture_lod ? 1 : 0; 3166 features().ext_shader_texture_lod ? 1 : 0;
3155 resources.NV_draw_buffers = 3167 resources.NV_draw_buffers =
3156 features().nv_draw_buffers ? 1 : 0; 3168 features().nv_draw_buffers ? 1 : 0;
3157 } 3169 }
3158 3170
3159 ShShaderSpec shader_spec; 3171 ShShaderSpec shader_spec;
3160 if (force_webgl_glsl_validation_) { 3172 if (IsWebGLContext()) {
3161 shader_spec = unsafe_es3_apis_enabled() ? SH_WEBGL2_SPEC : SH_WEBGL_SPEC; 3173 shader_spec = webgl_version_ == 2 ? SH_WEBGL2_SPEC : SH_WEBGL_SPEC;
3162 } else { 3174 } else {
3163 shader_spec = unsafe_es3_apis_enabled() ? SH_GLES3_SPEC : SH_GLES2_SPEC; 3175 shader_spec = unsafe_es3_apis_enabled() ? SH_GLES3_SPEC : SH_GLES2_SPEC;
3164 } 3176 }
3165 3177
3166 if ((shader_spec == SH_WEBGL_SPEC || shader_spec == SH_WEBGL2_SPEC) && 3178 if ((shader_spec == SH_WEBGL_SPEC || shader_spec == SH_WEBGL2_SPEC) &&
3167 features().enable_shader_name_hashing) 3179 features().enable_shader_name_hashing)
3168 resources.HashFunction = &CityHash64; 3180 resources.HashFunction = &CityHash64;
3169 else 3181 else
3170 resources.HashFunction = NULL; 3182 resources.HashFunction = NULL;
3171 ShaderTranslatorInterface::GlslImplementationType implementation_type = 3183 ShaderTranslatorInterface::GlslImplementationType implementation_type =
(...skipping 5603 matching lines...) Expand 10 before | Expand all | Expand 10 after
8775 GLenum name = static_cast<GLenum>(c.name); 8787 GLenum name = static_cast<GLenum>(c.name);
8776 if (!validators_->string_type.IsValid(name)) { 8788 if (!validators_->string_type.IsValid(name)) {
8777 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); 8789 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name");
8778 return error::kNoError; 8790 return error::kNoError;
8779 } 8791 }
8780 8792
8781 const char* str = nullptr; 8793 const char* str = nullptr;
8782 std::string extensions; 8794 std::string extensions;
8783 switch (name) { 8795 switch (name) {
8784 case GL_VERSION: 8796 case GL_VERSION:
8785 str = "OpenGL ES 2.0 Chromium"; 8797 if (unsafe_es3_apis_enabled())
8798 str = "OpenGL ES 3.0 Chromium";
8799 else
8800 str = "OpenGL ES 2.0 Chromium";
8786 break; 8801 break;
8787 case GL_SHADING_LANGUAGE_VERSION: 8802 case GL_SHADING_LANGUAGE_VERSION:
8788 str = "OpenGL ES GLSL ES 1.0 Chromium"; 8803 if (unsafe_es3_apis_enabled())
8804 str = "OpenGL ES GLSL ES 3.0 Chromium";
8805 else
8806 str = "OpenGL ES GLSL ES 1.0 Chromium";
8789 break; 8807 break;
8790 case GL_RENDERER: 8808 case GL_RENDERER:
8791 case GL_VENDOR: 8809 case GL_VENDOR:
8792 // Return the unmasked VENDOR/RENDERER string for WebGL contexts. 8810 // Return the unmasked VENDOR/RENDERER string for WebGL contexts.
8793 // They are used by WEBGL_debug_renderer_info. 8811 // They are used by WEBGL_debug_renderer_info.
8794 if (!force_webgl_glsl_validation_) 8812 if (!IsWebGLContext())
8795 str = "Chromium"; 8813 str = "Chromium";
8796 else 8814 else
8797 str = reinterpret_cast<const char*>(glGetString(name)); 8815 str = reinterpret_cast<const char*>(glGetString(name));
8798 break; 8816 break;
8799 case GL_EXTENSIONS: 8817 case GL_EXTENSIONS:
8800 { 8818 {
8801 // For WebGL contexts, strip out the OES derivatives and 8819 // For WebGL contexts, strip out the OES derivatives and
8802 // EXT frag depth extensions if they have not been enabled. 8820 // EXT frag depth extensions if they have not been enabled.
8803 if (force_webgl_glsl_validation_) { 8821 if (IsWebGLContext()) {
8804 extensions = feature_info_->extensions(); 8822 extensions = feature_info_->extensions();
8805 if (!derivatives_explicitly_enabled_) { 8823 if (!derivatives_explicitly_enabled_) {
8806 size_t offset = extensions.find(kOESDerivativeExtension); 8824 size_t offset = extensions.find(kOESDerivativeExtension);
8807 if (std::string::npos != offset) { 8825 if (std::string::npos != offset) {
8808 extensions.replace(offset, arraysize(kOESDerivativeExtension), 8826 extensions.replace(offset, arraysize(kOESDerivativeExtension),
8809 std::string()); 8827 std::string());
8810 } 8828 }
8811 } 8829 }
8812 if (!frag_depth_explicitly_enabled_) { 8830 if (!frag_depth_explicitly_enabled_) {
8813 size_t offset = extensions.find(kEXTFragDepthExtension); 8831 size_t offset = extensions.find(kEXTFragDepthExtension);
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after
11079 // TODO(gman): decide how to remove the need for this const_cast. 11097 // TODO(gman): decide how to remove the need for this const_cast.
11080 // I could make validators_ non const but that seems bad as this is the only 11098 // I could make validators_ non const but that seems bad as this is the only
11081 // place it is needed. I could make some special friend class of validators 11099 // place it is needed. I could make some special friend class of validators
11082 // just to allow this to set them. That seems silly. I could refactor this 11100 // just to allow this to set them. That seems silly. I could refactor this
11083 // code to use the extension mechanism or the initialization attributes to 11101 // code to use the extension mechanism or the initialization attributes to
11084 // turn this feature on. Given that the only real point of this is to make 11102 // turn this feature on. Given that the only real point of this is to make
11085 // the conformance tests pass and given that there is lots of real work that 11103 // the conformance tests pass and given that there is lots of real work that
11086 // needs to be done it seems like refactoring for one to one of those 11104 // needs to be done it seems like refactoring for one to one of those
11087 // methods is a very low priority. 11105 // methods is a very low priority.
11088 const_cast<Validators*>(validators_)->vertex_attrib_type.AddValue(GL_FIXED); 11106 const_cast<Validators*>(validators_)->vertex_attrib_type.AddValue(GL_FIXED);
11089 } else if (feature_str.compare("webgl_enable_glsl_webgl_validation") == 0) {
11090 force_webgl_glsl_validation_ = true;
11091 InitializeShaderTranslator();
Zhenyao Mo 2015/06/07 18:35:07 This second InitializeShaderTranslator() call per
11092 } else { 11107 } else {
11093 return error::kNoError; 11108 return error::kNoError;
11094 } 11109 }
11095 11110
11096 *result = 1; // true. 11111 *result = 1; // true.
11097 return error::kNoError; 11112 return error::kNoError;
11098 } 11113 }
11099 11114
11100 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( 11115 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM(
11101 uint32 immediate_data_size, 11116 uint32 immediate_data_size,
(...skipping 15 matching lines...) Expand all
11117 *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data); 11132 *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data);
11118 Bucket* bucket = GetBucket(c.bucket_id); 11133 Bucket* bucket = GetBucket(c.bucket_id);
11119 if (!bucket || bucket->size() == 0) { 11134 if (!bucket || bucket->size() == 0) {
11120 return error::kInvalidArguments; 11135 return error::kInvalidArguments;
11121 } 11136 }
11122 std::string feature_str; 11137 std::string feature_str;
11123 if (!bucket->GetAsString(&feature_str)) { 11138 if (!bucket->GetAsString(&feature_str)) {
11124 return error::kInvalidArguments; 11139 return error::kInvalidArguments;
11125 } 11140 }
11126 11141
11127 bool desire_webgl_glsl_validation =
11128 feature_str.find("GL_CHROMIUM_webglsl") != std::string::npos;
Zhenyao Mo 2015/06/07 18:35:07 "GL_CHROMIUM_webglsl" was not the correct feature
11129 bool desire_standard_derivatives = false; 11142 bool desire_standard_derivatives = false;
11130 bool desire_frag_depth = false; 11143 bool desire_frag_depth = false;
11131 bool desire_draw_buffers = false; 11144 bool desire_draw_buffers = false;
11132 bool desire_shader_texture_lod = false; 11145 bool desire_shader_texture_lod = false;
11133 if (force_webgl_glsl_validation_) { 11146 if (IsWebGLContext()) {
11134 desire_standard_derivatives = 11147 desire_standard_derivatives =
11135 feature_str.find("GL_OES_standard_derivatives") != std::string::npos; 11148 feature_str.find("GL_OES_standard_derivatives") != std::string::npos;
11136 desire_frag_depth = 11149 desire_frag_depth =
11137 feature_str.find("GL_EXT_frag_depth") != std::string::npos; 11150 feature_str.find("GL_EXT_frag_depth") != std::string::npos;
11138 desire_draw_buffers = 11151 desire_draw_buffers =
11139 feature_str.find("GL_EXT_draw_buffers") != std::string::npos; 11152 feature_str.find("GL_EXT_draw_buffers") != std::string::npos;
11140 desire_shader_texture_lod = 11153 desire_shader_texture_lod =
11141 feature_str.find("GL_EXT_shader_texture_lod") != std::string::npos; 11154 feature_str.find("GL_EXT_shader_texture_lod") != std::string::npos;
11142 } 11155 }
11143 11156
11144 if (desire_webgl_glsl_validation != force_webgl_glsl_validation_ || 11157 if (desire_standard_derivatives != derivatives_explicitly_enabled_ ||
11145 desire_standard_derivatives != derivatives_explicitly_enabled_ ||
11146 desire_frag_depth != frag_depth_explicitly_enabled_ || 11158 desire_frag_depth != frag_depth_explicitly_enabled_ ||
11147 desire_draw_buffers != draw_buffers_explicitly_enabled_) { 11159 desire_draw_buffers != draw_buffers_explicitly_enabled_ ||
11148 force_webgl_glsl_validation_ |= desire_webgl_glsl_validation; 11160 desire_shader_texture_lod != shader_texture_lod_explicitly_enabled_) {
Zhenyao Mo 2015/06/07 18:35:07 This is apparently a bug, see above the reasoning.
11149 derivatives_explicitly_enabled_ |= desire_standard_derivatives; 11161 derivatives_explicitly_enabled_ |= desire_standard_derivatives;
11150 frag_depth_explicitly_enabled_ |= desire_frag_depth; 11162 frag_depth_explicitly_enabled_ |= desire_frag_depth;
11151 draw_buffers_explicitly_enabled_ |= desire_draw_buffers; 11163 draw_buffers_explicitly_enabled_ |= desire_draw_buffers;
11152 shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod; 11164 shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod;
11153 InitializeShaderTranslator(); 11165 InitializeShaderTranslator();
11154 } 11166 }
11155 11167
11156 UpdateCapabilities(); 11168 UpdateCapabilities();
11157 11169
11158 return error::kNoError; 11170 return error::kNoError;
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after
13372 } 13384 }
13373 } 13385 }
13374 13386
13375 // Include the auto-generated part of this file. We split this because it means 13387 // Include the auto-generated part of this file. We split this because it means
13376 // we can easily edit the non-auto generated parts right here in this file 13388 // we can easily edit the non-auto generated parts right here in this file
13377 // instead of having to edit some template or the code generator. 13389 // instead of having to edit some template or the code generator.
13378 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 13390 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
13379 13391
13380 } // namespace gles2 13392 } // namespace gles2
13381 } // namespace gpu 13393 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698