X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-graphics-controller.cpp;h=6a8eab43dca4a2fbdaeb0c514c6825f48bc42ab4;hb=abc8459e18c5a7f8730c9493885fd067126520cb;hp=e5db6ed8937637331d60224c254660f4fbb3200d;hpb=9161d9828d1a5bb3c7eaf83002863de84b23b751;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp index e5db6ed..6a8eab4 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ #include "test-graphics-render-target.h" #include "test-graphics-sampler.h" #include "test-graphics-shader.h" +#include "test-graphics-sync-object.h" #include "test-graphics-texture.h" #include @@ -77,7 +78,7 @@ std::ostream& operator<<(std::ostream& o, const Graphics::TextureCreateInfo& cre << " usageFlags:" << std::hex << createInfo.usageFlags << " data:" << std::hex << createInfo.data << " dataSize:" << std::dec << createInfo.dataSize - << " nativeImagePtr:" << std::hex << createInfo.nativeImagePtr; + << " nativeImagePtr:" << std::hex << createInfo.nativeImagePtr.Get(); return o; } @@ -378,8 +379,81 @@ GLenum GetBlendOp(Graphics::BlendOp blendOp) case Graphics::BlendOp::MAX: op = GL_MAX; break; - - // @todo Add advanced blend equations + case Graphics::BlendOp::MULTIPLY: + { + op = GL_MULTIPLY; + break; + } + case Graphics::BlendOp::SCREEN: + { + op = GL_SCREEN; + break; + } + case Graphics::BlendOp::OVERLAY: + { + op = GL_OVERLAY; + break; + } + case Graphics::BlendOp::DARKEN: + { + op = GL_DARKEN; + break; + } + case Graphics::BlendOp::LIGHTEN: + { + op = GL_LIGHTEN; + break; + } + case Graphics::BlendOp::COLOR_DODGE: + { + op = GL_COLORDODGE; + break; + } + case Graphics::BlendOp::COLOR_BURN: + { + op = GL_COLORBURN; + break; + } + case Graphics::BlendOp::HARD_LIGHT: + { + op = GL_HARDLIGHT; + break; + } + case Graphics::BlendOp::SOFT_LIGHT: + { + op = GL_SOFTLIGHT; + break; + } + case Graphics::BlendOp::DIFFERENCE: + { + op = GL_DIFFERENCE; + break; + } + case Graphics::BlendOp::EXCLUSION: + { + op = GL_EXCLUSION; + break; + } + case Graphics::BlendOp::HUE: + { + op = GL_HSL_HUE; + break; + } + case Graphics::BlendOp::SATURATION: + { + op = GL_HSL_SATURATION; + break; + } + case Graphics::BlendOp::COLOR: + { + op = GL_HSL_COLOR; + break; + } + case Graphics::BlendOp::LUMINOSITY: + { + op = GL_HSL_LUMINOSITY; + break; + } } return op; } @@ -510,15 +584,15 @@ public: }; TestGraphicsController::TestGraphicsController() -: mCallStack(true, "TestGraphicsController."), - mCommandBufferCallStack(true, "TestCommandBuffer."), - mFrameBufferCallStack(true, "TestFrameBuffer.") +: mCallStack(false, "TestGraphicsController."), + mCommandBufferCallStack(false, "TestCommandBuffer."), + mFrameBufferCallStack(false, "TestFrameBuffer.") { mCallStack.Enable(true); mCommandBufferCallStack.Enable(true); auto& trace = mGl.GetTextureTrace(); trace.Enable(true); - trace.EnableLogging(true); + trace.EnableLogging(false); } void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& submitInfo) @@ -599,11 +673,14 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com } case CommandType::BIND_UNIFORM_BUFFER: { - auto& bindings = cmd.data.bindUniformBuffers; - auto buffer = bindings.standaloneUniformsBufferBinding; + if(currentPipeline) + { + auto& bindings = cmd.data.bindUniformBuffers; + auto buffer = bindings.standaloneUniformsBufferBinding; - // based on reflection, issue gl calls - buffer.buffer->BindAsUniformBuffer(static_cast(currentPipeline->programState.program)); + // based on reflection, issue gl calls + buffer.buffer->BindAsUniformBuffer(static_cast(currentPipeline->programState.program), bindings.standaloneUniformsBufferBinding); + } break; } case CommandType::BIND_SAMPLERS: @@ -616,27 +693,42 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com BindPipeline(currentPipeline); break; } + case CommandType::DRAW_NATIVE: + { + auto info = &cmd.data.draw.drawNative.drawNativeInfo; + CallbackBase::ExecuteReturn(*info->callback, info->userData); + break; + } case CommandType::DRAW: { - mGl.DrawArrays(GetTopology(currentPipeline->inputAssemblyState.topology), - 0, - cmd.data.draw.draw.vertexCount); + if(currentPipeline) + { + mGl.DrawArrays(GetTopology(currentPipeline->inputAssemblyState.topology), + 0, + cmd.data.draw.draw.vertexCount); + } break; } case CommandType::DRAW_INDEXED: { - mGl.DrawElements(GetTopology(currentPipeline->inputAssemblyState.topology), - static_cast(cmd.data.draw.drawIndexed.indexCount), - GL_UNSIGNED_SHORT, - reinterpret_cast(cmd.data.draw.drawIndexed.firstIndex)); + if(currentPipeline) + { + mGl.DrawElements(GetTopology(currentPipeline->inputAssemblyState.topology), + static_cast(cmd.data.draw.drawIndexed.indexCount), + GL_UNSIGNED_SHORT, + reinterpret_cast(cmd.data.draw.drawIndexed.firstIndex)); + } break; } case CommandType::DRAW_INDEXED_INDIRECT: { - mGl.DrawElements(GetTopology(currentPipeline->inputAssemblyState.topology), - static_cast(cmd.data.draw.drawIndexed.indexCount), - GL_UNSIGNED_SHORT, - reinterpret_cast(cmd.data.draw.drawIndexed.firstIndex)); + if(currentPipeline) + { + mGl.DrawElements(GetTopology(currentPipeline->inputAssemblyState.topology), + static_cast(cmd.data.draw.drawIndexed.indexCount), + GL_UNSIGNED_SHORT, + reinterpret_cast(cmd.data.draw.drawIndexed.firstIndex)); + } break; } case CommandType::SET_SCISSOR: @@ -837,6 +929,7 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com const auto& area = cmd.data.beginRenderPass.renderArea; if(area.x == 0 && area.y == 0 && + renderTarget && area.width == renderTarget->mCreateInfo.extent.width && area.height == renderTarget->mCreateInfo.extent.height) { @@ -861,6 +954,11 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com } case CommandType::END_RENDER_PASS: { + if(cmd.data.endRenderPass.syncObject != nullptr) + { + auto syncObject = Uncast(cmd.data.endRenderPass.syncObject); + syncObject->InitializeResource(); // create the sync object. + } break; } } @@ -936,9 +1034,11 @@ void TestGraphicsController::BindPipeline(TestGraphicsPipeline* pipeline) */ void TestGraphicsController::PresentRenderTarget(Graphics::RenderTarget* renderTarget) { + auto* rt = static_cast(renderTarget); TraceCallStack::NamedParams namedParams; namedParams["renderTarget"] << std::hex << renderTarget; - mCallStack.PushCall("PresentRenderTarget", "", namedParams); + namedParams["surface"] << std::hex << rt->mCreateInfo.surface; + mCallStack.PushCall("PresentRenderTarget", namedParams.str(), namedParams); } /** @@ -1145,10 +1245,21 @@ Graphics::UniquePtr TestGraphicsController::CreateSampler(con Graphics::UniquePtr TestGraphicsController::CreateRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr&& oldRenderTarget) { - mCallStack.PushCall("CreateRenderTarget", ""); + TraceCallStack::NamedParams namedParams; + namedParams["surface"] << std::hex << renderTargetCreateInfo.surface; + mCallStack.PushCall("CreateRenderTarget", namedParams.str(), namedParams); + return Graphics::MakeUnique(mGl, renderTargetCreateInfo); } +Graphics::UniquePtr TestGraphicsController::CreateSyncObject( + const Graphics::SyncObjectCreateInfo& syncObjectCreateInfo, + Graphics::UniquePtr&& oldSyncObject) +{ + mCallStack.PushCall("CreateSyncObject", ""); + return Graphics::MakeUnique(mGraphicsSyncImpl, syncObjectCreateInfo); +} + Graphics::UniquePtr TestGraphicsController::MapBufferRange(const Graphics::MapBufferInfo& mapInfo) { mCallStack.PushCall("MapBufferRange", "");