OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
7 | 7 |
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
10 #include "gpu/command_buffer/service/buffer_manager.h" | 10 #include "gpu/command_buffer/service/buffer_manager.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void ClearSharedMemory() { | 68 void ClearSharedMemory() { |
69 engine_->ClearSharedMemory(); | 69 engine_->ClearSharedMemory(); |
70 } | 70 } |
71 | 71 |
72 virtual void SetUp() OVERRIDE; | 72 virtual void SetUp() OVERRIDE; |
73 virtual void TearDown() OVERRIDE; | 73 virtual void TearDown() OVERRIDE; |
74 | 74 |
75 template <typename T> | 75 template <typename T> |
76 error::Error ExecuteCmd(const T& cmd) { | 76 error::Error ExecuteCmd(const T& cmd) { |
77 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); | 77 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); |
78 return decoder_->DoCommand(cmd.kCmdId, | 78 return decoder_->DoCommands( |
79 ComputeNumEntries(sizeof(cmd)) - 1, | 79 1, (const void*)&cmd, ComputeNumEntries(sizeof(cmd)), 0); |
80 &cmd); | |
81 } | 80 } |
82 | 81 |
83 template <typename T> | 82 template <typename T> |
84 error::Error ExecuteImmediateCmd(const T& cmd, size_t data_size) { | 83 error::Error ExecuteImmediateCmd(const T& cmd, size_t data_size) { |
85 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); | 84 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); |
86 return decoder_->DoCommand(cmd.kCmdId, | 85 return decoder_->DoCommands( |
87 ComputeNumEntries(sizeof(cmd) + data_size) - 1, | 86 1, (const void*)&cmd, ComputeNumEntries(sizeof(cmd) + data_size), 0); |
88 &cmd); | |
89 } | 87 } |
90 | 88 |
91 template <typename T> | 89 template <typename T> |
92 T GetSharedMemoryAs() { | 90 T GetSharedMemoryAs() { |
93 return reinterpret_cast<T>(shared_memory_address_); | 91 return reinterpret_cast<T>(shared_memory_address_); |
94 } | 92 } |
95 | 93 |
96 template <typename T> | 94 template <typename T> |
97 T GetSharedMemoryAsWithOffset(uint32 offset) { | 95 T GetSharedMemoryAsWithOffset(uint32 offset) { |
98 void* ptr = reinterpret_cast<int8*>(shared_memory_address_) + offset; | 96 void* ptr = reinterpret_cast<int8*>(shared_memory_address_) + offset; |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 }; | 638 }; |
641 | 639 |
642 // SpecializedSetup specializations that are needed in multiple unittest files. | 640 // SpecializedSetup specializations that are needed in multiple unittest files. |
643 template <> | 641 template <> |
644 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid); | 642 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid); |
645 | 643 |
646 } // namespace gles2 | 644 } // namespace gles2 |
647 } // namespace gpu | 645 } // namespace gpu |
648 | 646 |
649 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 647 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
OLD | NEW |