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

Unified Diff: gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc

Issue 1949303003: Improve indexed gl state related GL commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tex
Patch Set: fix a DCHECK failure Created 4 years, 7 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/indexed_buffer_binding_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc
diff --git a/gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc b/gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc
index f411ae0cdf8ece34e3b8ba1f5eba0be317d053f8..bab99180a55ddd9f8236fb53e2c99a702124740e 100644
--- a/gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc
+++ b/gpu/command_buffer/service/indexed_buffer_binding_host_unittest.cc
@@ -113,6 +113,55 @@ TEST_F(IndexedBufferBindingHostTest, DoBindBufferRangeBufferWithoutEnoughSize) {
host_->OnBufferData(kTarget, buffer_.get());
}
+TEST_F(IndexedBufferBindingHostTest, RestoreBindings) {
+ const GLenum kTarget = GL_UNIFORM_BUFFER;
+ const GLuint kIndex = 2;
+ const GLuint kOtherIndex = 10;
+ const GLintptr kOffset = 4;
+ const GLsizeiptr kSize = 8;
+ const GLsizeiptr kBufferSize = kOffset + kSize - 2;
+
+ GLsizeiptr clamped_size = ((kBufferSize - kOffset) >> 2) << 2;
+
+ SetBufferSize(kTarget, kBufferSize);
+ // Set up host
+ EXPECT_CALL(*gl_, BindBufferBase(kTarget, kIndex, kBufferServiceId))
+ .Times(1)
+ .RetiresOnSaturation();
+ host_->DoBindBufferBase(kTarget, kIndex, buffer_.get());
+ // Set up the second host
+ scoped_refptr<IndexedBufferBindingHost> other =
+ new IndexedBufferBindingHost(kMaxBindings, true);
+ EXPECT_CALL(*gl_, BindBufferRange(kTarget, kOtherIndex, kBufferServiceId,
+ kOffset, clamped_size))
+ .Times(1)
+ .RetiresOnSaturation();
+ other->DoBindBufferRange(kTarget, kOtherIndex, buffer_.get(), kOffset, kSize);
+
+ {
+ // Switching from |other| to |host_|.
+ EXPECT_CALL(*gl_, BindBufferBase(kTarget, kIndex, kBufferServiceId))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, BindBufferBase(kTarget, kOtherIndex, 0))
+ .Times(1)
+ .RetiresOnSaturation();
+ host_->RestoreBindings(other.get());
+ }
+
+ {
+ // Switching from |host_| to |other|.
+ EXPECT_CALL(*gl_, BindBufferBase(kTarget, kIndex, 0))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, BindBufferRange(kTarget, kOtherIndex, kBufferServiceId,
+ kOffset, clamped_size))
+ .Times(1)
+ .RetiresOnSaturation();
+ other->RestoreBindings(host_.get());
+ }
+}
+
} // namespace gles2
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/indexed_buffer_binding_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698