Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| index 8a035114f52e142bd7a88abe407e790945175b03..94b10bf73ec3fe597a0c186526b81970010ccbe8 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -913,6 +913,10 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| // Wrapper for SwapBuffers. |
| void DoSwapBuffers(); |
| + // Wrapper for SwapBuffersWithBoundsCHROMIUM |
|
meacer
2017/02/02 21:42:33
nit: missing period at the end.
halliwell
2017/02/03 20:17:00
Done.
|
| + void DoSwapBuffersWithBoundsCHROMIUM(GLsizei count, |
| + const volatile GLint* rects); |
| + |
| // Callback for async SwapBuffers. |
| void FinishSwapBuffers(gfx::SwapResult result); |
| @@ -2341,7 +2345,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| bool context_was_lost_; |
| bool reset_by_robustness_extension_; |
| bool supports_post_sub_buffer_; |
| - bool supports_swap_buffers_with_damage_; |
| + bool supports_swap_buffers_with_bounds_; |
| bool supports_commit_overlay_planes_; |
| bool supports_async_swap_; |
| @@ -3032,7 +3036,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) |
| context_was_lost_(false), |
| reset_by_robustness_extension_(false), |
| supports_post_sub_buffer_(false), |
| - supports_swap_buffers_with_damage_(false), |
| + supports_swap_buffers_with_bounds_(false), |
| supports_commit_overlay_planes_(false), |
| supports_async_swap_(false), |
| derivatives_explicitly_enabled_(false), |
| @@ -3542,7 +3546,7 @@ bool GLES2DecoderImpl::Initialize( |
| !surface->IsOffscreen()) |
| supports_post_sub_buffer_ = false; |
| - supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage(); |
| + supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds(); |
| supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); |
| @@ -3714,7 +3718,7 @@ Capabilities GLES2DecoderImpl::GetCapabilities() { |
| #endif |
| caps.post_sub_buffer = supports_post_sub_buffer_; |
| - caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_; |
| + caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_; |
| caps.commit_overlay_planes = supports_commit_overlay_planes_; |
| caps.surfaceless = surfaceless_; |
| bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
| @@ -11708,18 +11712,15 @@ error::Error GLES2DecoderImpl::HandlePixelStorei( |
| return error::kNoError; |
| } |
| -error::Error GLES2DecoderImpl::HandleSwapBuffersWithDamageCHROMIUM( |
| - uint32_t immediate_data_size, |
| - const volatile void* cmd_data) { |
| - const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM& c = |
| - *static_cast<const volatile gles2::cmds::SwapBuffersWithDamageCHROMIUM*>( |
| - cmd_data); |
| - TRACE_EVENT0("gpu", "GLES2DecoderImpl::SwapBuffersWithDamageCHROMIUM"); |
| +void GLES2DecoderImpl::DoSwapBuffersWithBoundsCHROMIUM( |
| + GLsizei count, |
| + const volatile GLint* rects) { |
| + TRACE_EVENT0("gpu", "GLES2DecoderImpl::SwapBuffersWithBoundsCHROMIUM"); |
| { TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); } |
| - if (!supports_swap_buffers_with_damage_) { |
| - LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSwapBuffersWithDamageCHROMIUM", |
| + if (!supports_swap_buffers_with_bounds_) { |
| + LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSwapBuffersWithBoundsCHROMIUM", |
| "command not supported by surface"); |
| - return error::kNoError; |
| + return; |
| } |
| bool is_tracing; |
| TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
| @@ -11733,10 +11734,12 @@ error::Error GLES2DecoderImpl::HandleSwapBuffersWithDamageCHROMIUM( |
| ClearScheduleCALayerState(); |
| - FinishSwapBuffers( |
| - surface_->SwapBuffersWithDamage(c.x, c.y, c.width, c.height)); |
| - |
| - return error::kNoError; |
| + std::vector<gfx::Rect> bounds(count); |
| + for (GLsizei i = 0; i != count; ++i) { |
| + bounds[i] = gfx::Rect(rects[i * 4 + 0], rects[i * 4 + 1], rects[i * 4 + 2], |
| + rects[i * 4 + 3]); |
| + } |
| + FinishSwapBuffers(surface_->SwapBuffersWithBounds(bounds)); |
| } |
| error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |