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

Unified Diff: gpu/command_buffer/tests/gl_texture_mailbox_unittests.cc

Issue 15798014: Replace context parenting by sharing through mailboxes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.cc ('k') | gpu/ipc/command_buffer_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_texture_mailbox_unittests.cc
diff --git a/gpu/command_buffer/tests/gl_texture_mailbox_unittests.cc b/gpu/command_buffer/tests/gl_texture_mailbox_unittests.cc
index 566189f9e44288a78528c88627ecadbed6039f58..dbd513cfe5731d21cec4b0f3c7ff2d6dfc53e6ee 100644
--- a/gpu/command_buffer/tests/gl_texture_mailbox_unittests.cc
+++ b/gpu/command_buffer/tests/gl_texture_mailbox_unittests.cc
@@ -6,6 +6,9 @@
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
+#include "gpu/command_buffer/client/gles2_lib.h"
+#include "gpu/command_buffer/common/mailbox.h"
+#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/tests/gl_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -37,7 +40,7 @@ uint32 ReadTexel(GLuint id, GLint x, GLint y) {
EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
glCheckFramebufferStatus(GL_FRAMEBUFFER));
- uint32 texel;
+ uint32 texel = 0;
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &texel);
glBindFramebuffer(GL_FRAMEBUFFER, old_fbo);
@@ -266,5 +269,54 @@ TEST_F(GLTextureMailboxTest, SharedTextures) {
EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
}
+TEST_F(GLTextureMailboxTest, ProduceFrontBuffer) {
+ gl1_.MakeCurrent();
+ Mailbox mailbox;
+ glGenMailboxCHROMIUM(mailbox.name);
+
+ gl2_.MakeCurrent();
+ gl2_.decoder()->ProduceFrontBuffer(mailbox);
+
+ gl1_.MakeCurrent();
+ GLuint tex1;
+ glGenTextures(1, &tex1);
+ glBindTexture(GL_TEXTURE_2D, tex1);
+ glConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
+
+ gl2_.MakeCurrent();
+ glResizeCHROMIUM(10, 10, 1);
+ glClearColor(1, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ ::gles2::GetGLContext()->SwapBuffers();
+
+ gl1_.MakeCurrent();
+ EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 0, 0));
+ EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 9, 9));
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
+
+ gl2_.MakeCurrent();
+ glClearColor(0, 1, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glFlush();
+
+ gl1_.MakeCurrent();
+ EXPECT_EQ(0xFF0000FFu, ReadTexel(tex1, 0, 0));
+
+ gl2_.MakeCurrent();
+ ::gles2::GetGLContext()->SwapBuffers();
+
+ gl1_.MakeCurrent();
+ EXPECT_EQ(0xFF00FF00u, ReadTexel(tex1, 0, 0));
+
+ gl2_.MakeCurrent();
+ gl2_.Destroy();
+
+ gl1_.MakeCurrent();
+ EXPECT_EQ(0xFF00FF00u, ReadTexel(tex1, 0, 0));
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
+ glDeleteTextures(1, &tex1);
+}
+
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.cc ('k') | gpu/ipc/command_buffer_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698