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=e34b8527f907a441f850c8d08c5f2f44774a9492;hb=refs%2Fchanges%2F50%2F257250%2F1;hp=a0dee4ab2e86ed3b207100e5ff6e9044942ecc04;hpb=6097ddb9d7420625872d371cd5f44939d5240be8;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 a0dee4a..e34b852 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 @@ -24,134 +24,76 @@ TestGraphicsCommandBuffer::TestGraphicsCommandBuffer(TraceCallStack& callstack, { } -void TestGraphicsCommandBuffer::BindVertexBuffers(uint32_t firstBinding, - std::vector buffers, - std::vector offsets) +int TestGraphicsCommandBuffer::GetDrawCallsCount() { - mVertexBufferBindings.firstBinding = firstBinding; - mVertexBufferBindings.buffers = buffers; // Copy - mVertexBufferBindings.offsets = offsets; // Copy - mCallStack.PushCall("BindVertexBuffers", ""); -} - -void TestGraphicsCommandBuffer::BindUniformBuffers(const std::vector& bindings) -{ - mCallStack.PushCall("BindUniformBuffers", ""); -} - -void TestGraphicsCommandBuffer::BindPipeline(const Graphics::Pipeline& pipeline) -{ - mPipeline = static_cast(const_cast(&pipeline)); - mCallStack.PushCall("BindPipeline", ""); -} - -void TestGraphicsCommandBuffer::BindTextures(std::vector& textureBindings) -{ - mCallStack.PushCall("BindTextures", ""); - for(auto& binding : textureBindings) + int count = 0; + for(auto& cmd : mCommands) { - mTextureBindings.push_back(binding); + if(cmd.type == CommandType::DRAW || + cmd.type == CommandType::DRAW_INDEXED || + cmd.type == CommandType::DRAW_INDEXED_INDIRECT) + { + ++count; + } } + return count; } -void TestGraphicsCommandBuffer::BindSamplers(std::vector& samplerBindings) -{ - mCallStack.PushCall("BindSamplers", ""); -} - -void TestGraphicsCommandBuffer::BindPushConstants(void* data, - uint32_t size, - uint32_t binding) +void TestGraphicsCommandBuffer::GetStateForDrawCall(int drawCallIndex) { - mCallStack.PushCall("BindPushConstants", ""); -} - -void TestGraphicsCommandBuffer::BindIndexBuffer(const Graphics::Buffer& buffer, - uint32_t offset, - Graphics::Format format) -{ - mIndexBufferBinding.buffer = &buffer; - mIndexBufferBinding.offset = offset; - mIndexBufferBinding.format = format; - mCallStack.PushCall("BindIndexBuffer", ""); -} - -void TestGraphicsCommandBuffer::BeginRenderPass( - Graphics::RenderPass& renderPass, - Graphics::RenderTarget& renderTarget, - Graphics::Extent2D renderArea, - std::vector clearValues) -{ - mCallStack.PushCall("BeginRenderPass", ""); -} - -void TestGraphicsCommandBuffer::EndRenderPass() -{ - mCallStack.PushCall("EndRenderPass", ""); -} - -void TestGraphicsCommandBuffer::Draw( - uint32_t vertexCount, - uint32_t instanceCount, - uint32_t firstVertex, - uint32_t firstInstance) -{ - drawCommand.drawType = Draw::DrawType::Unindexed; - drawCommand.u.unindexedDraw.vertexCount = vertexCount; - drawCommand.u.unindexedDraw.instanceCount = instanceCount; - drawCommand.u.unindexedDraw.firstVertex = firstVertex; - drawCommand.u.unindexedDraw.firstInstance = firstInstance; - mCallStack.PushCall("Draw", ""); -} - -void TestGraphicsCommandBuffer::DrawIndexed( - uint32_t indexCount, - uint32_t instanceCount, - uint32_t firstIndex, - int32_t vertexOffset, - uint32_t firstInstance) -{ - drawCommand.drawType = TestGraphicsCommandBuffer::Draw::DrawType::Indexed; - drawCommand.u.indexedDraw.indexCount = indexCount; - drawCommand.u.indexedDraw.instanceCount = instanceCount; - drawCommand.u.indexedDraw.firstIndex = firstIndex; - drawCommand.u.indexedDraw.vertexOffset = vertexOffset; - drawCommand.u.indexedDraw.firstInstance = firstInstance; - mCallStack.PushCall("DrawIndexed", ""); -} - -void TestGraphicsCommandBuffer::DrawIndexedIndirect( - Graphics::Buffer& buffer, - uint32_t offset, - uint32_t drawCount, - uint32_t stride) -{ - mCallStack.PushCall("DrawIndexedIndirect", ""); -} - -void TestGraphicsCommandBuffer::Reset(Graphics::CommandBuffer& commandBuffer) -{ - mCallStack.PushCall("Reset", ""); -} - -void TestGraphicsCommandBuffer::SetScissor(Graphics::Extent2D value) -{ - mCallStack.PushCall("SetScissor", ""); -} - -void TestGraphicsCommandBuffer::SetScissorTestEnable(bool value) -{ - mCallStack.PushCall("SetScissorTestEnable", ""); + int index = 0; + std::vector mCommandStack{}; + 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(index == drawCallIndex) + { + break; + } + mCommandStack.clear(); + ++index; + } + } } -void TestGraphicsCommandBuffer::SetViewport(Graphics::Viewport value) +std::vector TestGraphicsCommandBuffer::GetCommandsByType(CommandTypeMask mask) const { - mCallStack.PushCall("SetViewport", ""); + std::vector mCommandStack{}; + for(auto& cmd : mCommands) + { + if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type))) + { + mCommandStack.emplace_back(&cmd); + } + } + return mCommandStack; } -void TestGraphicsCommandBuffer::SetViewportEnable(bool value) +std::vector TestGraphicsCommandBuffer::GetChildCommandsByType(CommandTypeMask mask) const { - mCallStack.PushCall("SetViewportEnable", ""); + std::vector mCommandStack{}; + for(auto& cmd : mCommands) + { + if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type))) + { + mCommandStack.emplace_back(&cmd); + } + if(cmd.type == CommandType::EXECUTE_COMMAND_BUFFERS) + { + for(auto secondaryCB : cmd.data.executeCommandBuffers.buffers) + { + for(auto command : secondaryCB->GetChildCommandsByType(mask)) + { + mCommandStack.push_back(command); + } + } + } + } + return mCommandStack; } } // namespace Dali