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

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

Issue 1331843005: Implemented new fence syncs which replaces the old sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted mojo readme, changed wait() to take a pointer Created 5 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/sync_point_manager_unittest.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_fence_sync_unittest.cc
diff --git a/gpu/command_buffer/tests/gl_fence_sync_unittest.cc b/gpu/command_buffer/tests/gl_fence_sync_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ad21f345a870078e90dc59b20b75ba280883ee3c
--- /dev/null
+++ b/gpu/command_buffer/tests/gl_fence_sync_unittest.cc
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <GLES2/gl2extchromium.h>
+
+#include "base/memory/scoped_ptr.h"
+#include "gpu/command_buffer/service/sync_point_manager.h"
+#include "gpu/command_buffer/tests/gl_manager.h"
+#include "gpu/command_buffer/tests/gl_test_utils.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#define SHADER(Src) #Src
+
+namespace gpu {
+
+class GLFenceSyncTest : public testing::Test {
+ protected:
+ void SetUp() override {
+ sync_point_manager_.reset(new SyncPointManager(false));
+
+ GLManager::Options options;
+ options.sync_point_manager = sync_point_manager_.get();
+ gl1_.Initialize(options);
+ gl2_.Initialize(options);
+ }
+
+ void TearDown() override {
+ gl2_.Destroy();
+ gl1_.Destroy();
+
+ sync_point_manager_.reset();
+ }
+
+ scoped_ptr<SyncPointManager> sync_point_manager_;
+ GLManager gl1_;
+ GLManager gl2_;
+};
+
+TEST_F(GLFenceSyncTest, SimpleReleaseWait) {
+ gl1_.MakeCurrent();
+
+ const GLuint64 fence_sync = glInsertFenceSyncCHROMIUM();
+ GLbyte sync_token[GL_SYNC_TOKEN_SIZE_CHROMIUM];
+ glFlush();
+ glGenSyncTokenCHROMIUM(fence_sync, sync_token);
+ ASSERT_TRUE(GL_NO_ERROR == glGetError());
+
+ // Make sure it is actually released.
+ scoped_refptr<SyncPointClientState> gl1_client_state =
+ sync_point_manager_->GetSyncPointClientState(gl1_.GetNamespaceID(),
+ gl1_.GetCommandBufferID());
+ EXPECT_TRUE(gl1_client_state->IsFenceSyncReleased(fence_sync));
+
+ gl2_.MakeCurrent();
+ glWaitSyncTokenCHROMIUM(sync_token);
+ glFinish();
+
+ // gl2 should not have released anything.
+ scoped_refptr<SyncPointClientState> gl2_client_state =
+ sync_point_manager_->GetSyncPointClientState(gl2_.GetNamespaceID(),
+ gl2_.GetCommandBufferID());
+ EXPECT_EQ(0u, gl2_client_state->fence_sync_release());
+}
+
+} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/sync_point_manager_unittest.cc ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698