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 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 int frame_number_; | 2224 int frame_number_; |
2225 | 2225 |
2226 // Number of commands remaining to be processed in DoCommands(). | 2226 // Number of commands remaining to be processed in DoCommands(). |
2227 int commands_to_process_; | 2227 int commands_to_process_; |
2228 | 2228 |
2229 bool has_robustness_extension_; | 2229 bool has_robustness_extension_; |
2230 error::ContextLostReason context_lost_reason_; | 2230 error::ContextLostReason context_lost_reason_; |
2231 bool context_was_lost_; | 2231 bool context_was_lost_; |
2232 bool reset_by_robustness_extension_; | 2232 bool reset_by_robustness_extension_; |
2233 bool supports_post_sub_buffer_; | 2233 bool supports_post_sub_buffer_; |
| 2234 bool supports_swap_buffers_with_damage_; |
2234 bool supports_commit_overlay_planes_; | 2235 bool supports_commit_overlay_planes_; |
2235 bool supports_async_swap_; | 2236 bool supports_async_swap_; |
2236 | 2237 |
2237 // These flags are used to override the state of the shared feature_info_ | 2238 // These flags are used to override the state of the shared feature_info_ |
2238 // member. Because the same FeatureInfo instance may be shared among many | 2239 // member. Because the same FeatureInfo instance may be shared among many |
2239 // contexts, the assumptions on the availablity of extensions in WebGL | 2240 // contexts, the assumptions on the availablity of extensions in WebGL |
2240 // contexts may be broken. These flags override the shared state to preserve | 2241 // contexts may be broken. These flags override the shared state to preserve |
2241 // WebGL semantics. | 2242 // WebGL semantics. |
2242 bool derivatives_explicitly_enabled_; | 2243 bool derivatives_explicitly_enabled_; |
2243 bool frag_depth_explicitly_enabled_; | 2244 bool frag_depth_explicitly_enabled_; |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2908 swaps_since_resize_(0), | 2909 swaps_since_resize_(0), |
2909 current_decoder_error_(error::kNoError), | 2910 current_decoder_error_(error::kNoError), |
2910 validators_(group_->feature_info()->validators()), | 2911 validators_(group_->feature_info()->validators()), |
2911 feature_info_(group_->feature_info()), | 2912 feature_info_(group_->feature_info()), |
2912 frame_number_(0), | 2913 frame_number_(0), |
2913 has_robustness_extension_(false), | 2914 has_robustness_extension_(false), |
2914 context_lost_reason_(error::kUnknown), | 2915 context_lost_reason_(error::kUnknown), |
2915 context_was_lost_(false), | 2916 context_was_lost_(false), |
2916 reset_by_robustness_extension_(false), | 2917 reset_by_robustness_extension_(false), |
2917 supports_post_sub_buffer_(false), | 2918 supports_post_sub_buffer_(false), |
| 2919 supports_swap_buffers_with_damage_(false), |
2918 supports_commit_overlay_planes_(false), | 2920 supports_commit_overlay_planes_(false), |
2919 supports_async_swap_(false), | 2921 supports_async_swap_(false), |
2920 derivatives_explicitly_enabled_(false), | 2922 derivatives_explicitly_enabled_(false), |
2921 frag_depth_explicitly_enabled_(false), | 2923 frag_depth_explicitly_enabled_(false), |
2922 draw_buffers_explicitly_enabled_(false), | 2924 draw_buffers_explicitly_enabled_(false), |
2923 shader_texture_lod_explicitly_enabled_(false), | 2925 shader_texture_lod_explicitly_enabled_(false), |
2924 compile_shader_always_succeeds_(false), | 2926 compile_shader_always_succeeds_(false), |
2925 lose_context_when_out_of_memory_(false), | 2927 lose_context_when_out_of_memory_(false), |
2926 should_use_native_gmb_for_backbuffer_(false), | 2928 should_use_native_gmb_for_backbuffer_(false), |
2927 service_logging_( | 2929 service_logging_( |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3411 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | 3413 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
3412 } | 3414 } |
3413 } | 3415 } |
3414 | 3416 |
3415 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); | 3417 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); |
3416 if (feature_info_->workarounds() | 3418 if (feature_info_->workarounds() |
3417 .disable_post_sub_buffers_for_onscreen_surfaces && | 3419 .disable_post_sub_buffers_for_onscreen_surfaces && |
3418 !surface->IsOffscreen()) | 3420 !surface->IsOffscreen()) |
3419 supports_post_sub_buffer_ = false; | 3421 supports_post_sub_buffer_ = false; |
3420 | 3422 |
| 3423 supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage(); |
| 3424 |
3421 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); | 3425 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); |
3422 | 3426 |
3423 supports_async_swap_ = surface->SupportsAsyncSwap(); | 3427 supports_async_swap_ = surface->SupportsAsyncSwap(); |
3424 | 3428 |
3425 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { | 3429 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { |
3426 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 3430 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
3427 } | 3431 } |
3428 | 3432 |
3429 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { | 3433 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { |
3430 context_->SetUnbindFboOnMakeCurrent(); | 3434 context_->SetUnbindFboOnMakeCurrent(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3559 feature_info_->feature_flags().ext_discard_framebuffer; | 3563 feature_info_->feature_flags().ext_discard_framebuffer; |
3560 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; | 3564 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; |
3561 | 3565 |
3562 caps.chromium_image_rgb_emulation = ChromiumImageNeedsRGBEmulation(); | 3566 caps.chromium_image_rgb_emulation = ChromiumImageNeedsRGBEmulation(); |
3563 #if defined(OS_MACOSX) | 3567 #if defined(OS_MACOSX) |
3564 // This is unconditionally true on mac, no need to test for it at runtime. | 3568 // This is unconditionally true on mac, no need to test for it at runtime. |
3565 caps.iosurface = true; | 3569 caps.iosurface = true; |
3566 #endif | 3570 #endif |
3567 | 3571 |
3568 caps.post_sub_buffer = supports_post_sub_buffer_; | 3572 caps.post_sub_buffer = supports_post_sub_buffer_; |
| 3573 caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_; |
3569 caps.commit_overlay_planes = supports_commit_overlay_planes_; | 3574 caps.commit_overlay_planes = supports_commit_overlay_planes_; |
3570 caps.image = true; | 3575 caps.image = true; |
3571 caps.surfaceless = surfaceless_; | 3576 caps.surfaceless = surfaceless_; |
3572 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 3577 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
3573 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); | 3578 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); |
3574 caps.msaa_is_slow = feature_info_->workarounds().msaa_is_slow; | 3579 caps.msaa_is_slow = feature_info_->workarounds().msaa_is_slow; |
3575 | 3580 |
3576 caps.blend_equation_advanced = | 3581 caps.blend_equation_advanced = |
3577 feature_info_->feature_flags().blend_equation_advanced; | 3582 feature_info_->feature_flags().blend_equation_advanced; |
3578 caps.blend_equation_advanced_coherent = | 3583 caps.blend_equation_advanced_coherent = |
(...skipping 7339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10918 state_.unpack_image_height = param; | 10923 state_.unpack_image_height = param; |
10919 break; | 10924 break; |
10920 default: | 10925 default: |
10921 // Validation should have prevented us from getting here. | 10926 // Validation should have prevented us from getting here. |
10922 NOTREACHED(); | 10927 NOTREACHED(); |
10923 break; | 10928 break; |
10924 } | 10929 } |
10925 return error::kNoError; | 10930 return error::kNoError; |
10926 } | 10931 } |
10927 | 10932 |
| 10933 error::Error GLES2DecoderImpl::HandleSwapBuffersWithDamageCHROMIUM( |
| 10934 uint32_t immediate_data_size, |
| 10935 const volatile void* cmd_data) { |
| 10936 const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM& c = |
| 10937 *static_cast<const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM*>( |
| 10938 cmd_data); |
| 10939 TRACE_EVENT0("gpu", "GLES2DecoderImpl::SwapBuffersWithDamageCHROMIUM"); |
| 10940 { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); } |
| 10941 if (!supports_swap_buffers_with_damage_) { |
| 10942 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSwapBuffersWithDamageCHROMIUM", |
| 10943 "command not supported by surface"); |
| 10944 return error::kNoError; |
| 10945 } |
| 10946 bool is_tracing; |
| 10947 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
| 10948 &is_tracing); |
| 10949 if (is_tracing) { |
| 10950 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
| 10951 ScopedFramebufferBinder binder(this, GetBackbufferServiceId()); |
| 10952 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( |
| 10953 is_offscreen ? offscreen_size_ : surface_->GetSize()); |
| 10954 } |
| 10955 |
| 10956 ClearScheduleCALayerState(); |
| 10957 |
| 10958 FinishSwapBuffers( |
| 10959 surface_->SwapBuffersWithDamage(c.x, c.y, c.width, c.height)); |
| 10960 |
| 10961 return error::kNoError; |
| 10962 } |
| 10963 |
10928 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( | 10964 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
10929 uint32_t immediate_data_size, | 10965 uint32_t immediate_data_size, |
10930 const volatile void* cmd_data) { | 10966 const volatile void* cmd_data) { |
10931 const volatile gles2::cmds::PostSubBufferCHROMIUM& c = | 10967 const volatile gles2::cmds::PostSubBufferCHROMIUM& c = |
10932 *static_cast<const volatile gles2::cmds::PostSubBufferCHROMIUM*>( | 10968 *static_cast<const volatile gles2::cmds::PostSubBufferCHROMIUM*>( |
10933 cmd_data); | 10969 cmd_data); |
10934 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); | 10970 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); |
10935 { | 10971 { |
10936 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); | 10972 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); |
10937 } | 10973 } |
(...skipping 6930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17868 } | 17904 } |
17869 | 17905 |
17870 // Include the auto-generated part of this file. We split this because it means | 17906 // Include the auto-generated part of this file. We split this because it means |
17871 // we can easily edit the non-auto generated parts right here in this file | 17907 // we can easily edit the non-auto generated parts right here in this file |
17872 // instead of having to edit some template or the code generator. | 17908 // instead of having to edit some template or the code generator. |
17873 #include "base/macros.h" | 17909 #include "base/macros.h" |
17874 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17910 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
17875 | 17911 |
17876 } // namespace gles2 | 17912 } // namespace gles2 |
17877 } // namespace gpu | 17913 } // namespace gpu |
OLD | NEW |