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

Side by Side Diff: gpu/command_buffer/service/buffer_manager_unittest.cc

Issue 12378034: Use client side arrays for GL_STREAM_DRAW attributes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix copy bug 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/buffer_manager.h" 5 #include "gpu/command_buffer/service/buffer_manager.h"
6 #include "gpu/command_buffer/service/mocks.h" 6 #include "gpu/command_buffer/service/mocks.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gl/gl_mock.h" 8 #include "ui/gl/gl_mock.h"
9 9
10 using ::testing::StrictMock; 10 using ::testing::StrictMock;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 const GLuint kClientBuffer2Id = 2; 66 const GLuint kClientBuffer2Id = 2;
67 // Check we can create buffer. 67 // Check we can create buffer.
68 manager_->CreateBuffer(kClientBuffer1Id, kServiceBuffer1Id); 68 manager_->CreateBuffer(kClientBuffer1Id, kServiceBuffer1Id);
69 // Check buffer got created. 69 // Check buffer got created.
70 Buffer* info1 = manager_->GetBuffer(kClientBuffer1Id); 70 Buffer* info1 = manager_->GetBuffer(kClientBuffer1Id);
71 ASSERT_TRUE(info1 != NULL); 71 ASSERT_TRUE(info1 != NULL);
72 EXPECT_EQ(0u, GetTarget(info1)); 72 EXPECT_EQ(0u, GetTarget(info1));
73 EXPECT_EQ(0, info1->size()); 73 EXPECT_EQ(0, info1->size());
74 EXPECT_EQ(static_cast<GLenum>(GL_STATIC_DRAW), info1->usage()); 74 EXPECT_EQ(static_cast<GLenum>(GL_STATIC_DRAW), info1->usage());
75 EXPECT_FALSE(info1->IsDeleted()); 75 EXPECT_FALSE(info1->IsDeleted());
76 EXPECT_FALSE(info1->IsClientSideArray());
76 EXPECT_EQ(kServiceBuffer1Id, info1->service_id()); 77 EXPECT_EQ(kServiceBuffer1Id, info1->service_id());
77 GLuint client_id = 0; 78 GLuint client_id = 0;
78 EXPECT_TRUE(manager_->GetClientId(info1->service_id(), &client_id)); 79 EXPECT_TRUE(manager_->GetClientId(info1->service_id(), &client_id));
79 EXPECT_EQ(kClientBuffer1Id, client_id); 80 EXPECT_EQ(kClientBuffer1Id, client_id);
80 manager_->SetTarget(info1, GL_ELEMENT_ARRAY_BUFFER); 81 manager_->SetTarget(info1, GL_ELEMENT_ARRAY_BUFFER);
81 EXPECT_EQ(static_cast<GLenum>(GL_ELEMENT_ARRAY_BUFFER), GetTarget(info1)); 82 EXPECT_EQ(static_cast<GLenum>(GL_ELEMENT_ARRAY_BUFFER), GetTarget(info1));
82 // Check we and set its size. 83 // Check we and set its size.
83 manager_->SetInfo(info1, kBuffer1Size, GL_DYNAMIC_DRAW); 84 manager_->SetInfo(info1, kBuffer1Size, GL_DYNAMIC_DRAW);
84 EXPECT_EQ(kBuffer1Size, info1->size()); 85 EXPECT_EQ(kBuffer1Size, info1->size());
85 EXPECT_EQ(static_cast<GLenum>(GL_DYNAMIC_DRAW), info1->usage()); 86 EXPECT_EQ(static_cast<GLenum>(GL_DYNAMIC_DRAW), info1->usage());
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 manager_->RemoveBuffer(kClientBufferId); 292 manager_->RemoveBuffer(kClientBufferId);
292 // Use it after removing 293 // Use it after removing
293 manager_->SetInfo(info, sizeof(data), GL_STATIC_DRAW); 294 manager_->SetInfo(info, sizeof(data), GL_STATIC_DRAW);
294 // Check that it gets deleted when the last reference is released. 295 // Check that it gets deleted when the last reference is released.
295 EXPECT_CALL(*gl_, DeleteBuffersARB(1, ::testing::Pointee(kServiceBufferId))) 296 EXPECT_CALL(*gl_, DeleteBuffersARB(1, ::testing::Pointee(kServiceBufferId)))
296 .Times(1) 297 .Times(1)
297 .RetiresOnSaturation(); 298 .RetiresOnSaturation();
298 info = NULL; 299 info = NULL;
299 } 300 }
300 301
302 // TODO(gman): Test buffers get shadowed when they are supposed to
303 // TODO(gman): Test they get release if usage changes.
304 // TODO(gman): Test is_client_side_array gets set/unset
305
301 } // namespace gles2 306 } // namespace gles2
302 } // namespace gpu 307 } // namespace gpu
303 308
304 309
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/buffer_manager.cc ('k') | gpu/command_buffer/service/context_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698