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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.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 // 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 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 helper_->SwapBuffers(); 1481 helper_->SwapBuffers();
1482 helper_->CommandBufferHelper::Flush(); 1482 helper_->CommandBufferHelper::Flush();
1483 // Wait if we added too many swap buffers. Add 1 to kMaxSwapBuffers to 1483 // Wait if we added too many swap buffers. Add 1 to kMaxSwapBuffers to
1484 // compensate for TODO above. 1484 // compensate for TODO above.
1485 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { 1485 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
1486 helper_->WaitForToken(swap_buffers_tokens_.front()); 1486 helper_->WaitForToken(swap_buffers_tokens_.front());
1487 swap_buffers_tokens_.pop(); 1487 swap_buffers_tokens_.pop();
1488 } 1488 }
1489 } 1489 }
1490 1490
1491 void GLES2Implementation::SwapBuffersWithDamageCHROMIUM(GLint x, 1491 void GLES2Implementation::SwapBuffersWithBoundsCHROMIUM(GLsizei count,
1492 GLint y, 1492 const GLint* rects) {
1493 GLint width,
1494 GLint height) {
1495 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1493 GPU_CLIENT_SINGLE_THREAD_CHECK();
1496 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapBuffersWithDamageCHROMIUM(" 1494 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapBuffersWithBoundsCHROMIUM("
1497 << x << ", " << y << ", " << width << ", " << height 1495 << count << ", " << static_cast<const void*>(rects)
1498 << ")"); 1496 << ")");
1499 TRACE_EVENT2("gpu", "GLES2::SwapBuffersWithDamageCHROMIUM", "width", width, 1497 GPU_CLIENT_LOG_CODE_BLOCK({
1500 "height", height); 1498 for (GLsizei i = 0; i < count; ++i) {
1499 GPU_CLIENT_LOG(" " << i << ": " << rects[0 + i * 4] << ", "
1500 << rects[1 + i * 4] << ", " << rects[2 + i * 4]
1501 << ", " << rects[3 + i * 4]);
1502 }
1503 });
1504 if (count < 0) {
1505 SetGLError(GL_INVALID_VALUE, "glSwapBuffersWithBoundsCHROMIUM",
1506 "count < 0");
1507 return;
1508 }
1501 1509
1502 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). 1510 // Same flow control as GLES2Implementation::SwapBuffers (see comments there).
1503 swap_buffers_tokens_.push(helper_->InsertToken()); 1511 swap_buffers_tokens_.push(helper_->InsertToken());
1504 helper_->SwapBuffersWithDamageCHROMIUM(x, y, width, height); 1512 helper_->SwapBuffersWithBoundsCHROMIUMImmediate(count, rects);
1505 helper_->CommandBufferHelper::Flush(); 1513 helper_->CommandBufferHelper::Flush();
1506 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { 1514 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
1507 helper_->WaitForToken(swap_buffers_tokens_.front()); 1515 helper_->WaitForToken(swap_buffers_tokens_.front());
1508 swap_buffers_tokens_.pop(); 1516 swap_buffers_tokens_.pop();
1509 } 1517 }
1510 } 1518 }
1511 1519
1512 void GLES2Implementation::SwapInterval(int interval) { 1520 void GLES2Implementation::SwapInterval(int interval) {
1513 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1521 GPU_CLIENT_SINGLE_THREAD_CHECK();
1514 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapInterval(" 1522 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapInterval("
(...skipping 3354 matching lines...) Expand 10 before | Expand all | Expand 10 after
4869 // then it will have told the ShareGroup, so just report its status. 4877 // then it will have told the ShareGroup, so just report its status.
4870 if (share_group_->IsLost()) 4878 if (share_group_->IsLost())
4871 return GL_UNKNOWN_CONTEXT_RESET_KHR; 4879 return GL_UNKNOWN_CONTEXT_RESET_KHR;
4872 return GL_NO_ERROR; 4880 return GL_NO_ERROR;
4873 } 4881 }
4874 4882
4875 void GLES2Implementation::Swap() { 4883 void GLES2Implementation::Swap() {
4876 SwapBuffers(); 4884 SwapBuffers();
4877 } 4885 }
4878 4886
4879 void GLES2Implementation::SwapWithDamage(const gfx::Rect& damage) { 4887 void GLES2Implementation::SwapWithBounds(const std::vector<gfx::Rect>& rects) {
4880 SwapBuffersWithDamageCHROMIUM(damage.x(), damage.y(), damage.width(), 4888 std::vector<int> rects_data(rects.size() * 4);
4881 damage.height()); 4889 for (size_t i = 0; i < rects.size(); ++i) {
4890 rects_data[i * 4 + 0] = rects[i].x();
4891 rects_data[i * 4 + 1] = rects[i].y();
4892 rects_data[i * 4 + 2] = rects[i].width();
4893 rects_data[i * 4 + 3] = rects[i].height();
4894 }
4895 SwapBuffersWithBoundsCHROMIUM(rects.size(), rects_data.data());
4882 } 4896 }
4883 4897
4884 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { 4898 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) {
4885 PostSubBufferCHROMIUM( 4899 PostSubBufferCHROMIUM(
4886 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height()); 4900 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height());
4887 } 4901 }
4888 4902
4889 void GLES2Implementation::CommitOverlayPlanes() { 4903 void GLES2Implementation::CommitOverlayPlanes() {
4890 CommitOverlayPlanesCHROMIUM(); 4904 CommitOverlayPlanesCHROMIUM();
4891 } 4905 }
(...skipping 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after
7087 CheckGLError(); 7101 CheckGLError();
7088 } 7102 }
7089 7103
7090 // Include the auto-generated part of this file. We split this because it means 7104 // Include the auto-generated part of this file. We split this because it means
7091 // we can easily edit the non-auto generated parts right here in this file 7105 // we can easily edit the non-auto generated parts right here in this file
7092 // instead of having to edit some template or the code generator. 7106 // instead of having to edit some template or the code generator.
7093 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 7107 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
7094 7108
7095 } // namespace gles2 7109 } // namespace gles2
7096 } // namespace gpu 7110 } // 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