summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 16:38:35 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 16:38:35 +0000
commit39b9f7eeb2c14ba1188051d3203d18a4664c3e36 (patch)
tree5ff3e203031e90a176b3a8de09d98309087ce07d /gpu
parentb616c2b264627e884a6e2c94f7e360ce79edc8d6 (diff)
downloadchromium_src-39b9f7eeb2c14ba1188051d3203d18a4664c3e36.zip
chromium_src-39b9f7eeb2c14ba1188051d3203d18a4664c3e36.tar.gz
chromium_src-39b9f7eeb2c14ba1188051d3203d18a4664c3e36.tar.bz2
Move limiting how many SwapBuffer calls the client
can queue from ggl to the command buffer code. TEST=none BUG=none Review URL: http://codereview.chromium.org/5606009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68479 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc6
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 64bcbe2..4e75be9 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -651,7 +651,13 @@ void GLES2Implementation::Finish() {
}
void GLES2Implementation::SwapBuffers() {
+ // Wait if this would add too many swap buffers.
+ if (swap_buffers_tokens_.size() == kMaxSwapBuffers) {
+ helper_->WaitForToken(swap_buffers_tokens_.front());
+ swap_buffers_tokens_.pop();
+ }
helper_->SwapBuffers();
+ swap_buffers_tokens_.push(helper_->InsertToken());
Flush();
}
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index d56e32e..f3f202e 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -8,6 +8,7 @@
#include <GLES2/gl2.h>
#include <map>
+#include <queue>
#include <set>
#include <string>
#include <vector>
@@ -70,6 +71,9 @@ class GLES2Implementation {
static const GLuint kClientSideArrayId = 0xFEDCBA98u;
static const GLuint kClientSideElementArrayId = 0xFEDCBA99u;
+ // Number of swap buffers allowed before waiting.
+ static const size_t kMaxSwapBuffers = 2;
+
GLES2Implementation(
GLES2CmdHelper* helper,
size_t transfer_buffer_size,
@@ -347,6 +351,8 @@ class GLES2Implementation {
uint32 result_shm_offset_;
std::string last_error_;
+ std::queue<int32> swap_buffers_tokens_;
+
// pack alignment as last set by glPixelStorei
GLint pack_alignment_;