X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-graphics-controller.cpp;h=f970525e448142d938c4ff1b4f57f5de3ecf5a0c;hp=e7f80cd2c7181a0ca1a09a4678b9e7312976fd61;hb=34acf01671928c22fe260fe8aa365ec2d0e05525;hpb=57818b285f2485c7acd86d92f642f726b4a2bcca 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 e7f80cd..f970525 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 @@ -16,18 +16,50 @@ #include "test-graphics-controller.h" -#include "dali-test-suite-utils.h" #include "test-graphics-buffer.h" #include "test-graphics-command-buffer.h" +#include "test-graphics-reflection.h" #include "test-graphics-sampler.h" +#include "test-graphics-shader.h" #include "test-graphics-texture.h" #include +#include #include #include namespace Dali { +template +T* Uncast(const Graphics::CommandBuffer* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Texture* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Sampler* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Buffer* object) +{ + return const_cast(static_cast(object)); +} + +template +T* Uncast(const Graphics::Shader* object) +{ + return const_cast(static_cast(object)); +} + std::ostream& operator<<(std::ostream& o, const Graphics::BufferCreateInfo& bufferCreateInfo) { return o << "usage:" << std::hex << bufferCreateInfo.usage << ", size:" << std::dec << bufferCreateInfo.size; @@ -161,7 +193,7 @@ public: if(offset > mMappedOffset + mMappedSize || size + offset > mMappedOffset + mMappedSize) { - tet_infoline("TestGraphics.Memory::LockRegion() Out of bounds"); + fprintf(stderr, "TestGraphics.Memory::LockRegion() Out of bounds"); mBuffer.memory.resize(mMappedOffset + offset + size); // Grow to prevent memcpy from crashing } mLockedOffset = offset; @@ -195,45 +227,386 @@ public: }; TestGraphicsController::TestGraphicsController() +: mCallStack(true, "TestGraphicsController."), + mCommandBufferCallStack(true, "TestCommandBuffer.") { mCallStack.Enable(true); - mCallStack.EnableLogging(true); mCommandBufferCallStack.Enable(true); - mCommandBufferCallStack.EnableLogging(true); - auto& trace = mGlAbstraction.GetTextureTrace(); + auto& trace = mGl.GetTextureTrace(); trace.Enable(true); trace.EnableLogging(true); } +int GetNumComponents(Graphics::VertexInputFormat vertexFormat) +{ + switch(vertexFormat) + { + case Graphics::VertexInputFormat::UNDEFINED: + case Graphics::VertexInputFormat::FLOAT: + case Graphics::VertexInputFormat::INTEGER: + return 1; + case Graphics::VertexInputFormat::IVECTOR2: + case Graphics::VertexInputFormat::FVECTOR2: + return 2; + case Graphics::VertexInputFormat::IVECTOR3: + case Graphics::VertexInputFormat::FVECTOR3: + return 3; + case Graphics::VertexInputFormat::FVECTOR4: + case Graphics::VertexInputFormat::IVECTOR4: + return 4; + } + return 1; +} + +GLint GetSize(Graphics::VertexInputFormat vertexFormat) +{ + switch(vertexFormat) + { + case Graphics::VertexInputFormat::UNDEFINED: + return 1u; + case Graphics::VertexInputFormat::INTEGER: + case Graphics::VertexInputFormat::IVECTOR2: + case Graphics::VertexInputFormat::IVECTOR3: + case Graphics::VertexInputFormat::IVECTOR4: + return 2u; + case Graphics::VertexInputFormat::FLOAT: + case Graphics::VertexInputFormat::FVECTOR2: + case Graphics::VertexInputFormat::FVECTOR3: + case Graphics::VertexInputFormat::FVECTOR4: + return 4u; + } + return 1u; +} + +GLint GetGlType(Graphics::VertexInputFormat vertexFormat) +{ + switch(vertexFormat) + { + case Graphics::VertexInputFormat::UNDEFINED: + return GL_BYTE; + case Graphics::VertexInputFormat::INTEGER: + case Graphics::VertexInputFormat::IVECTOR2: + case Graphics::VertexInputFormat::IVECTOR3: + case Graphics::VertexInputFormat::IVECTOR4: + return GL_SHORT; + case Graphics::VertexInputFormat::FLOAT: + case Graphics::VertexInputFormat::FVECTOR2: + case Graphics::VertexInputFormat::FVECTOR3: + case Graphics::VertexInputFormat::FVECTOR4: + return GL_FLOAT; + } + return GL_BYTE; +} + +GLenum GetTopology(Graphics::PrimitiveTopology topology) +{ + switch(topology) + { + case Graphics::PrimitiveTopology::POINT_LIST: + return GL_POINTS; + + case Graphics::PrimitiveTopology::LINE_LIST: + return GL_LINES; + + case Graphics::PrimitiveTopology::LINE_LOOP: + return GL_LINE_LOOP; + + case Graphics::PrimitiveTopology::LINE_STRIP: + return GL_LINE_STRIP; + + case Graphics::PrimitiveTopology::TRIANGLE_LIST: + return GL_TRIANGLES; + + case Graphics::PrimitiveTopology::TRIANGLE_STRIP: + return GL_TRIANGLE_STRIP; + + case Graphics::PrimitiveTopology::TRIANGLE_FAN: + return GL_TRIANGLE_FAN; + } + return GL_TRIANGLES; +} + +GLenum GetCullFace(Graphics::CullMode cullMode) +{ + switch(cullMode) + { + case Graphics::CullMode::NONE: + return GL_NONE; + case Graphics::CullMode::FRONT: + return GL_FRONT; + case Graphics::CullMode::BACK: + return GL_BACK; + case Graphics::CullMode::FRONT_AND_BACK: + return GL_FRONT_AND_BACK; + } + return GL_NONE; +} + +GLenum GetFrontFace(Graphics::FrontFace frontFace) +{ + if(frontFace == Graphics::FrontFace::CLOCKWISE) + { + return GL_CW; + } + return GL_CCW; +} + +GLenum GetBlendFactor(Graphics::BlendFactor blendFactor) +{ + GLenum glFactor = GL_ZERO; + + switch(blendFactor) + { + case Graphics::BlendFactor::ZERO: + glFactor = GL_ZERO; + break; + case Graphics::BlendFactor::ONE: + glFactor = GL_ONE; + break; + case Graphics::BlendFactor::SRC_COLOR: + glFactor = GL_SRC_COLOR; + break; + case Graphics::BlendFactor::ONE_MINUS_SRC_COLOR: + glFactor = GL_ONE_MINUS_SRC_COLOR; + break; + case Graphics::BlendFactor::DST_COLOR: + glFactor = GL_DST_COLOR; + break; + case Graphics::BlendFactor::ONE_MINUS_DST_COLOR: + glFactor = GL_ONE_MINUS_DST_COLOR; + break; + case Graphics::BlendFactor::SRC_ALPHA: + glFactor = GL_SRC_ALPHA; + break; + case Graphics::BlendFactor::ONE_MINUS_SRC_ALPHA: + glFactor = GL_ONE_MINUS_SRC_ALPHA; + break; + case Graphics::BlendFactor::DST_ALPHA: + glFactor = GL_DST_ALPHA; + break; + case Graphics::BlendFactor::ONE_MINUS_DST_ALPHA: + glFactor = GL_ONE_MINUS_DST_ALPHA; + break; + case Graphics::BlendFactor::CONSTANT_COLOR: + glFactor = GL_CONSTANT_COLOR; + break; + case Graphics::BlendFactor::ONE_MINUS_CONSTANT_COLOR: + glFactor = GL_ONE_MINUS_CONSTANT_COLOR; + break; + case Graphics::BlendFactor::CONSTANT_ALPHA: + glFactor = GL_CONSTANT_ALPHA; + break; + case Graphics::BlendFactor::ONE_MINUS_CONSTANT_ALPHA: + glFactor = GL_ONE_MINUS_CONSTANT_ALPHA; + break; + case Graphics::BlendFactor::SRC_ALPHA_SATURATE: + glFactor = GL_SRC_ALPHA_SATURATE; + break; + // GLES doesn't appear to have dual source blending. + case Graphics::BlendFactor::SRC1_COLOR: + glFactor = GL_SRC_COLOR; + break; + case Graphics::BlendFactor::ONE_MINUS_SRC1_COLOR: + glFactor = GL_ONE_MINUS_SRC_COLOR; + break; + case Graphics::BlendFactor::SRC1_ALPHA: + glFactor = GL_SRC_ALPHA; + break; + case Graphics::BlendFactor::ONE_MINUS_SRC1_ALPHA: + glFactor = GL_ONE_MINUS_SRC_ALPHA; + break; + } + return glFactor; +} + +GLenum GetBlendOp(Graphics::BlendOp blendOp) +{ + GLenum op = GL_FUNC_ADD; + switch(blendOp) + { + case Graphics::BlendOp::ADD: + op = GL_FUNC_ADD; + break; + case Graphics::BlendOp::SUBTRACT: + op = GL_FUNC_SUBTRACT; + break; + case Graphics::BlendOp::REVERSE_SUBTRACT: + op = GL_FUNC_REVERSE_SUBTRACT; + break; + case Graphics::BlendOp::MIN: + op = GL_MIN; + break; + case Graphics::BlendOp::MAX: + op = GL_MAX; + break; + + // @todo Add advanced blend equations + } + return op; +} + void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& submitInfo) { - std::ostringstream out; TraceCallStack::NamedParams namedParams; - out << "cmdBuffer[" << submitInfo.cmdBuffer.size() << "], flags:" << std::hex << submitInfo.flags; - namedParams["submitInfo"] = out.str(); + namedParams["submitInfo"] << "cmdBuffer[" << submitInfo.cmdBuffer.size() + << "], flags:" << std::hex << submitInfo.flags; + + mCallStack.PushCall("SubmitCommandBuffers", "", namedParams); - mCallStack.PushCall("Controller::SubmitCommandBuffers", "", namedParams); + mSubmitStack.emplace_back(submitInfo); - for(auto& commandBuffer : submitInfo.cmdBuffer) + for(auto& graphicsCommandBuffer : submitInfo.cmdBuffer) { - for(auto& binding : (static_cast(commandBuffer))->mTextureBindings) + auto commandBuffer = Uncast(graphicsCommandBuffer); + + auto value = commandBuffer->GetCommandsByType(0 | CommandType::BIND_TEXTURES); + if(!value.empty()) { - if(binding.texture) + // must be fixed + for (auto &binding : value[0]->bindTextures.textureBindings) { - auto texture = const_cast(static_cast(binding.texture)); + if (binding.texture) + { + auto texture = Uncast(binding.texture); - texture->Bind(binding.binding); + texture->Bind(binding.binding); - if(binding.sampler) - { - auto sampler = const_cast(static_cast(binding.sampler)); - if(sampler) + if (binding.sampler) { - sampler->Apply(texture->GetTarget()); + auto sampler = Uncast(binding.sampler); + if (sampler) + { + sampler->Apply(texture->GetTarget()); + } } + + texture->Prepare(); // Ensure native texture is ready + } + } + } + + // IndexBuffer binding, + auto bindIndexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_INDEX_BUFFER); + if (!bindIndexBufferCmds.empty()) + { + auto &indexBufferBinding = bindIndexBufferCmds[0]->bindIndexBuffer; + if (indexBufferBinding.buffer) + { + auto buffer = Uncast(indexBufferBinding.buffer); + buffer->Bind(); + } + } + + // VertexBuffer binding, + auto bindVertexBufferCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_VERTEX_BUFFERS); + if (!bindVertexBufferCmds.empty()) + { + for (auto &binding : bindVertexBufferCmds[0]->bindVertexBuffers.vertexBufferBindings) + { + auto graphicsBuffer = binding.buffer; + auto vertexBuffer = Uncast(graphicsBuffer); + vertexBuffer->Bind(); + } + } + // Pipeline attribute setup + auto bindPipelineCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_PIPELINE); + if (!bindPipelineCmds.empty()) + { + auto pipeline = bindPipelineCmds[0]->bindPipeline.pipeline; + auto &vi = pipeline->vertexInputState; + for (auto &attribute : vi.attributes) + { + mGl.EnableVertexAttribArray(attribute.location); + uint32_t attributeOffset = attribute.offset; + GLsizei stride = vi.bufferBindings[attribute.binding].stride; + + mGl.VertexAttribPointer(attribute.location, + GetNumComponents(attribute.format), + GetGlType(attribute.format), + GL_FALSE, // Not normalized + stride, + reinterpret_cast(attributeOffset)); + } + // Cull face setup + auto &rasterizationState = pipeline->rasterizationState; + if (rasterizationState.cullMode == Graphics::CullMode::NONE) + { + mGl.Disable(GL_CULL_FACE); + } + else + { + mGl.Enable(GL_CULL_FACE); + mGl.CullFace(GetCullFace(rasterizationState.cullMode)); + } + + mGl.FrontFace(GetFrontFace(rasterizationState.frontFace)); + // We don't modify glPolygonMode in our context/abstraction from GL_FILL (the GL default), + // so it isn't present in the API (and won't have any tests!) + + // Blending setup + auto &colorBlendState = pipeline->colorBlendState; + if (colorBlendState.blendEnable) + { + mGl.Enable(GL_BLEND); + + mGl.BlendFuncSeparate(GetBlendFactor(colorBlendState.srcColorBlendFactor), + GetBlendFactor(colorBlendState.dstColorBlendFactor), + GetBlendFactor(colorBlendState.srcAlphaBlendFactor), + GetBlendFactor(colorBlendState.dstAlphaBlendFactor)); + if (colorBlendState.colorBlendOp != colorBlendState.alphaBlendOp) + { + mGl.BlendEquationSeparate(GetBlendOp(colorBlendState.colorBlendOp), GetBlendOp(colorBlendState.alphaBlendOp)); } + else + { + mGl.BlendEquation(GetBlendOp(colorBlendState.colorBlendOp)); + } + mGl.BlendColor(colorBlendState.blendConstants[0], + colorBlendState.blendConstants[1], + colorBlendState.blendConstants[2], + colorBlendState.blendConstants[3]); + } + else + { + mGl.Disable(GL_BLEND); + } + + // draw call + auto topology = pipeline->inputAssemblyState.topology; + + // UniformBuffer binding (once we know pipeline) + auto bindUniformBuffersCmds = commandBuffer->GetCommandsByType(0 | CommandType::BIND_UNIFORM_BUFFER); + if (!bindUniformBuffersCmds.empty()) + { + auto buffer = bindUniformBuffersCmds[0]->bindUniformBuffers.standaloneUniformsBufferBinding; - texture->Prepare(); // Ensure native texture is ready + // based on reflection, issue gl calls + buffer.buffer->BindAsUniformBuffer( static_cast(pipeline->programState.program) ); + } + + auto drawCmds = commandBuffer->GetCommandsByType( 0 | + CommandType::DRAW | + CommandType::DRAW_INDEXED_INDIRECT | + CommandType::DRAW_INDEXED ); + + if(!drawCmds.empty()) + { + if (drawCmds[0]->draw.type == DrawCallDescriptor::Type::DRAW_INDEXED ) + { + mGl.DrawElements(GetTopology(topology), + static_cast(drawCmds[0]->draw.drawIndexed.indexCount), + GL_UNSIGNED_SHORT, + reinterpret_cast(drawCmds[0]->draw.drawIndexed.firstIndex)); + } + else + { + mGl.DrawArrays(GetTopology(topology), 0, drawCmds[0]->draw.draw.vertexCount); + } + } + // attribute clear + for (auto &attribute : vi.attributes) + { + mGl.DisableVertexAttribArray(attribute.location); } } } @@ -245,11 +618,9 @@ void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& su */ void TestGraphicsController::PresentRenderTarget(Graphics::RenderTarget* renderTarget) { - std::ostringstream out; TraceCallStack::NamedParams namedParams; - out << std::hex << renderTarget; - namedParams["renderTarget"] = out.str(); - mCallStack.PushCall("Controller::PresentRenderTarget", "", namedParams); + namedParams["renderTarget"] << std::hex << renderTarget; + mCallStack.PushCall("PresentRenderTarget", "", namedParams); } /** @@ -257,7 +628,7 @@ void TestGraphicsController::PresentRenderTarget(Graphics::RenderTarget* renderT */ void TestGraphicsController::WaitIdle() { - mCallStack.PushCall("Controller::WaitIdle", ""); + mCallStack.PushCall("WaitIdle", ""); } /** @@ -265,7 +636,7 @@ void TestGraphicsController::WaitIdle() */ void TestGraphicsController::Pause() { - mCallStack.PushCall("Controller::Pause", ""); + mCallStack.PushCall("Pause", ""); } /** @@ -273,21 +644,17 @@ void TestGraphicsController::Pause() */ void TestGraphicsController::Resume() { - mCallStack.PushCall("Controller::Resume", ""); + mCallStack.PushCall("Resume", ""); } void TestGraphicsController::UpdateTextures(const std::vector& updateInfoList, const std::vector& sourceList) { - std::ostringstream out; TraceCallStack::NamedParams namedParams; - out << "[" << updateInfoList.size() << "]:"; - namedParams["updateInfoList"] = out.str(); - out.str(""); - out << "[" << sourceList.size() << "]:"; - namedParams["sourceList"] = out.str(); + namedParams["updateInfoList"] << "[" << updateInfoList.size() << "]:"; + namedParams["sourceList"] << "[" << sourceList.size() << "]:"; - mCallStack.PushCall("Controller::UpdateTextures", "", namedParams); + mCallStack.PushCall("UpdateTextures", "", namedParams); // Call either TexImage2D or TexSubImage2D for(unsigned int i = 0; i < updateInfoList.size(); ++i) @@ -304,29 +671,27 @@ void TestGraphicsController::UpdateTextures(const std::vector TestGraphicsController::CreateBuffer(const { std::ostringstream oss; oss << "bufferCreateInfo:" << createInfo; - mCallStack.PushCall("Controller::CreateBuffer", oss.str()); - return Graphics::MakeUnique(mCallStack, mGlAbstraction, createInfo.size, createInfo.usage); + mCallStack.PushCall("CreateBuffer", oss.str()); + return Graphics::MakeUnique(mCallStack, mGl, createInfo.size, createInfo.usage); } Graphics::UniquePtr TestGraphicsController::CreateCommandBuffer(const Graphics::CommandBufferCreateInfo& commandBufferCreateInfo, Graphics::UniquePtr&& oldCommandBuffer) { std::ostringstream oss; oss << "commandBufferCreateInfo:" << commandBufferCreateInfo; - mCallStack.PushCall("Controller::CreateCommandBuffer", oss.str()); - return Graphics::MakeUnique(mCommandBufferCallStack, mGlAbstraction); + mCallStack.PushCall("CreateCommandBuffer", oss.str()); + return Graphics::MakeUnique(mCommandBufferCallStack, mGl); } Graphics::UniquePtr TestGraphicsController::CreateRenderPass(const Graphics::RenderPassCreateInfo& renderPassCreateInfo, Graphics::UniquePtr&& oldRenderPass) { - mCallStack.PushCall("Controller::CreateRenderPass", ""); + mCallStack.PushCall("CreateRenderPass", ""); return nullptr; } Graphics::UniquePtr TestGraphicsController::CreateTexture(const Graphics::TextureCreateInfo& textureCreateInfo, Graphics::UniquePtr&& oldTexture) { - std::ostringstream params, oss; - params << "textureCreateInfo:" << textureCreateInfo; TraceCallStack::NamedParams namedParams; - oss << textureCreateInfo; - namedParams["textureCreateInfo"] = oss.str(); - mCallStack.PushCall("Controller::CreateTexture", params.str(), namedParams); + namedParams["textureCreateInfo"] << textureCreateInfo; + mCallStack.PushCall("CreateTexture", namedParams.str(), namedParams); - return Graphics::MakeUnique(mGlAbstraction, textureCreateInfo); + return Graphics::MakeUnique(mGl, textureCreateInfo); } Graphics::UniquePtr TestGraphicsController::CreateFramebuffer(const Graphics::FramebufferCreateInfo& framebufferCreateInfo, Graphics::UniquePtr&& oldFramebuffer) { - mCallStack.PushCall("Controller::CreateFramebuffer", ""); + mCallStack.PushCall("CreateFramebuffer", ""); return nullptr; } Graphics::UniquePtr TestGraphicsController::CreatePipeline(const Graphics::PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr&& oldPipeline) { - mCallStack.PushCall("Controller::CreatePipeline", ""); - return nullptr; + mCallStack.PushCall("CreatePipeline", ""); + return std::make_unique(mGl, pipelineCreateInfo); +} + +Graphics::UniquePtr TestGraphicsController::CreateProgram(const Graphics::ProgramCreateInfo& programCreateInfo, Graphics::UniquePtr&& oldProgram) +{ + mCallStack.PushCall("CreateProgram", ""); + + for(auto cacheEntry : mProgramCache) + { + bool found = true; + for(auto& shader : *(programCreateInfo.shaderState)) + { + auto graphicsShader = Uncast(shader.shader); + std::vector source; + 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())) + { + found = false; + break; + } + } + if(found) + { + return Graphics::MakeUnique(cacheEntry.programImpl); + } + } + + mProgramCache.emplace_back(); + mProgramCache.back().programImpl = new TestGraphicsProgramImpl(mGl, programCreateInfo, mVertexFormats, mCustomUniforms); + for(auto& shader : *(programCreateInfo.shaderState)) + { + auto graphicsShader = Uncast(shader.shader); + mProgramCache.back().shaders[shader.pipelineStage].resize( graphicsShader->mCreateInfo.sourceSize ); + memcpy(&mProgramCache.back().shaders[shader.pipelineStage][0], graphicsShader->mCreateInfo.sourceData, graphicsShader->mCreateInfo.sourceSize); + } + return Graphics::MakeUnique(mProgramCache.back().programImpl); } Graphics::UniquePtr TestGraphicsController::CreateShader(const Graphics::ShaderCreateInfo& shaderCreateInfo, Graphics::UniquePtr&& oldShader) { - mCallStack.PushCall("Controller::CreateShader", ""); - return nullptr; + mCallStack.PushCall("CreateShader", ""); + return Graphics::MakeUnique(mGl, shaderCreateInfo); } Graphics::UniquePtr TestGraphicsController::CreateSampler(const Graphics::SamplerCreateInfo& samplerCreateInfo, Graphics::UniquePtr&& oldSampler) { - std::ostringstream params, oss; - params << "samplerCreateInfo:" << samplerCreateInfo; TraceCallStack::NamedParams namedParams; - oss << samplerCreateInfo; - namedParams["samplerCreateInfo"] = oss.str(); - mCallStack.PushCall("Controller::CreateSampler", params.str(), namedParams); + namedParams["samplerCreateInfo"] << samplerCreateInfo; + mCallStack.PushCall("CreateSampler", namedParams.str(), namedParams); - return Graphics::MakeUnique(mGlAbstraction, samplerCreateInfo); + return Graphics::MakeUnique(mGl, samplerCreateInfo); } Graphics::UniquePtr TestGraphicsController::CreateRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr&& oldRenderTarget) { - mCallStack.PushCall("Controller::CreateRenderTarget", ""); + mCallStack.PushCall("CreateRenderTarget", ""); return nullptr; } Graphics::UniquePtr TestGraphicsController::MapBufferRange(const Graphics::MapBufferInfo& mapInfo) { - mCallStack.PushCall("Controller::MapBufferRange", ""); + mCallStack.PushCall("MapBufferRange", ""); auto buffer = static_cast(mapInfo.buffer); buffer->memory.resize(mapInfo.offset + mapInfo.size); // For initial testing, allow writes past capacity @@ -423,39 +819,53 @@ Graphics::UniquePtr TestGraphicsController::MapBufferRange(con Graphics::UniquePtr TestGraphicsController::MapTextureRange(const Graphics::MapTextureInfo& mapInfo) { - mCallStack.PushCall("Controller::MapTextureRange", ""); + mCallStack.PushCall("MapTextureRange", ""); return nullptr; } void TestGraphicsController::UnmapMemory(Graphics::UniquePtr memory) { - mCallStack.PushCall("Controller::UnmapMemory", ""); + mCallStack.PushCall("UnmapMemory", ""); } Graphics::MemoryRequirements TestGraphicsController::GetTextureMemoryRequirements(Graphics::Texture& texture) const { - mCallStack.PushCall("Controller::GetTextureMemoryRequirements", ""); + mCallStack.PushCall("GetTextureMemoryRequirements", ""); return Graphics::MemoryRequirements{}; } Graphics::MemoryRequirements TestGraphicsController::GetBufferMemoryRequirements(Graphics::Buffer& buffer) const { - mCallStack.PushCall("Controller::GetBufferMemoryRequirements", ""); + mCallStack.PushCall("GetBufferMemoryRequirements", ""); return Graphics::MemoryRequirements{}; } const Graphics::TextureProperties& TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture) { static Graphics::TextureProperties textureProperties{}; - mCallStack.PushCall("Controller::GetTextureProperties", ""); + mCallStack.PushCall("GetTextureProperties", ""); return textureProperties; } +const Graphics::Reflection& TestGraphicsController::GetProgramReflection(const Graphics::Program& program) +{ + mCallStack.PushCall("GetProgramReflection", ""); + + return static_cast(&program)->GetReflection(); +} + bool TestGraphicsController::PipelineEquals(const Graphics::Pipeline& pipeline0, const Graphics::Pipeline& pipeline1) const { - mCallStack.PushCall("Controller::PipelineEquals", ""); + mCallStack.PushCall("PipelineEquals", ""); return false; } +bool TestGraphicsController::GetProgramParameter(Graphics::Program& program, uint32_t parameterId, void* outData) +{ + mCallStack.PushCall("GetProgramParameter", ""); + auto graphicsProgram = Uncast(&program); + return graphicsProgram->GetParameter(parameterId, outData); +} + } // namespace Dali