X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-graphics-command-buffer.cpp;h=9f86b991c21c89d7aea90f3de70cee973d171669;hb=6a219d0bbcfd016e24b5466d5fb1a666c92feae5;hp=70f3f0eb8827f900827a119aec0b2e2bd085e097;hpb=100f0f8554f97295dd52e01a91ef2b868eba3554;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp index 70f3f0e..9f86b99 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp @@ -18,6 +18,70 @@ namespace Dali { +std::ostream& operator<<(std::ostream& os, Graphics::StencilOp op) +{ + switch(op) + { + case Graphics::StencilOp::KEEP: + os << "KEEP"; + return os; + case Graphics::StencilOp::ZERO: + os << "ZERO"; + return os; + case Graphics::StencilOp::REPLACE: + os << "REPLACE"; + return os; + case Graphics::StencilOp::INCREMENT_AND_CLAMP: + os << "INCREMENT_AND_CLAMP"; + return os; + case Graphics::StencilOp::DECREMENT_AND_CLAMP: + os << "DECREMENT_AND_CLAMP"; + return os; + case Graphics::StencilOp::INVERT: + os << "INVERT"; + return os; + case Graphics::StencilOp::INCREMENT_AND_WRAP: + os << "INCREMENT_AND_WRAP"; + return os; + case Graphics::StencilOp::DECREMENT_AND_WRAP: + os << "DECREMENT_AND_WRAP"; + return os; + } + return os; +}; + +std::ostream& operator<<(std::ostream& os, Graphics::CompareOp op) +{ + switch(op) + { + case Graphics::CompareOp::NEVER: + os << "NEVER"; + return os; + case Graphics::CompareOp::LESS: + os << "LESS"; + return os; + case Graphics::CompareOp::EQUAL: + os << "EQUAL"; + return os; + case Graphics::CompareOp::LESS_OR_EQUAL: + os << "LESS_OR_EQUAL"; + return os; + case Graphics::CompareOp::GREATER: + os << "GREATER"; + return os; + case Graphics::CompareOp::NOT_EQUAL: + os << "NOT_EQUAL"; + return os; + case Graphics::CompareOp::GREATER_OR_EQUAL: + os << "GREATER_OR_EQUAL"; + return os; + case Graphics::CompareOp::ALWAYS: + os << "ALWAYS"; + return os; + } + return os; +}; + TestGraphicsCommandBuffer::TestGraphicsCommandBuffer(TraceCallStack& callstack, TestGlAbstraction& glAbstraction) : mCallStack(callstack), mGlAbstraction(glAbstraction) @@ -27,11 +91,11 @@ TestGraphicsCommandBuffer::TestGraphicsCommandBuffer(TraceCallStack& callstack, int TestGraphicsCommandBuffer::GetDrawCallsCount() { int count = 0; - for( auto& cmd : mCommands ) + for(auto& cmd : mCommands) { - if( cmd.type == CommandType::DRAW || - cmd.type == CommandType::DRAW_INDEXED || - cmd.type == CommandType::DRAW_INDEXED_INDIRECT ) + if(cmd.type == CommandType::DRAW || + cmd.type == CommandType::DRAW_INDEXED || + cmd.type == CommandType::DRAW_INDEXED_INDIRECT) { ++count; } @@ -39,18 +103,18 @@ int TestGraphicsCommandBuffer::GetDrawCallsCount() return count; } -void TestGraphicsCommandBuffer::GetStateForDrawCall( int drawCallIndex ) +void TestGraphicsCommandBuffer::GetStateForDrawCall(int drawCallIndex) { - int index = 0; + int index = 0; std::vector mCommandStack{}; - for( auto& cmd : mCommands ) + for(auto& cmd : mCommands) { mCommandStack.push_back(cmd); - if( cmd.type == CommandType::DRAW || - cmd.type == CommandType::DRAW_INDEXED || - cmd.type == CommandType::DRAW_INDEXED_INDIRECT ) + if(cmd.type == CommandType::DRAW || + cmd.type == CommandType::DRAW_INDEXED || + cmd.type == CommandType::DRAW_INDEXED_INDIRECT) { - if( index == drawCallIndex ) + if(index == drawCallIndex) { break; } @@ -60,14 +124,37 @@ void TestGraphicsCommandBuffer::GetStateForDrawCall( int drawCallIndex ) } } -std::vector TestGraphicsCommandBuffer::GetCommandsByType( CommandTypeMask mask ) +std::vector TestGraphicsCommandBuffer::GetCommandsByType(CommandTypeMask mask) const +{ + std::vector mCommandStack{}; + for(auto& cmd : mCommands) + { + if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type))) + { + mCommandStack.emplace_back(&cmd); + } + } + return mCommandStack; +} + +std::vector TestGraphicsCommandBuffer::GetChildCommandsByType(CommandTypeMask mask) const { - std::vector mCommandStack{}; - for( auto& cmd : mCommands ) + std::vector mCommandStack{}; + for(auto& cmd : mCommands) { - if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type)) ) + if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type))) + { + mCommandStack.emplace_back(&cmd); + } + if(cmd.type == CommandType::EXECUTE_COMMAND_BUFFERS) { - mCommandStack.emplace_back( &cmd ); + for(auto secondaryCB : cmd.data.executeCommandBuffers.buffers) + { + for(auto command : secondaryCB->GetChildCommandsByType(mask)) + { + mCommandStack.push_back(command); + } + } } } return mCommandStack;