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

Side by Side Diff: gpu/command_buffer/tests/gl_fence_sync_unittest.cc

Issue 1394543003: Added SyncToken command buffer trait to help with IPC messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h> 6 #include <GLES2/gl2ext.h>
7 #include <GLES2/gl2extchromium.h> 7 #include <GLES2/gl2extchromium.h>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "gpu/command_buffer/common/sync_token.h"
10 #include "gpu/command_buffer/service/sync_point_manager.h" 11 #include "gpu/command_buffer/service/sync_point_manager.h"
11 #include "gpu/command_buffer/tests/gl_manager.h" 12 #include "gpu/command_buffer/tests/gl_manager.h"
12 #include "gpu/command_buffer/tests/gl_test_utils.h" 13 #include "gpu/command_buffer/tests/gl_test_utils.h"
13 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 #define SHADER(Src) #Src 17 #define SHADER(Src) #Src
17 18
18 namespace gpu { 19 namespace gpu {
19 20
(...skipping 17 matching lines...) Expand all
37 38
38 scoped_ptr<SyncPointManager> sync_point_manager_; 39 scoped_ptr<SyncPointManager> sync_point_manager_;
39 GLManager gl1_; 40 GLManager gl1_;
40 GLManager gl2_; 41 GLManager gl2_;
41 }; 42 };
42 43
43 TEST_F(GLFenceSyncTest, SimpleReleaseWait) { 44 TEST_F(GLFenceSyncTest, SimpleReleaseWait) {
44 gl1_.MakeCurrent(); 45 gl1_.MakeCurrent();
45 46
46 const GLuint64 fence_sync = glInsertFenceSyncCHROMIUM(); 47 const GLuint64 fence_sync = glInsertFenceSyncCHROMIUM();
47 GLbyte sync_token[GL_SYNC_TOKEN_SIZE_CHROMIUM]; 48 SyncToken sync_token;
48 glFlush(); 49 glFlush();
49 glGenSyncTokenCHROMIUM(fence_sync, sync_token); 50 glGenSyncTokenCHROMIUM(fence_sync, sync_token.data);
50 ASSERT_TRUE(GL_NO_ERROR == glGetError()); 51 ASSERT_TRUE(GL_NO_ERROR == glGetError());
51 52
52 // Make sure it is actually released. 53 // Make sure it is actually released.
53 scoped_refptr<SyncPointClientState> gl1_client_state = 54 scoped_refptr<SyncPointClientState> gl1_client_state =
54 sync_point_manager_->GetSyncPointClientState(gl1_.GetNamespaceID(), 55 sync_point_manager_->GetSyncPointClientState(gl1_.GetNamespaceID(),
55 gl1_.GetCommandBufferID()); 56 gl1_.GetCommandBufferID());
56 EXPECT_TRUE(gl1_client_state->IsFenceSyncReleased(fence_sync)); 57 EXPECT_TRUE(gl1_client_state->IsFenceSyncReleased(fence_sync));
57 58
58 gl2_.MakeCurrent(); 59 gl2_.MakeCurrent();
59 glWaitSyncTokenCHROMIUM(sync_token); 60 glWaitSyncTokenCHROMIUM(sync_token.data);
60 glFinish(); 61 glFinish();
61 62
62 // gl2 should not have released anything. 63 // gl2 should not have released anything.
63 scoped_refptr<SyncPointClientState> gl2_client_state = 64 scoped_refptr<SyncPointClientState> gl2_client_state =
64 sync_point_manager_->GetSyncPointClientState(gl2_.GetNamespaceID(), 65 sync_point_manager_->GetSyncPointClientState(gl2_.GetNamespaceID(),
65 gl2_.GetCommandBufferID()); 66 gl2_.GetCommandBufferID());
66 EXPECT_EQ(0u, gl2_client_state->fence_sync_release()); 67 EXPECT_EQ(0u, gl2_client_state->fence_sync_release());
67 } 68 }
68 69
69 } // namespace gpu 70 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698