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

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

Issue 2302393002: Support swap damage rect using eglSwapBuffersWithDamageKHR (Closed)
Patch Set: Update GLSurfaceAdapter 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 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 helper_->SwapBuffers(); 1443 helper_->SwapBuffers();
1444 helper_->CommandBufferHelper::Flush(); 1444 helper_->CommandBufferHelper::Flush();
1445 // Wait if we added too many swap buffers. Add 1 to kMaxSwapBuffers to 1445 // Wait if we added too many swap buffers. Add 1 to kMaxSwapBuffers to
1446 // compensate for TODO above. 1446 // compensate for TODO above.
1447 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { 1447 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
1448 helper_->WaitForToken(swap_buffers_tokens_.front()); 1448 helper_->WaitForToken(swap_buffers_tokens_.front());
1449 swap_buffers_tokens_.pop(); 1449 swap_buffers_tokens_.pop();
1450 } 1450 }
1451 } 1451 }
1452 1452
1453 void GLES2Implementation::SwapBuffersWithDamageCHROMIUM(GLint x,
1454 GLint y,
1455 GLint width,
1456 GLint height) {
1457 GPU_CLIENT_SINGLE_THREAD_CHECK();
1458 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapBuffersWithDamageCHROMIUM("
1459 << x << ", " << y << ", " << width << ", " << height
1460 << ")");
1461 TRACE_EVENT2("gpu", "GLES2::SwapBuffersWithDamageCHROMIUM", "width", width,
1462 "height", height);
1463
1464 // Same flow control as GLES2Implementation::SwapBuffers (see comments there).
1465 swap_buffers_tokens_.push(helper_->InsertToken());
1466 helper_->SwapBuffersWithDamageCHROMIUM(x, y, width, height);
1467 helper_->CommandBufferHelper::Flush();
1468 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
1469 helper_->WaitForToken(swap_buffers_tokens_.front());
1470 swap_buffers_tokens_.pop();
1471 }
1472 }
1473
1453 void GLES2Implementation::SwapInterval(int interval) { 1474 void GLES2Implementation::SwapInterval(int interval) {
1454 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1475 GPU_CLIENT_SINGLE_THREAD_CHECK();
1455 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapInterval(" 1476 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapInterval("
1456 << interval << ")"); 1477 << interval << ")");
1457 helper_->SwapInterval(interval); 1478 helper_->SwapInterval(interval);
1458 } 1479 }
1459 1480
1460 void GLES2Implementation::BindAttribLocation( 1481 void GLES2Implementation::BindAttribLocation(
1461 GLuint program, GLuint index, const char* name) { 1482 GLuint program, GLuint index, const char* name) {
1462 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1483 GPU_CLIENT_SINGLE_THREAD_CHECK();
(...skipping 3275 matching lines...) Expand 10 before | Expand all | Expand 10 after
4738 // then it will have told the ShareGroup, so just report its status. 4759 // then it will have told the ShareGroup, so just report its status.
4739 if (share_group_->IsLost()) 4760 if (share_group_->IsLost())
4740 return GL_UNKNOWN_CONTEXT_RESET_KHR; 4761 return GL_UNKNOWN_CONTEXT_RESET_KHR;
4741 return GL_NO_ERROR; 4762 return GL_NO_ERROR;
4742 } 4763 }
4743 4764
4744 void GLES2Implementation::Swap() { 4765 void GLES2Implementation::Swap() {
4745 SwapBuffers(); 4766 SwapBuffers();
4746 } 4767 }
4747 4768
4769 void GLES2Implementation::SwapWithDamage(const gfx::Rect& damage) {
4770 SwapBuffersWithDamageCHROMIUM(damage.x(), damage.y(), damage.width(),
4771 damage.height());
4772 }
4773
4748 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { 4774 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) {
4749 PostSubBufferCHROMIUM( 4775 PostSubBufferCHROMIUM(
4750 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height()); 4776 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height());
4751 } 4777 }
4752 4778
4753 void GLES2Implementation::CommitOverlayPlanes() { 4779 void GLES2Implementation::CommitOverlayPlanes() {
4754 CommitOverlayPlanesCHROMIUM(); 4780 CommitOverlayPlanesCHROMIUM();
4755 } 4781 }
4756 4782
4757 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { 4783 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) {
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after
6926 cached_extensions_.clear(); 6952 cached_extensions_.clear();
6927 } 6953 }
6928 6954
6929 // Include the auto-generated part of this file. We split this because it means 6955 // Include the auto-generated part of this file. We split this because it means
6930 // we can easily edit the non-auto generated parts right here in this file 6956 // we can easily edit the non-auto generated parts right here in this file
6931 // instead of having to edit some template or the code generator. 6957 // instead of having to edit some template or the code generator.
6932 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 6958 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
6933 6959
6934 } // namespace gles2 6960 } // namespace gles2
6935 } // namespace gpu 6961 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698