X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Fdali-test-suite-utils%2Ftest-graphics-controller.cpp;h=319ec6751d87d0ae4434d1710e57b559bd8e3bd9;hb=c0331129f93aa7504464fd95ae916a8389af33af;hp=e5db6ed8937637331d60224c254660f4fbb3200d;hpb=5cbf81cd770dcf0d317c7398daac2693a685cf65;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-controller.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-controller.cpp index e5db6ed..319ec67 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-controller.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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 @@ -31,6 +32,8 @@ #include #include +#include + namespace Dali { std::ostream& operator<<(std::ostream& o, const Graphics::BufferCreateInfo& bufferCreateInfo) @@ -77,7 +80,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 +381,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 +586,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 +675,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 +695,49 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com BindPipeline(currentPipeline); break; } + case CommandType::DRAW_NATIVE: + { + auto info = &cmd.data.draw.drawNative.drawNativeInfo; + + if(info->glesNativeInfo.eglSharedContextStoragePointer) + { + auto* anyContext = reinterpret_cast(info->glesNativeInfo.eglSharedContextStoragePointer); + *anyContext = reinterpret_cast(0x12345678u); + } + + 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 +938,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 +963,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 +1043,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); } /** @@ -1105,7 +1214,7 @@ Graphics::UniquePtr TestGraphicsController::CreateProgram(con source.resize(graphicsShader->mCreateInfo.sourceSize); memcpy(&source[0], graphicsShader->mCreateInfo.sourceData, graphicsShader->mCreateInfo.sourceSize); - if(!std::equal(source.begin(), source.end(), cacheEntry.shaders[shader.pipelineStage].begin())) + if(!std::equal(source.begin(), source.end(), cacheEntry.shaders[shader.pipelineStage].begin(), cacheEntry.shaders[shader.pipelineStage].end())) { found = false; break; @@ -1145,10 +1254,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", ""); @@ -1182,7 +1302,7 @@ Graphics::MemoryRequirements TestGraphicsController::GetBufferMemoryRequirements return Graphics::MemoryRequirements{}; } -const Graphics::TextureProperties& TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture) +Graphics::TextureProperties TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture) { static Graphics::TextureProperties textureProperties{}; mCallStack.PushCall("GetTextureProperties", "");