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

Unified Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 12892005: Implement client side PBOs for glReadPixel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lots of cleanup, made sure callbacks come back in right order Created 7 years, 9 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
Index: gpu/command_buffer/client/gles2_implementation_unittest.cc
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index edc7c6a08b920d1aabd338fef8b678c58bcdd6b9..860116eb286e836c3613569b86709b596444d0da 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -1420,6 +1420,45 @@ TEST_F(GLES2ImplementationTest, ReadPixelsBadFormatType) {
gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, buffer.get());
}
+TEST_F(GLES2ImplementationTest, ReadPixelsWithPBO) {
+ struct Cmds {
+ cmds::ReadPixels read;
+ cmd::SetToken set_token;
+ };
+ const GLint kBytesPerPixel = 4;
+ const GLint kWidth = 2;
+ const GLint kHeight = 2;
+ const GLenum kFormat = 0;
+ const GLenum kType = 0;
+
+ ExpectedMemoryInfo mem1 =
+ GetExpectedMemory(kWidth * kHeight * kBytesPerPixel);
+ ExpectedMemoryInfo result1 =
+ GetExpectedResultMemory(sizeof(cmds::ReadPixels::Result));
+
+ Cmds expected;
+ expected.read.Init(
+ 0, 0, kWidth, kHeight, kFormat, kType,
+ mem1.id, mem1.offset, result1.id, result1.offset);
+ expected.set_token.Init(GetNextToken());
+ scoped_array<int8> buffer(new int8[kWidth * kHeight * kBytesPerPixel]);
+
+ GLuint b;
+ gl_->GenBuffers(1, &b);
+ gl_->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, b);
+ gl_->BufferData(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
+ kWidth * kHeight * kBytesPerPixel,
+ NULL,
+ 0 /* GL_STREAM_READ */ );
+ gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, 0);
+ EXPECT_TRUE(gl_->MapBufferCHROMIUM(
+ GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
+ GL_READ_ONLY));
+ gl_->UnmapBufferCHROMIUM(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM);
+ gl_->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0);
+ gl_->DeleteBuffers(1, &b);
greggman 2013/03/20 00:42:17 Ideally you want to check that gl_->ReadPixels ins
+}
+
TEST_F(GLES2ImplementationTest, FreeUnusedSharedMemory) {
struct Cmds {
cmds::BufferSubData buf;
@@ -2809,4 +2848,3 @@ TEST_F(GLES2ImplementationTest, Enable) {
} // namespace gles2
} // namespace gpu
-

Powered by Google App Engine
This is Rietveld 408576698