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

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

Issue 8515023: Allow deleted resources to be used (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « gpu/command_buffer/service/vertex_attrib_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/vertex_attrib_manager.h" 5 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "gpu/command_buffer/common/gl_mock.h" 8 #include "gpu/command_buffer/common/gl_mock.h"
9 #include "gpu/command_buffer/service/feature_info.h" 9 #include "gpu/command_buffer/service/feature_info.h"
10 #include "gpu/command_buffer/service/test_helper.h" 10 #include "gpu/command_buffer/service/test_helper.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 EXPECT_FALSE(info->CanAccess(1)); 167 EXPECT_FALSE(info->CanAccess(1));
168 manager_.SetAttribInfo(1, buffer, 4, GL_FLOAT, GL_FALSE, 0, 16, 0); 168 manager_.SetAttribInfo(1, buffer, 4, GL_FLOAT, GL_FALSE, 0, 16, 0);
169 EXPECT_TRUE(info->CanAccess(1)); 169 EXPECT_TRUE(info->CanAccess(1));
170 manager_.SetAttribInfo(1, buffer, 4, GL_FLOAT, GL_FALSE, 0, 20, 0); 170 manager_.SetAttribInfo(1, buffer, 4, GL_FLOAT, GL_FALSE, 0, 20, 0);
171 EXPECT_TRUE(info->CanAccess(0)); 171 EXPECT_TRUE(info->CanAccess(0));
172 EXPECT_FALSE(info->CanAccess(1)); 172 EXPECT_FALSE(info->CanAccess(1));
173 173
174 buffer_manager.Destroy(false); 174 buffer_manager.Destroy(false);
175 } 175 }
176 176
177 TEST_F(VertexAttribManagerTest, Unbind) {
178 BufferManager buffer_manager;
179 buffer_manager.CreateBufferInfo(1, 2);
180 buffer_manager.CreateBufferInfo(3, 4);
181 BufferManager::BufferInfo* buffer1 = buffer_manager.GetBufferInfo(1);
182 BufferManager::BufferInfo* buffer2 = buffer_manager.GetBufferInfo(3);
183 ASSERT_TRUE(buffer1 != NULL);
184 ASSERT_TRUE(buffer2 != NULL);
185
186 VertexAttribManager::VertexAttribInfo* info1 =
187 manager_.GetVertexAttribInfo(1);
188 VertexAttribManager::VertexAttribInfo* info3 =
189 manager_.GetVertexAttribInfo(3);
190
191 // Attach to 2 buffers.
192 manager_.SetAttribInfo(1, buffer1, 3, GL_SHORT, GL_TRUE, 32, 32, 4);
193 manager_.SetAttribInfo(3, buffer1, 3, GL_SHORT, GL_TRUE, 32, 32, 4);
194 // Check they were attached.
195 EXPECT_EQ(buffer1, info1->buffer());
196 EXPECT_EQ(buffer1, info3->buffer());
197 // Unbind unattached buffer.
198 manager_.Unbind(buffer2);
199 // Should be no-op.
200 EXPECT_EQ(buffer1, info1->buffer());
201 EXPECT_EQ(buffer1, info3->buffer());
202 // Unbind buffer.
203 manager_.Unbind(buffer1);
204 // Check they were detached
205 EXPECT_TRUE(NULL == info1->buffer());
206 EXPECT_TRUE(NULL == info3->buffer());
207
208 buffer_manager.Destroy(false);
209 }
210
177 } // namespace gles2 211 } // namespace gles2
178 } // namespace gpu 212 } // namespace gpu
179 213
180 214
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/vertex_attrib_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698