2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "test-graphics-command-buffer.h"
21 TestGraphicsCommandBuffer::TestGraphicsCommandBuffer(TraceCallStack& callstack, TestGlAbstraction& glAbstraction)
22 : mCallStack(callstack),
23 mGlAbstraction(glAbstraction)
27 int TestGraphicsCommandBuffer::GetDrawCallsCount()
30 for( auto& cmd : mCommands )
32 if( cmd.type == CommandType::DRAW ||
33 cmd.type == CommandType::DRAW_INDEXED ||
34 cmd.type == CommandType::DRAW_INDEXED_INDIRECT )
42 void TestGraphicsCommandBuffer::GetStateForDrawCall( int drawCallIndex )
45 std::vector<Command> mCommandStack{};
46 for( auto& cmd : mCommands )
48 mCommandStack.push_back(cmd);
49 if( cmd.type == CommandType::DRAW ||
50 cmd.type == CommandType::DRAW_INDEXED ||
51 cmd.type == CommandType::DRAW_INDEXED_INDIRECT )
53 if( index == drawCallIndex )
57 mCommandStack.clear();
63 std::vector<Command*> TestGraphicsCommandBuffer::GetCommandsByType( CommandTypeMask mask )
65 std::vector<Command*> mCommandStack{};
66 for( auto& cmd : mCommands )
68 if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type)) )
70 mCommandStack.emplace_back( &cmd );