| 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 |
| 49 virtual void Flush(int32 put_offset) { | 53 virtual void Flush(int32 put_offset) { |
| 50 state_.put_offset = put_offset; | 54 state_.put_offset = put_offset; |
| 51 } | 55 } |
| 52 | 56 |
| 53 virtual State FlushSync(int32 put_offset, int32 last_known_get) { | 57 virtual State FlushSync(int32 put_offset, int32 last_known_get) { |
| 54 state_.put_offset = put_offset; | 58 state_.put_offset = put_offset; |
| 55 state_.get_offset = put_offset; | 59 state_.get_offset = put_offset; |
| 56 OnFlush(transfer_buffer_buffer_.ptr); | 60 OnFlush(transfer_buffer_buffer_.ptr); |
| 57 | 61 |
| 58 return state_; | 62 return state_; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 GetNextToken(); // eat the token that starting up will use. | 255 GetNextToken(); // eat the token that starting up will use. |
| 252 | 256 |
| 253 gl_.reset(new GLES2Implementation( | 257 gl_.reset(new GLES2Implementation( |
| 254 helper_.get(), | 258 helper_.get(), |
| 255 kTransferBufferSize, | 259 kTransferBufferSize, |
| 256 transfer_buffer_.ptr, | 260 transfer_buffer_.ptr, |
| 257 kTransferBufferId, | 261 kTransferBufferId, |
| 258 false)); | 262 false)); |
| 259 | 263 |
| 260 EXPECT_CALL(*command_buffer_, OnFlush(_)).Times(1).RetiresOnSaturation(); | 264 EXPECT_CALL(*command_buffer_, OnFlush(_)).Times(1).RetiresOnSaturation(); |
| 261 helper_->CommandBufferHelper::FlushSync(); | 265 helper_->CommandBufferHelper::Finish(); |
| 262 Buffer ring_buffer = command_buffer_->GetRingBuffer(); | 266 Buffer ring_buffer = command_buffer_->GetRingBuffer(); |
| 263 commands_ = static_cast<CommandBufferEntry*>(ring_buffer.ptr) + | 267 commands_ = static_cast<CommandBufferEntry*>(ring_buffer.ptr) + |
| 264 command_buffer_->GetState().put_offset; | 268 command_buffer_->GetState().put_offset; |
| 265 ClearCommands(); | 269 ClearCommands(); |
| 266 } | 270 } |
| 267 | 271 |
| 268 virtual void TearDown() { | 272 virtual void TearDown() { |
| 269 } | 273 } |
| 270 | 274 |
| 271 void ClearCommands() { | 275 void ClearCommands() { |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 EXPECT_CALL(*command_buffer_, OnFlush(_)) | 1316 EXPECT_CALL(*command_buffer_, OnFlush(_)) |
| 1313 .WillOnce(SetMemory(GLuint(GL_NO_ERROR))) | 1317 .WillOnce(SetMemory(GLuint(GL_NO_ERROR))) |
| 1314 .RetiresOnSaturation(); | 1318 .RetiresOnSaturation(); |
| 1315 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError()); | 1319 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError()); |
| 1316 } | 1320 } |
| 1317 | 1321 |
| 1318 } // namespace gles2 | 1322 } // namespace gles2 |
| 1319 } // namespace gpu | 1323 } // namespace gpu |
| 1320 | 1324 |
| 1321 | 1325 |
| OLD | NEW |