| 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 <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 int frame_number_; | 1973 int frame_number_; |
| 1974 | 1974 |
| 1975 // Number of commands remaining to be processed in DoCommands(). | 1975 // Number of commands remaining to be processed in DoCommands(). |
| 1976 int commands_to_process_; | 1976 int commands_to_process_; |
| 1977 | 1977 |
| 1978 bool has_robustness_extension_; | 1978 bool has_robustness_extension_; |
| 1979 error::ContextLostReason context_lost_reason_; | 1979 error::ContextLostReason context_lost_reason_; |
| 1980 bool context_was_lost_; | 1980 bool context_was_lost_; |
| 1981 bool reset_by_robustness_extension_; | 1981 bool reset_by_robustness_extension_; |
| 1982 bool supports_post_sub_buffer_; | 1982 bool supports_post_sub_buffer_; |
| 1983 bool supports_commit_overlay_planes_; |
| 1983 bool supports_async_swap_; | 1984 bool supports_async_swap_; |
| 1984 | 1985 |
| 1985 ContextType context_type_; | 1986 ContextType context_type_; |
| 1986 | 1987 |
| 1987 // These flags are used to override the state of the shared feature_info_ | 1988 // These flags are used to override the state of the shared feature_info_ |
| 1988 // member. Because the same FeatureInfo instance may be shared among many | 1989 // member. Because the same FeatureInfo instance may be shared among many |
| 1989 // contexts, the assumptions on the availablity of extensions in WebGL | 1990 // contexts, the assumptions on the availablity of extensions in WebGL |
| 1990 // contexts may be broken. These flags override the shared state to preserve | 1991 // contexts may be broken. These flags override the shared state to preserve |
| 1991 // WebGL semantics. | 1992 // WebGL semantics. |
| 1992 bool derivatives_explicitly_enabled_; | 1993 bool derivatives_explicitly_enabled_; |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2519 backbuffer_needs_clear_bits_(0), | 2520 backbuffer_needs_clear_bits_(0), |
| 2520 current_decoder_error_(error::kNoError), | 2521 current_decoder_error_(error::kNoError), |
| 2521 validators_(group_->feature_info()->validators()), | 2522 validators_(group_->feature_info()->validators()), |
| 2522 feature_info_(group_->feature_info()), | 2523 feature_info_(group_->feature_info()), |
| 2523 frame_number_(0), | 2524 frame_number_(0), |
| 2524 has_robustness_extension_(false), | 2525 has_robustness_extension_(false), |
| 2525 context_lost_reason_(error::kUnknown), | 2526 context_lost_reason_(error::kUnknown), |
| 2526 context_was_lost_(false), | 2527 context_was_lost_(false), |
| 2527 reset_by_robustness_extension_(false), | 2528 reset_by_robustness_extension_(false), |
| 2528 supports_post_sub_buffer_(false), | 2529 supports_post_sub_buffer_(false), |
| 2530 supports_commit_overlay_planes_(false), |
| 2529 supports_async_swap_(false), | 2531 supports_async_swap_(false), |
| 2530 context_type_(CONTEXT_TYPE_OPENGLES2), | 2532 context_type_(CONTEXT_TYPE_OPENGLES2), |
| 2531 derivatives_explicitly_enabled_(false), | 2533 derivatives_explicitly_enabled_(false), |
| 2532 frag_depth_explicitly_enabled_(false), | 2534 frag_depth_explicitly_enabled_(false), |
| 2533 draw_buffers_explicitly_enabled_(false), | 2535 draw_buffers_explicitly_enabled_(false), |
| 2534 shader_texture_lod_explicitly_enabled_(false), | 2536 shader_texture_lod_explicitly_enabled_(false), |
| 2535 compile_shader_always_succeeds_(false), | 2537 compile_shader_always_succeeds_(false), |
| 2536 lose_context_when_out_of_memory_(false), | 2538 lose_context_when_out_of_memory_(false), |
| 2537 service_logging_(base::CommandLine::InitializedForCurrentProcess() | 2539 service_logging_(base::CommandLine::InitializedForCurrentProcess() |
| 2538 ? base::CommandLine::ForCurrentProcess()->HasSwitch( | 2540 ? base::CommandLine::ForCurrentProcess()->HasSwitch( |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | 2972 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
| 2971 } | 2973 } |
| 2972 } | 2974 } |
| 2973 | 2975 |
| 2974 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); | 2976 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); |
| 2975 if (feature_info_->workarounds() | 2977 if (feature_info_->workarounds() |
| 2976 .disable_post_sub_buffers_for_onscreen_surfaces && | 2978 .disable_post_sub_buffers_for_onscreen_surfaces && |
| 2977 !surface->IsOffscreen()) | 2979 !surface->IsOffscreen()) |
| 2978 supports_post_sub_buffer_ = false; | 2980 supports_post_sub_buffer_ = false; |
| 2979 | 2981 |
| 2982 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); |
| 2983 |
| 2980 supports_async_swap_ = surface->SupportsAsyncSwap(); | 2984 supports_async_swap_ = surface->SupportsAsyncSwap(); |
| 2981 | 2985 |
| 2982 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { | 2986 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { |
| 2983 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 2987 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
| 2984 } | 2988 } |
| 2985 | 2989 |
| 2986 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { | 2990 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { |
| 2987 context_->SetUnbindFboOnMakeCurrent(); | 2991 context_->SetUnbindFboOnMakeCurrent(); |
| 2988 } | 2992 } |
| 2989 | 2993 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3113 caps.discard_framebuffer = | 3117 caps.discard_framebuffer = |
| 3114 feature_info_->feature_flags().ext_discard_framebuffer; | 3118 feature_info_->feature_flags().ext_discard_framebuffer; |
| 3115 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; | 3119 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; |
| 3116 | 3120 |
| 3117 #if defined(OS_MACOSX) | 3121 #if defined(OS_MACOSX) |
| 3118 // This is unconditionally true on mac, no need to test for it at runtime. | 3122 // This is unconditionally true on mac, no need to test for it at runtime. |
| 3119 caps.iosurface = true; | 3123 caps.iosurface = true; |
| 3120 #endif | 3124 #endif |
| 3121 | 3125 |
| 3122 caps.post_sub_buffer = supports_post_sub_buffer_; | 3126 caps.post_sub_buffer = supports_post_sub_buffer_; |
| 3127 caps.commit_overlay_planes = supports_commit_overlay_planes_; |
| 3123 caps.image = true; | 3128 caps.image = true; |
| 3124 caps.surfaceless = surfaceless_; | 3129 caps.surfaceless = surfaceless_; |
| 3125 | 3130 |
| 3126 caps.blend_equation_advanced = | 3131 caps.blend_equation_advanced = |
| 3127 feature_info_->feature_flags().blend_equation_advanced; | 3132 feature_info_->feature_flags().blend_equation_advanced; |
| 3128 caps.blend_equation_advanced_coherent = | 3133 caps.blend_equation_advanced_coherent = |
| 3129 feature_info_->feature_flags().blend_equation_advanced_coherent; | 3134 feature_info_->feature_flags().blend_equation_advanced_coherent; |
| 3130 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; | 3135 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; |
| 3131 caps.image_ycbcr_422 = | 3136 caps.image_ycbcr_422 = |
| 3132 feature_info_->feature_flags().chromium_image_ycbcr_422; | 3137 feature_info_->feature_flags().chromium_image_ycbcr_422; |
| (...skipping 8645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11778 if (result == gfx::SwapResult::SWAP_FAILED) { | 11783 if (result == gfx::SwapResult::SWAP_FAILED) { |
| 11779 LOG(ERROR) << "Context lost because SwapBuffers failed."; | 11784 LOG(ERROR) << "Context lost because SwapBuffers failed."; |
| 11780 if (!CheckResetStatus()) { | 11785 if (!CheckResetStatus()) { |
| 11781 MarkContextLost(error::kUnknown); | 11786 MarkContextLost(error::kUnknown); |
| 11782 group_->LoseContexts(error::kUnknown); | 11787 group_->LoseContexts(error::kUnknown); |
| 11783 } | 11788 } |
| 11784 } | 11789 } |
| 11785 } | 11790 } |
| 11786 | 11791 |
| 11787 void GLES2DecoderImpl::DoCommitOverlayPlanes() { | 11792 void GLES2DecoderImpl::DoCommitOverlayPlanes() { |
| 11788 // TODO(watk): crbug.com/560592 | 11793 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCommitOverlayPlanes"); |
| 11789 NOTIMPLEMENTED(); | 11794 if (supports_async_swap_) { |
| 11795 surface_->CommitOverlayPlanesAsync(base::Bind( |
| 11796 &GLES2DecoderImpl::FinishSwapBuffers, base::AsWeakPtr(this))); |
| 11797 } else { |
| 11798 FinishSwapBuffers(surface_->CommitOverlayPlanes()); |
| 11799 } |
| 11790 } | 11800 } |
| 11791 | 11801 |
| 11792 void GLES2DecoderImpl::DoSwapInterval(int interval) { | 11802 void GLES2DecoderImpl::DoSwapInterval(int interval) { |
| 11793 context_->SetSwapInterval(interval); | 11803 context_->SetSwapInterval(interval); |
| 11794 } | 11804 } |
| 11795 | 11805 |
| 11796 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( | 11806 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( |
| 11797 uint32 immediate_data_size, | 11807 uint32 immediate_data_size, |
| 11798 const void* cmd_data) { | 11808 const void* cmd_data) { |
| 11799 const gles2::cmds::EnableFeatureCHROMIUM& c = | 11809 const gles2::cmds::EnableFeatureCHROMIUM& c = |
| (...skipping 3529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15329 return error::kNoError; | 15339 return error::kNoError; |
| 15330 } | 15340 } |
| 15331 | 15341 |
| 15332 // Include the auto-generated part of this file. We split this because it means | 15342 // Include the auto-generated part of this file. We split this because it means |
| 15333 // we can easily edit the non-auto generated parts right here in this file | 15343 // we can easily edit the non-auto generated parts right here in this file |
| 15334 // instead of having to edit some template or the code generator. | 15344 // instead of having to edit some template or the code generator. |
| 15335 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15345 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15336 | 15346 |
| 15337 } // namespace gles2 | 15347 } // namespace gles2 |
| 15338 } // namespace gpu | 15348 } // namespace gpu |
| OLD | NEW |