| 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" | |
| 11 #include "gpu/command_buffer/service/sync_point_manager.h" | 10 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 12 #include "gpu/command_buffer/tests/gl_manager.h" | 11 #include "gpu/command_buffer/tests/gl_manager.h" |
| 13 #include "gpu/command_buffer/tests/gl_test_utils.h" | 12 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 #define SHADER(Src) #Src | 16 #define SHADER(Src) #Src |
| 18 | 17 |
| 19 namespace gpu { | 18 namespace gpu { |
| 20 | 19 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 38 | 37 |
| 39 scoped_ptr<SyncPointManager> sync_point_manager_; | 38 scoped_ptr<SyncPointManager> sync_point_manager_; |
| 40 GLManager gl1_; | 39 GLManager gl1_; |
| 41 GLManager gl2_; | 40 GLManager gl2_; |
| 42 }; | 41 }; |
| 43 | 42 |
| 44 TEST_F(GLFenceSyncTest, SimpleReleaseWait) { | 43 TEST_F(GLFenceSyncTest, SimpleReleaseWait) { |
| 45 gl1_.MakeCurrent(); | 44 gl1_.MakeCurrent(); |
| 46 | 45 |
| 47 const GLuint64 fence_sync = glInsertFenceSyncCHROMIUM(); | 46 const GLuint64 fence_sync = glInsertFenceSyncCHROMIUM(); |
| 48 SyncToken sync_token; | 47 GLbyte sync_token[GL_SYNC_TOKEN_SIZE_CHROMIUM]; |
| 49 glFlush(); | 48 glFlush(); |
| 50 glGenSyncTokenCHROMIUM(fence_sync, sync_token.data); | 49 glGenSyncTokenCHROMIUM(fence_sync, sync_token); |
| 51 ASSERT_TRUE(GL_NO_ERROR == glGetError()); | 50 ASSERT_TRUE(GL_NO_ERROR == glGetError()); |
| 52 | 51 |
| 53 // Make sure it is actually released. | 52 // Make sure it is actually released. |
| 54 scoped_refptr<SyncPointClientState> gl1_client_state = | 53 scoped_refptr<SyncPointClientState> gl1_client_state = |
| 55 sync_point_manager_->GetSyncPointClientState(gl1_.GetNamespaceID(), | 54 sync_point_manager_->GetSyncPointClientState(gl1_.GetNamespaceID(), |
| 56 gl1_.GetCommandBufferID()); | 55 gl1_.GetCommandBufferID()); |
| 57 EXPECT_TRUE(gl1_client_state->IsFenceSyncReleased(fence_sync)); | 56 EXPECT_TRUE(gl1_client_state->IsFenceSyncReleased(fence_sync)); |
| 58 | 57 |
| 59 gl2_.MakeCurrent(); | 58 gl2_.MakeCurrent(); |
| 60 glWaitSyncTokenCHROMIUM(sync_token.data); | 59 glWaitSyncTokenCHROMIUM(sync_token); |
| 61 glFinish(); | 60 glFinish(); |
| 62 | 61 |
| 63 // gl2 should not have released anything. | 62 // gl2 should not have released anything. |
| 64 scoped_refptr<SyncPointClientState> gl2_client_state = | 63 scoped_refptr<SyncPointClientState> gl2_client_state = |
| 65 sync_point_manager_->GetSyncPointClientState(gl2_.GetNamespaceID(), | 64 sync_point_manager_->GetSyncPointClientState(gl2_.GetNamespaceID(), |
| 66 gl2_.GetCommandBufferID()); | 65 gl2_.GetCommandBufferID()); |
| 67 EXPECT_EQ(0u, gl2_client_state->fence_sync_release()); | 66 EXPECT_EQ(0u, gl2_client_state->fence_sync_release()); |
| 68 } | 67 } |
| 69 | 68 |
| 70 } // namespace gpu | 69 } // namespace gpu |
| OLD | NEW |