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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2302393002: Support swap damage rect using eglSwapBuffersWithDamageKHR (Closed)
Patch Set: Added new SwapBuffersWithDamage entry point Created 4 years, 3 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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 helper_->SwapBuffers(); 1442 helper_->SwapBuffers();
1443 helper_->CommandBufferHelper::Flush(); 1443 helper_->CommandBufferHelper::Flush();
1444 // Wait if we added too many swap buffers. Add 1 to kMaxSwapBuffers to 1444 // Wait if we added too many swap buffers. Add 1 to kMaxSwapBuffers to
1445 // compensate for TODO above. 1445 // compensate for TODO above.
1446 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { 1446 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
1447 helper_->WaitForToken(swap_buffers_tokens_.front()); 1447 helper_->WaitForToken(swap_buffers_tokens_.front());
1448 swap_buffers_tokens_.pop(); 1448 swap_buffers_tokens_.pop();
1449 } 1449 }
1450 } 1450 }
1451 1451
1452 void GLES2Implementation::SwapBuffersWithDamageCHROMIUM(GLint x,
1453 GLint y,
1454 GLint width,
1455 GLint height) {
1456 GPU_CLIENT_SINGLE_THREAD_CHECK();
1457 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapBuffersWithDamageCHROMIUM("
1458 << x << ", " << y << ", " << width << ", " << height
1459 << ")");
1460 TRACE_EVENT2("gpu", "GLES2::SwapBuffersWithDamageCHROMIUM", "width", width,
1461 "height", height);
1462
1463 // Same flow control as GLES2Implementation::SwapBuffers (see comments there).
1464 swap_buffers_tokens_.push(helper_->InsertToken());
1465 helper_->SwapBuffersWithDamageCHROMIUM(x, y, width, height);
1466 helper_->CommandBufferHelper::Flush();
1467 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
1468 helper_->WaitForToken(swap_buffers_tokens_.front());
1469 swap_buffers_tokens_.pop();
1470 }
1471 }
1472
1452 void GLES2Implementation::SwapInterval(int interval) { 1473 void GLES2Implementation::SwapInterval(int interval) {
1453 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1474 GPU_CLIENT_SINGLE_THREAD_CHECK();
1454 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapInterval(" 1475 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapInterval("
1455 << interval << ")"); 1476 << interval << ")");
1456 helper_->SwapInterval(interval); 1477 helper_->SwapInterval(interval);
1457 } 1478 }
1458 1479
1459 void GLES2Implementation::BindAttribLocation( 1480 void GLES2Implementation::BindAttribLocation(
1460 GLuint program, GLuint index, const char* name) { 1481 GLuint program, GLuint index, const char* name) {
1461 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1482 GPU_CLIENT_SINGLE_THREAD_CHECK();
(...skipping 3245 matching lines...) Expand 10 before | Expand all | Expand 10 after
4707 // then it will have told the ShareGroup, so just report its status. 4728 // then it will have told the ShareGroup, so just report its status.
4708 if (share_group_->IsLost()) 4729 if (share_group_->IsLost())
4709 return GL_UNKNOWN_CONTEXT_RESET_KHR; 4730 return GL_UNKNOWN_CONTEXT_RESET_KHR;
4710 return GL_NO_ERROR; 4731 return GL_NO_ERROR;
4711 } 4732 }
4712 4733
4713 void GLES2Implementation::Swap() { 4734 void GLES2Implementation::Swap() {
4714 SwapBuffers(); 4735 SwapBuffers();
4715 } 4736 }
4716 4737
4738 void GLES2Implementation::SwapWithDamage(const gfx::Rect& damage) {
4739 SwapBuffersWithDamageCHROMIUM(damage.x(), damage.y(), damage.width(),
4740 damage.height());
4741 }
4742
4717 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { 4743 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) {
4718 PostSubBufferCHROMIUM( 4744 PostSubBufferCHROMIUM(
4719 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height()); 4745 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height());
4720 } 4746 }
4721 4747
4722 void GLES2Implementation::CommitOverlayPlanes() { 4748 void GLES2Implementation::CommitOverlayPlanes() {
4723 CommitOverlayPlanesCHROMIUM(); 4749 CommitOverlayPlanesCHROMIUM();
4724 } 4750 }
4725 4751
4726 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { 4752 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) {
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after
6895 cached_extensions_.clear(); 6921 cached_extensions_.clear();
6896 } 6922 }
6897 6923
6898 // Include the auto-generated part of this file. We split this because it means 6924 // Include the auto-generated part of this file. We split this because it means
6899 // we can easily edit the non-auto generated parts right here in this file 6925 // we can easily edit the non-auto generated parts right here in this file
6900 // instead of having to edit some template or the code generator. 6926 // instead of having to edit some template or the code generator.
6901 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 6927 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
6902 6928
6903 } // namespace gles2 6929 } // namespace gles2
6904 } // namespace gpu 6930 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698