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

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

Issue 634083002: gpu: Compositor management of GpuMemoryBuffer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-pre-chromium-image-refactor
Patch Set: rebase Created 6 years, 2 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/service/in_process_command_buffer.cc ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
diff --git a/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc b/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
index c73cc3dc85f207e006ee53654423b78e04d60d93..745ceb9bb8781367247be3876ad85dcd5264ba0a 100644
--- a/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
+++ b/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
@@ -17,6 +17,7 @@
#include "gpu/command_buffer/tests/gl_test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gl/gl_image.h"
using testing::_;
@@ -73,14 +74,11 @@ class GpuMemoryBufferTest : public testing::Test {
TEST_F(GpuMemoryBufferTest, Lifecycle) {
uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u };
- // Create the image. This should add the image ID to the ImageManager.
- GLuint image_id = glCreateImageCHROMIUM(
- kImageWidth, kImageHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM);
- EXPECT_NE(0u, image_id);
- EXPECT_TRUE(gl_.decoder()->GetImageManager()->LookupImage(image_id) != NULL);
+ scoped_ptr<gfx::GpuMemoryBuffer> buffer(gl_.CreateGpuMemoryBuffer(
+ gfx::Size(kImageWidth, kImageHeight), gfx::GpuMemoryBuffer::RGBA_8888));
- // Map image for writing.
- uint8* mapped_buffer = static_cast<uint8*>(glMapImageCHROMIUM(image_id));
+ // Map buffer for writing.
+ uint8* mapped_buffer = static_cast<uint8*>(buffer->Map());
ASSERT_TRUE(mapped_buffer != NULL);
// Assign a value to each pixel.
@@ -94,8 +92,14 @@ TEST_F(GpuMemoryBufferTest, Lifecycle) {
}
}
- // Unmap the image.
- glUnmapImageCHROMIUM(image_id);
+ // Unmap the buffer.
+ buffer->Unmap();
+
+ // Create the image. This should add the image ID to the ImageManager.
+ GLuint image_id = glCreateImageCHROMIUM(
+ buffer->AsClientBuffer(), kImageWidth, kImageHeight, GL_RGBA);
+ EXPECT_NE(0u, image_id);
+ EXPECT_TRUE(gl_.decoder()->GetImageManager()->LookupImage(image_id) != NULL);
// Bind the texture and the image.
glBindTexture(GL_TEXTURE_2D, texture_ids_[0]);
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.cc ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698