| 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 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 int frame_number_; | 2230 int frame_number_; |
| 2231 | 2231 |
| 2232 // Number of commands remaining to be processed in DoCommands(). | 2232 // Number of commands remaining to be processed in DoCommands(). |
| 2233 int commands_to_process_; | 2233 int commands_to_process_; |
| 2234 | 2234 |
| 2235 bool has_robustness_extension_; | 2235 bool has_robustness_extension_; |
| 2236 error::ContextLostReason context_lost_reason_; | 2236 error::ContextLostReason context_lost_reason_; |
| 2237 bool context_was_lost_; | 2237 bool context_was_lost_; |
| 2238 bool reset_by_robustness_extension_; | 2238 bool reset_by_robustness_extension_; |
| 2239 bool supports_post_sub_buffer_; | 2239 bool supports_post_sub_buffer_; |
| 2240 bool supports_swap_buffers_with_damage_; |
| 2240 bool supports_commit_overlay_planes_; | 2241 bool supports_commit_overlay_planes_; |
| 2241 bool supports_async_swap_; | 2242 bool supports_async_swap_; |
| 2242 | 2243 |
| 2243 // These flags are used to override the state of the shared feature_info_ | 2244 // These flags are used to override the state of the shared feature_info_ |
| 2244 // member. Because the same FeatureInfo instance may be shared among many | 2245 // member. Because the same FeatureInfo instance may be shared among many |
| 2245 // contexts, the assumptions on the availablity of extensions in WebGL | 2246 // contexts, the assumptions on the availablity of extensions in WebGL |
| 2246 // contexts may be broken. These flags override the shared state to preserve | 2247 // contexts may be broken. These flags override the shared state to preserve |
| 2247 // WebGL semantics. | 2248 // WebGL semantics. |
| 2248 bool derivatives_explicitly_enabled_; | 2249 bool derivatives_explicitly_enabled_; |
| 2249 bool frag_depth_explicitly_enabled_; | 2250 bool frag_depth_explicitly_enabled_; |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 swaps_since_resize_(0), | 2915 swaps_since_resize_(0), |
| 2915 current_decoder_error_(error::kNoError), | 2916 current_decoder_error_(error::kNoError), |
| 2916 validators_(group_->feature_info()->validators()), | 2917 validators_(group_->feature_info()->validators()), |
| 2917 feature_info_(group_->feature_info()), | 2918 feature_info_(group_->feature_info()), |
| 2918 frame_number_(0), | 2919 frame_number_(0), |
| 2919 has_robustness_extension_(false), | 2920 has_robustness_extension_(false), |
| 2920 context_lost_reason_(error::kUnknown), | 2921 context_lost_reason_(error::kUnknown), |
| 2921 context_was_lost_(false), | 2922 context_was_lost_(false), |
| 2922 reset_by_robustness_extension_(false), | 2923 reset_by_robustness_extension_(false), |
| 2923 supports_post_sub_buffer_(false), | 2924 supports_post_sub_buffer_(false), |
| 2925 supports_swap_buffers_with_damage_(false), |
| 2924 supports_commit_overlay_planes_(false), | 2926 supports_commit_overlay_planes_(false), |
| 2925 supports_async_swap_(false), | 2927 supports_async_swap_(false), |
| 2926 derivatives_explicitly_enabled_(false), | 2928 derivatives_explicitly_enabled_(false), |
| 2927 frag_depth_explicitly_enabled_(false), | 2929 frag_depth_explicitly_enabled_(false), |
| 2928 draw_buffers_explicitly_enabled_(false), | 2930 draw_buffers_explicitly_enabled_(false), |
| 2929 shader_texture_lod_explicitly_enabled_(false), | 2931 shader_texture_lod_explicitly_enabled_(false), |
| 2930 compile_shader_always_succeeds_(false), | 2932 compile_shader_always_succeeds_(false), |
| 2931 lose_context_when_out_of_memory_(false), | 2933 lose_context_when_out_of_memory_(false), |
| 2932 should_use_native_gmb_for_backbuffer_(false), | 2934 should_use_native_gmb_for_backbuffer_(false), |
| 2933 service_logging_( | 2935 service_logging_( |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3417 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | 3419 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
| 3418 } | 3420 } |
| 3419 } | 3421 } |
| 3420 | 3422 |
| 3421 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); | 3423 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); |
| 3422 if (feature_info_->workarounds() | 3424 if (feature_info_->workarounds() |
| 3423 .disable_post_sub_buffers_for_onscreen_surfaces && | 3425 .disable_post_sub_buffers_for_onscreen_surfaces && |
| 3424 !surface->IsOffscreen()) | 3426 !surface->IsOffscreen()) |
| 3425 supports_post_sub_buffer_ = false; | 3427 supports_post_sub_buffer_ = false; |
| 3426 | 3428 |
| 3429 supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage(); |
| 3430 |
| 3427 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); | 3431 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); |
| 3428 | 3432 |
| 3429 supports_async_swap_ = surface->SupportsAsyncSwap(); | 3433 supports_async_swap_ = surface->SupportsAsyncSwap(); |
| 3430 | 3434 |
| 3431 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { | 3435 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { |
| 3432 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 3436 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
| 3433 } | 3437 } |
| 3434 | 3438 |
| 3435 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { | 3439 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { |
| 3436 context_->SetUnbindFboOnMakeCurrent(); | 3440 context_->SetUnbindFboOnMakeCurrent(); |
| (...skipping 7418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10855 state_.unpack_image_height = param; | 10859 state_.unpack_image_height = param; |
| 10856 break; | 10860 break; |
| 10857 default: | 10861 default: |
| 10858 // Validation should have prevented us from getting here. | 10862 // Validation should have prevented us from getting here. |
| 10859 NOTREACHED(); | 10863 NOTREACHED(); |
| 10860 break; | 10864 break; |
| 10861 } | 10865 } |
| 10862 return error::kNoError; | 10866 return error::kNoError; |
| 10863 } | 10867 } |
| 10864 | 10868 |
| 10869 error::Error GLES2DecoderImpl::HandleSwapBuffersWithDamageCHROMIUM( |
| 10870 uint32_t immediate_data_size, |
| 10871 const void* cmd_data) { |
| 10872 const gles2::cmds::SwapBuffersWithDamageCHROMIUM& c = |
| 10873 *static_cast<const gles2::cmds::SwapBuffersWithDamageCHROMIUM*>(cmd_data); |
| 10874 TRACE_EVENT0("gpu", "GLES2DecoderImpl::SwapBuffersWithDamageCHROMIUM"); |
| 10875 { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); } |
| 10876 if (!supports_swap_buffers_with_damage_) { |
| 10877 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSwapBuffersWithDamageCHROMIUM", |
| 10878 "command not supported by surface"); |
| 10879 return error::kNoError; |
| 10880 } |
| 10881 bool is_tracing; |
| 10882 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
| 10883 &is_tracing); |
| 10884 if (is_tracing) { |
| 10885 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
| 10886 ScopedFramebufferBinder binder(this, GetBackbufferServiceId()); |
| 10887 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( |
| 10888 is_offscreen ? offscreen_size_ : surface_->GetSize()); |
| 10889 } |
| 10890 |
| 10891 ClearScheduleCALayerState(); |
| 10892 |
| 10893 FinishSwapBuffers( |
| 10894 surface_->SwapBuffersWithDamage(c.x, c.y, c.width, c.height)); |
| 10895 |
| 10896 return error::kNoError; |
| 10897 } |
| 10898 |
| 10865 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( | 10899 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
| 10866 uint32_t immediate_data_size, | 10900 uint32_t immediate_data_size, |
| 10867 const void* cmd_data) { | 10901 const void* cmd_data) { |
| 10868 const gles2::cmds::PostSubBufferCHROMIUM& c = | 10902 const gles2::cmds::PostSubBufferCHROMIUM& c = |
| 10869 *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); | 10903 *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); |
| 10870 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); | 10904 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); |
| 10871 { | 10905 { |
| 10872 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); | 10906 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); |
| 10873 } | 10907 } |
| 10874 if (!supports_post_sub_buffer_) { | 10908 if (!supports_post_sub_buffer_) { |
| (...skipping 6875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17750 } | 17784 } |
| 17751 | 17785 |
| 17752 // Include the auto-generated part of this file. We split this because it means | 17786 // Include the auto-generated part of this file. We split this because it means |
| 17753 // we can easily edit the non-auto generated parts right here in this file | 17787 // we can easily edit the non-auto generated parts right here in this file |
| 17754 // instead of having to edit some template or the code generator. | 17788 // instead of having to edit some template or the code generator. |
| 17755 #include "base/macros.h" | 17789 #include "base/macros.h" |
| 17756 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17790 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17757 | 17791 |
| 17758 } // namespace gles2 | 17792 } // namespace gles2 |
| 17759 } // namespace gpu | 17793 } // namespace gpu |
| OLD | NEW |