summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client/gles2_implementation.cc
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-27 22:34:47 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-27 22:34:47 +0000
commit40c7ee4e84ba84f73b85521b47fe33e866c1d2da (patch)
treed2589e6da164405649f2818a0e45c083488a5b23 /gpu/command_buffer/client/gles2_implementation.cc
parentc66019913aa4948835a24ca0f9feccb63003a6d7 (diff)
downloadchromium_src-40c7ee4e84ba84f73b85521b47fe33e866c1d2da.zip
chromium_src-40c7ee4e84ba84f73b85521b47fe33e866c1d2da.tar.gz
chromium_src-40c7ee4e84ba84f73b85521b47fe33e866c1d2da.tar.bz2
Add glGetMultipleIntegervCHROMIUM
This is a step to adding more client side state caching. TEST=unit tests BUG=85969 R=apatrick@chromium.org Review URL: http://codereview.chromium.org/7217029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client/gles2_implementation.cc')
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc55
1 files changed, 55 insertions, 0 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index a8f16f9..6a215a4 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -2006,5 +2006,60 @@ void GLES2Implementation::RateLimitOffscreenContextCHROMIUM() {
rate_limit_tokens_.push(helper_->InsertToken());
}
+void GLES2Implementation::GetMultipleIntegervCHROMIUM(
+ const GLenum* pnames, GLuint count, GLint* results, GLsizeiptr size) {
+ GPU_CLIENT_LOG("[" << this << "] glGetMultipleIntegervCHROMIUM("
+ << static_cast<const void*>(pnames) << ", "
+ << count << ", " << results << ", " << size << ")");
+ GPU_CLIENT_LOG_CODE_BLOCK({
+ for (GLuint i = 0; i < count; ++i) {
+ GPU_CLIENT_LOG(
+ " " << i << ": " << GLES2Util::GetStringGLState(pnames[i]));
+ }
+ });
+ int num_results = 0;
+ for (GLuint ii = 0; ii < count; ++ii) {
+ int num = util_.GLGetNumValuesReturned(pnames[ii]);
+ if (!num) {
+ SetGLError(GL_INVALID_ENUM, "glGetMultipleIntegervCHROMIUM: bad pname");
+ return;
+ }
+ num_results += num;
+ }
+ if (static_cast<size_t>(size) != num_results * sizeof(GLint)) {
+ SetGLError(GL_INVALID_VALUE, "glGetMultipleIntegervCHROMIUM: bad size");
+ return;
+ }
+ for (int ii = 0; ii < num_results; ++ii) {
+ if (results[ii] != 0) {
+ SetGLError(GL_INVALID_VALUE,
+ "glGetMultipleIntegervCHROMIUM: results not set to zero.");
+ return;
+ }
+ }
+ uint32 size_needed =
+ count * sizeof(pnames[0]) + num_results * sizeof(results[0]);
+ void* buffer = transfer_buffer_.Alloc(size_needed);
+ GLenum* pnames_buffer = static_cast<GLenum*>(buffer);
+ void* results_buffer = pnames_buffer + count;
+ memcpy(pnames_buffer, pnames, count * sizeof(GLenum));
+ memset(results_buffer, 0, num_results * sizeof(GLint));
+ helper_->GetMultipleIntegervCHROMIUM(
+ transfer_buffer_id_, transfer_buffer_.GetOffset(pnames_buffer),
+ count,
+ transfer_buffer_id_, transfer_buffer_.GetOffset(results_buffer),
+ size);
+ WaitForCmd();
+ memcpy(results, results_buffer, size);
+ // TODO(gman): We should be able to free without a token.
+ transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken());
+ GPU_CLIENT_LOG(" returned");
+ GPU_CLIENT_LOG_CODE_BLOCK({
+ for (int i = 0; i < num_results; ++i) {
+ GPU_CLIENT_LOG(" " << i << ": " << (results[i]));
+ }
+ });
+}
+
} // namespace gles2
} // namespace gpu