#include <iostream>
#include <sstream>
+#include <any>
+
namespace Dali
{
std::ostream& operator<<(std::ostream& o, const Graphics::BufferCreateInfo& bufferCreateInfo)
case CommandType::DRAW_NATIVE:
{
auto info = &cmd.data.draw.drawNative.drawNativeInfo;
+
+ if(info->glesNativeInfo.eglSharedContextStoragePointer)
+ {
+ auto* anyContext = reinterpret_cast<std::any*>(info->glesNativeInfo.eglSharedContextStoragePointer);
+ *anyContext = reinterpret_cast<void*>(0x12345678u);
+ }
+
CallbackBase::ExecuteReturn<bool>(*info->callback, info->userData);
break;
}
#include <dali/internal/graphics/gles/egl-sync-implementation.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
+
+#include <any>
+
// Uncomment the following define to turn on frame dumping
//#define ENABLE_COMMAND_BUFFER_FRAME_DUMP 1
#include <dali/internal/graphics/gles-impl/egl-graphics-controller-debug.h>
{
mCurrentContext = mContext.get();
mCurrentContext->GlContextCreated();
+
+ if(!mSharedContext)
+ {
+ auto eglGraphics = dynamic_cast<Dali::Internal::Adaptor::EglGraphics*>(mGraphics);
+ mSharedContext = eglGraphics->GetEglImplementation().GetContext();
+ }
}
void EglGraphicsController::ActivateSurfaceContext(Dali::RenderSurfaceInterface* surface)
mCurrentContext->PrepareForNativeRendering();
+ if(info->glesNativeInfo.eglSharedContextStoragePointer)
+ {
+ auto* anyContext = reinterpret_cast<std::any*>(info->glesNativeInfo.eglSharedContextStoragePointer);
+ *anyContext = mSharedContext;
+ }
+
CallbackBase::ExecuteReturn<bool>(*info->callback, info->userData);
mCurrentContext->RestoreFromNativeRendering();
#define DALI_EGL_GRAPHICS_CONTROLLER_H
/*
- * 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.
return mCurrentContext;
}
+ /**
+ * @brief Returns EGL shared context
+ *
+ * @return valid EGL shared context
+ */
+ void* GetSharedContext() const
+ {
+ return mSharedContext;
+ }
+
private:
Integration::GlAbstraction* mGlAbstraction{nullptr};
Integration::GlContextHelperAbstraction* mGlContextHelperAbstraction{nullptr};
bool mIsShuttingDown{false}; ///< Indicates whether the controller is shutting down
std::queue<const GLES::CommandBuffer*> mPresentationCommandBuffers{}; ///< Queue of reusable command buffers used by presentation engine
+
+ void* mSharedContext{nullptr}; ///< Shared EGL context
};
} // namespace Graphics
#include <EGL/eglext.h>
#include <map>
-
namespace Dali::Graphics::GLES
{
struct Context::Impl
void Context::ResolveStandaloneUniforms()
{
// Find reflection for program
- const auto program = static_cast<const GLES::Program*>(mImpl->mNewPipeline->GetCreateInfo().programState->program);
- const auto ptr = reinterpret_cast<const char*>(mImpl->mCurrentStandaloneUBOBinding.buffer->GetCPUAllocatedAddress()) + mImpl->mCurrentStandaloneUBOBinding.offset;
+ const GLES::Program* program{nullptr};
- // Update program uniforms
- program->GetImplementation()->UpdateStandaloneUniformBlock(ptr);
+ if(mImpl->mNewPipeline)
+ {
+ program = static_cast<const GLES::Program*>(mImpl->mNewPipeline->GetCreateInfo().programState->program);
+ }
+ else if(mImpl->mCurrentPipeline)
+ {
+ program = static_cast<const GLES::Program*>(mImpl->mCurrentPipeline->GetCreateInfo().programState->program);
+ }
+
+ if(program)
+ {
+ const auto ptr = reinterpret_cast<const char*>(mImpl->mCurrentStandaloneUBOBinding.buffer->GetCPUAllocatedAddress()) + mImpl->mCurrentStandaloneUBOBinding.offset;
+ // Update program uniforms
+ program->GetImplementation()->UpdateStandaloneUniformBlock(ptr);
+ }
}
void Context::BeginRenderPass(const BeginRenderPassDescriptor& renderPassBegin)
attribs.push_back(version % 10);
attribs.push_back(EGL_NONE);
- mImpl->mNativeDrawContext = eglCreateContext(display, configs[configId], EGL_NO_CONTEXT, attribs.data());
+ mImpl->mNativeDrawContext = eglCreateContext(display, configs[configId], mImpl->mController.GetSharedContext(), attribs.data());
}
eglMakeCurrent(display, drawSurface, readSurface, mImpl->mNativeDrawContext);
/*
- * 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.
}
void GlWindowRenderThread::RegisterGlCallbacks(CallbackBase* initCallback,
- CallbackBase* renderFrameCallback,
- CallbackBase* terminateCallback)
+ CallbackBase* renderFrameCallback,
+ CallbackBase* terminateCallback)
{
mGLInitCallback = std::unique_ptr<CallbackBase>(initCallback);
mGLRenderFrameCallback = std::unique_ptr<CallbackBase>(renderFrameCallback);
/*
- * 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.
bool NativeImageSurfaceEcoreWl::SetGraphicsConfig(bool depth, bool stencil, int msaa, int version)
{
- bool featureFlag = false;
- int error = SYSTEM_INFO_ERROR_NONE;
-
- if(version == 30)
- {
- error = system_info_get_platform_bool("http://tizen.org/feature/opengles.version.3_0", &featureFlag);
- }
- else if(version == 20)
+ // Setup the configuration
+ // The GLES version support is done by the caller
+ mDepth = depth;
+ mStencil = stencil;
+ if(mMSAA == 0)
{
- error = system_info_get_platform_bool("http://tizen.org/feature/opengles.version.2_0", &featureFlag);
+ //EGL_DONT_CARE is -1
+ mMSAA = -1;
}
else
{
- DALI_LOG_ERROR("version is not valid");
- return false;
- }
-
- if(error != SYSTEM_INFO_ERROR_NONE)
- {
- DALI_LOG_ERROR("Can't check platform feature.\n");
- return false;
- }
-
- if(featureFlag)
- {
- mDepth = depth;
- mStencil = stencil;
- if(mMSAA == 0)
- {
- //EGL_DONT_CARE is -1
- mMSAA = -1;
- }
- else
- {
- mMSAA = msaa;
- }
- mGLESVersion = version;
+ mMSAA = msaa;
}
+ mGLESVersion = version;
- return featureFlag;
+ return true;
}
Any NativeImageSurfaceEcoreWl::GetNativeRenderable()