| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Tests for the Command Buffer Helper. | 5 // Tests for the Command Buffer Helper. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 #include "gpu/command_buffer/common/command_buffer.h" | 8 #include "gpu/command_buffer/common/command_buffer.h" |
| 9 #include "gpu/GLES2/gles2_command_buffer.h" | 9 #include "gpu/GLES2/gles2_command_buffer.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 virtual Buffer GetRingBuffer() { | 41 virtual Buffer GetRingBuffer() { |
| 42 return ring_buffer_buffer_; | 42 return ring_buffer_buffer_; |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual State GetState() { | 45 virtual State GetState() { |
| 46 return state_; | 46 return state_; |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual State GetLastState() { | |
| 50 return state_; | |
| 51 } | |
| 52 | |
| 53 virtual void Flush(int32 put_offset) { | 49 virtual void Flush(int32 put_offset) { |
| 54 state_.put_offset = put_offset; | 50 state_.put_offset = put_offset; |
| 55 } | 51 } |
| 56 | 52 |
| 57 virtual State FlushSync(int32 put_offset, int32 last_known_get) { | 53 virtual State FlushSync(int32 put_offset, int32 last_known_get) { |
| 58 state_.put_offset = put_offset; | 54 state_.put_offset = put_offset; |
| 59 state_.get_offset = put_offset; | 55 state_.get_offset = put_offset; |
| 60 OnFlush(transfer_buffer_buffer_.ptr); | 56 OnFlush(transfer_buffer_buffer_.ptr); |
| 61 | 57 |
| 62 return state_; | 58 return state_; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 GetNextToken(); // eat the token that starting up will use. | 251 GetNextToken(); // eat the token that starting up will use. |
| 256 | 252 |
| 257 gl_.reset(new GLES2Implementation( | 253 gl_.reset(new GLES2Implementation( |
| 258 helper_.get(), | 254 helper_.get(), |
| 259 kTransferBufferSize, | 255 kTransferBufferSize, |
| 260 transfer_buffer_.ptr, | 256 transfer_buffer_.ptr, |
| 261 kTransferBufferId, | 257 kTransferBufferId, |
| 262 false)); | 258 false)); |
| 263 | 259 |
| 264 EXPECT_CALL(*command_buffer_, OnFlush(_)).Times(1).RetiresOnSaturation(); | 260 EXPECT_CALL(*command_buffer_, OnFlush(_)).Times(1).RetiresOnSaturation(); |
| 265 helper_->CommandBufferHelper::Finish(); | 261 helper_->CommandBufferHelper::FlushSync(); |
| 266 Buffer ring_buffer = command_buffer_->GetRingBuffer(); | 262 Buffer ring_buffer = command_buffer_->GetRingBuffer(); |
| 267 commands_ = static_cast<CommandBufferEntry*>(ring_buffer.ptr) + | 263 commands_ = static_cast<CommandBufferEntry*>(ring_buffer.ptr) + |
| 268 command_buffer_->GetState().put_offset; | 264 command_buffer_->GetState().put_offset; |
| 269 ClearCommands(); | 265 ClearCommands(); |
| 270 } | 266 } |
| 271 | 267 |
| 272 virtual void TearDown() { | 268 virtual void TearDown() { |
| 273 } | 269 } |
| 274 | 270 |
| 275 void ClearCommands() { | 271 void ClearCommands() { |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 EXPECT_CALL(*command_buffer_, OnFlush(_)) | 1312 EXPECT_CALL(*command_buffer_, OnFlush(_)) |
| 1317 .WillOnce(SetMemory(GLuint(GL_NO_ERROR))) | 1313 .WillOnce(SetMemory(GLuint(GL_NO_ERROR))) |
| 1318 .RetiresOnSaturation(); | 1314 .RetiresOnSaturation(); |
| 1319 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError()); | 1315 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError()); |
| 1320 } | 1316 } |
| 1321 | 1317 |
| 1322 } // namespace gles2 | 1318 } // namespace gles2 |
| 1323 } // namespace gpu | 1319 } // namespace gpu |
| 1324 | 1320 |
| 1325 | 1321 |
| OLD | NEW |