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

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

Issue 2673473002: Rename SwapBuffersWithDamage to SwapBuffersWithBounds (Closed)
Patch Set: fix windows compile warning Created 3 years, 10 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 <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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 GLenum internal_format, 906 GLenum internal_format,
907 GLint x, 907 GLint x,
908 GLint y, 908 GLint y,
909 GLsizei width, 909 GLsizei width,
910 GLsizei height, 910 GLsizei height,
911 GLint border); 911 GLint border);
912 912
913 // Wrapper for SwapBuffers. 913 // Wrapper for SwapBuffers.
914 void DoSwapBuffers(); 914 void DoSwapBuffers();
915 915
916 // Wrapper for SwapBuffersWithBoundsCHROMIUM.
917 void DoSwapBuffersWithBoundsCHROMIUM(GLsizei count,
918 const volatile GLint* rects);
919
916 // Callback for async SwapBuffers. 920 // Callback for async SwapBuffers.
917 void FinishSwapBuffers(gfx::SwapResult result); 921 void FinishSwapBuffers(gfx::SwapResult result);
918 922
919 void DoCommitOverlayPlanes(); 923 void DoCommitOverlayPlanes();
920 924
921 // Wrapper for SwapInterval. 925 // Wrapper for SwapInterval.
922 void DoSwapInterval(int interval); 926 void DoSwapInterval(int interval);
923 927
924 // Wrapper for CopyTexSubImage2D. 928 // Wrapper for CopyTexSubImage2D.
925 void DoCopyTexSubImage2D( 929 void DoCopyTexSubImage2D(
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 int frame_number_; 2338 int frame_number_;
2335 2339
2336 // Number of commands remaining to be processed in DoCommands(). 2340 // Number of commands remaining to be processed in DoCommands().
2337 int commands_to_process_; 2341 int commands_to_process_;
2338 2342
2339 bool has_robustness_extension_; 2343 bool has_robustness_extension_;
2340 error::ContextLostReason context_lost_reason_; 2344 error::ContextLostReason context_lost_reason_;
2341 bool context_was_lost_; 2345 bool context_was_lost_;
2342 bool reset_by_robustness_extension_; 2346 bool reset_by_robustness_extension_;
2343 bool supports_post_sub_buffer_; 2347 bool supports_post_sub_buffer_;
2344 bool supports_swap_buffers_with_damage_; 2348 bool supports_swap_buffers_with_bounds_;
2345 bool supports_commit_overlay_planes_; 2349 bool supports_commit_overlay_planes_;
2346 bool supports_async_swap_; 2350 bool supports_async_swap_;
2347 2351
2348 // These flags are used to override the state of the shared feature_info_ 2352 // These flags are used to override the state of the shared feature_info_
2349 // member. Because the same FeatureInfo instance may be shared among many 2353 // member. Because the same FeatureInfo instance may be shared among many
2350 // contexts, the assumptions on the availablity of extensions in WebGL 2354 // contexts, the assumptions on the availablity of extensions in WebGL
2351 // contexts may be broken. These flags override the shared state to preserve 2355 // contexts may be broken. These flags override the shared state to preserve
2352 // WebGL semantics. 2356 // WebGL semantics.
2353 bool derivatives_explicitly_enabled_; 2357 bool derivatives_explicitly_enabled_;
2354 bool frag_depth_explicitly_enabled_; 2358 bool frag_depth_explicitly_enabled_;
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 swaps_since_resize_(0), 3035 swaps_since_resize_(0),
3032 current_decoder_error_(error::kNoError), 3036 current_decoder_error_(error::kNoError),
3033 validators_(group_->feature_info()->validators()), 3037 validators_(group_->feature_info()->validators()),
3034 feature_info_(group_->feature_info()), 3038 feature_info_(group_->feature_info()),
3035 frame_number_(0), 3039 frame_number_(0),
3036 has_robustness_extension_(false), 3040 has_robustness_extension_(false),
3037 context_lost_reason_(error::kUnknown), 3041 context_lost_reason_(error::kUnknown),
3038 context_was_lost_(false), 3042 context_was_lost_(false),
3039 reset_by_robustness_extension_(false), 3043 reset_by_robustness_extension_(false),
3040 supports_post_sub_buffer_(false), 3044 supports_post_sub_buffer_(false),
3041 supports_swap_buffers_with_damage_(false), 3045 supports_swap_buffers_with_bounds_(false),
3042 supports_commit_overlay_planes_(false), 3046 supports_commit_overlay_planes_(false),
3043 supports_async_swap_(false), 3047 supports_async_swap_(false),
3044 derivatives_explicitly_enabled_(false), 3048 derivatives_explicitly_enabled_(false),
3045 frag_depth_explicitly_enabled_(false), 3049 frag_depth_explicitly_enabled_(false),
3046 draw_buffers_explicitly_enabled_(false), 3050 draw_buffers_explicitly_enabled_(false),
3047 shader_texture_lod_explicitly_enabled_(false), 3051 shader_texture_lod_explicitly_enabled_(false),
3048 compile_shader_always_succeeds_(false), 3052 compile_shader_always_succeeds_(false),
3049 lose_context_when_out_of_memory_(false), 3053 lose_context_when_out_of_memory_(false),
3050 should_use_native_gmb_for_backbuffer_(false), 3054 should_use_native_gmb_for_backbuffer_(false),
3051 service_logging_( 3055 service_logging_(
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
3545 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); 3549 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
3546 } 3550 }
3547 } 3551 }
3548 3552
3549 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); 3553 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer();
3550 if (workarounds() 3554 if (workarounds()
3551 .disable_post_sub_buffers_for_onscreen_surfaces && 3555 .disable_post_sub_buffers_for_onscreen_surfaces &&
3552 !surface->IsOffscreen()) 3556 !surface->IsOffscreen())
3553 supports_post_sub_buffer_ = false; 3557 supports_post_sub_buffer_ = false;
3554 3558
3555 supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage(); 3559 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds();
3556 3560
3557 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); 3561 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes();
3558 3562
3559 supports_async_swap_ = surface->SupportsAsyncSwap(); 3563 supports_async_swap_ = surface->SupportsAsyncSwap();
3560 3564
3561 if (workarounds().reverse_point_sprite_coord_origin) { 3565 if (workarounds().reverse_point_sprite_coord_origin) {
3562 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); 3566 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
3563 } 3567 }
3564 3568
3565 if (workarounds().unbind_fbo_on_context_switch) { 3569 if (workarounds().unbind_fbo_on_context_switch) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
3719 feature_info_->feature_flags().ext_discard_framebuffer; 3723 feature_info_->feature_flags().ext_discard_framebuffer;
3720 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; 3724 caps.sync_query = feature_info_->feature_flags().chromium_sync_query;
3721 3725
3722 caps.chromium_image_rgb_emulation = ChromiumImageNeedsRGBEmulation(); 3726 caps.chromium_image_rgb_emulation = ChromiumImageNeedsRGBEmulation();
3723 #if defined(OS_MACOSX) 3727 #if defined(OS_MACOSX)
3724 // This is unconditionally true on mac, no need to test for it at runtime. 3728 // This is unconditionally true on mac, no need to test for it at runtime.
3725 caps.iosurface = true; 3729 caps.iosurface = true;
3726 #endif 3730 #endif
3727 3731
3728 caps.post_sub_buffer = supports_post_sub_buffer_; 3732 caps.post_sub_buffer = supports_post_sub_buffer_;
3729 caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_; 3733 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_;
3730 caps.commit_overlay_planes = supports_commit_overlay_planes_; 3734 caps.commit_overlay_planes = supports_commit_overlay_planes_;
3731 caps.surfaceless = surfaceless_; 3735 caps.surfaceless = surfaceless_;
3732 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); 3736 bool is_offscreen = !!offscreen_target_frame_buffer_.get();
3733 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); 3737 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically();
3734 caps.msaa_is_slow = workarounds().msaa_is_slow; 3738 caps.msaa_is_slow = workarounds().msaa_is_slow;
3735 3739
3736 caps.blend_equation_advanced = 3740 caps.blend_equation_advanced =
3737 feature_info_->feature_flags().blend_equation_advanced; 3741 feature_info_->feature_flags().blend_equation_advanced;
3738 caps.blend_equation_advanced_coherent = 3742 caps.blend_equation_advanced_coherent =
3739 feature_info_->feature_flags().blend_equation_advanced_coherent; 3743 feature_info_->feature_flags().blend_equation_advanced_coherent;
(...skipping 7973 matching lines...) Expand 10 before | Expand all | Expand 10 after
11713 state_.unpack_image_height = param; 11717 state_.unpack_image_height = param;
11714 break; 11718 break;
11715 default: 11719 default:
11716 // Validation should have prevented us from getting here. 11720 // Validation should have prevented us from getting here.
11717 NOTREACHED(); 11721 NOTREACHED();
11718 break; 11722 break;
11719 } 11723 }
11720 return error::kNoError; 11724 return error::kNoError;
11721 } 11725 }
11722 11726
11723 error::Error GLES2DecoderImpl::HandleSwapBuffersWithDamageCHROMIUM( 11727 void GLES2DecoderImpl::DoSwapBuffersWithBoundsCHROMIUM(
11724 uint32_t immediate_data_size, 11728 GLsizei count,
11725 const volatile void* cmd_data) { 11729 const volatile GLint* rects) {
11726 const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM& c = 11730 TRACE_EVENT0("gpu", "GLES2DecoderImpl::SwapBuffersWithBoundsCHROMIUM");
11727 *static_cast<const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM*>(
11728 cmd_data);
11729 TRACE_EVENT0("gpu", "GLES2DecoderImpl::SwapBuffersWithDamageCHROMIUM");
11730 { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); } 11731 { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); }
11731 if (!supports_swap_buffers_with_damage_) { 11732 if (!supports_swap_buffers_with_bounds_) {
11732 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSwapBuffersWithDamageCHROMIUM", 11733 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSwapBuffersWithBoundsCHROMIUM",
11733 "command not supported by surface"); 11734 "command not supported by surface");
11734 return error::kNoError; 11735 return;
11735 } 11736 }
11736 bool is_tracing; 11737 bool is_tracing;
11737 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), 11738 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"),
11738 &is_tracing); 11739 &is_tracing);
11739 if (is_tracing) { 11740 if (is_tracing) {
11740 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); 11741 bool is_offscreen = !!offscreen_target_frame_buffer_.get();
11741 ScopedFramebufferBinder binder(this, GetBoundDrawFramebufferServiceId()); 11742 ScopedFramebufferBinder binder(this, GetBoundDrawFramebufferServiceId());
11742 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( 11743 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer(
11743 is_offscreen ? offscreen_size_ : surface_->GetSize()); 11744 is_offscreen ? offscreen_size_ : surface_->GetSize());
11744 } 11745 }
11745 11746
11746 ClearScheduleCALayerState(); 11747 ClearScheduleCALayerState();
11747 11748
11748 FinishSwapBuffers( 11749 std::vector<gfx::Rect> bounds(count);
11749 surface_->SwapBuffersWithDamage(c.x, c.y, c.width, c.height)); 11750 for (GLsizei i = 0; i < count; ++i) {
11750 11751 bounds[i] = gfx::Rect(rects[i * 4 + 0], rects[i * 4 + 1], rects[i * 4 + 2],
11751 return error::kNoError; 11752 rects[i * 4 + 3]);
11753 }
11754 FinishSwapBuffers(surface_->SwapBuffersWithBounds(bounds));
11752 } 11755 }
11753 11756
11754 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( 11757 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
11755 uint32_t immediate_data_size, 11758 uint32_t immediate_data_size,
11756 const volatile void* cmd_data) { 11759 const volatile void* cmd_data) {
11757 const volatile gles2::cmds::PostSubBufferCHROMIUM& c = 11760 const volatile gles2::cmds::PostSubBufferCHROMIUM& c =
11758 *static_cast<const volatile gles2::cmds::PostSubBufferCHROMIUM*>( 11761 *static_cast<const volatile gles2::cmds::PostSubBufferCHROMIUM*>(
11759 cmd_data); 11762 cmd_data);
11760 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); 11763 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM");
11761 { 11764 {
(...skipping 7479 matching lines...) Expand 10 before | Expand all | Expand 10 after
19241 } 19244 }
19242 19245
19243 // Include the auto-generated part of this file. We split this because it means 19246 // Include the auto-generated part of this file. We split this because it means
19244 // we can easily edit the non-auto generated parts right here in this file 19247 // we can easily edit the non-auto generated parts right here in this file
19245 // instead of having to edit some template or the code generator. 19248 // instead of having to edit some template or the code generator.
19246 #include "base/macros.h" 19249 #include "base/macros.h"
19247 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19250 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19248 19251
19249 } // namespace gles2 19252 } // namespace gles2
19250 } // namespace gpu 19253 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698