| OLD | NEW |
| 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/common/sync_token.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 glWaitSyncTokenCHROMIUM(sync_token.GetConstData()); | 60 glWaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
| 61 glFinish(); | 61 glFinish(); |
| 62 | 62 |
| 63 // gl2 should not have released anything. | 63 // gl2 should not have released anything. |
| 64 scoped_refptr<SyncPointClientState> gl2_client_state = | 64 scoped_refptr<SyncPointClientState> gl2_client_state = |
| 65 sync_point_manager_->GetSyncPointClientState(gl2_.GetNamespaceID(), | 65 sync_point_manager_->GetSyncPointClientState(gl2_.GetNamespaceID(), |
| 66 gl2_.GetCommandBufferID()); | 66 gl2_.GetCommandBufferID()); |
| 67 EXPECT_EQ(0u, gl2_client_state->fence_sync_release()); | 67 EXPECT_EQ(0u, gl2_client_state->fence_sync_release()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 static void TestCallback(int* storage, int assign) { |
| 71 *storage = assign; |
| 72 } |
| 73 |
| 74 TEST_F(GLFenceSyncTest, SimpleReleaseSignal) { |
| 75 gl1_.MakeCurrent(); |
| 76 |
| 77 // Pause the command buffer so the fence sync does not immediately trigger. |
| 78 gl1_.SetCommandsPaused(true); |
| 79 |
| 80 const GLuint64 fence_sync = glInsertFenceSyncCHROMIUM(); |
| 81 SyncToken sync_token; |
| 82 glGenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 83 glFlush(); |
| 84 ASSERT_TRUE(sync_token.HasData()); |
| 85 |
| 86 gl2_.MakeCurrent(); |
| 87 int callback_called = 0; |
| 88 gl2_.SignalSyncToken(sync_token, |
| 89 base::Bind(TestCallback, &callback_called, 1)); |
| 90 |
| 91 gl1_.MakeCurrent(); |
| 92 EXPECT_EQ(0, callback_called); |
| 93 |
| 94 gl1_.SetCommandsPaused(false); |
| 95 glFinish(); |
| 96 |
| 97 EXPECT_EQ(1, callback_called); |
| 98 } |
| 99 |
| 70 } // namespace gpu | 100 } // namespace gpu |
| OLD | NEW |