/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
mCore = Dali::Integration::Core::New(mRenderController,
mPlatformAbstraction,
- mGlAbstraction,
- mGlSyncAbstraction,
- mGlContextHelperAbstraction,
+ mGraphicsController,
Integration::RenderToFrameBuffer::FALSE,
Integration::DepthBufferAvailable::TRUE,
Integration::StencilBufferAvailable::TRUE,
return mRenderController;
}
+TestGraphicsController& TestApplication::GetGraphicsController()
+{
+ return mGraphicsController;
+}
+
TestGlAbstraction& TestApplication::GetGlAbstraction()
{
- return mGlAbstraction;
+ return static_cast<TestGlAbstraction&>(mGraphicsController.GetGlAbstraction());
}
TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction()
{
- return mGlSyncAbstraction;
+ return static_cast<TestGlSyncAbstraction&>(mGraphicsController.GetGlSyncAbstraction());
}
TestGlContextHelperAbstraction& TestApplication::GetGlContextHelperAbstraction()
{
- return mGlContextHelperAbstraction;
+ return static_cast<TestGlContextHelperAbstraction&>(mGraphicsController.GetGlContextHelperAbstraction());
}
void TestApplication::ProcessEvent(const Integration::Event& event)
void TestApplication::ResetContext()
{
mCore->ContextDestroyed();
- mGlAbstraction.Initialize();
+ mGraphicsController.Initialize();
mCore->ContextCreated();
}
#define DALI_TEST_APPLICATION_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
#include <dali/integration-api/resource-policies.h>
#include <dali/integration-api/scene.h>
#include <dali/integration-api/trace.h>
+
#include <dali/public-api/common/dali-common.h>
#include <test-platform-abstraction.h>
-#include "test-gl-abstraction.h"
-#include "test-gl-context-helper-abstraction.h"
-#include "test-gl-sync-abstraction.h"
+#include "test-graphics-controller.h"
#include "test-render-controller.h"
namespace Dali
void CreateScene();
void InitializeCore();
~TestApplication() override;
- static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
- static void LogContext(bool start, const char* tag);
- Dali::Integration::Core& GetCore();
- TestPlatformAbstraction& GetPlatform();
- TestRenderController& GetRenderController();
+ static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
+ static void LogContext(bool start, const char* tag);
+ Dali::Integration::Core& GetCore();
+ TestPlatformAbstraction& GetPlatform();
+ TestRenderController& GetRenderController();
+ TestGraphicsController& GetGraphicsController();
+
TestGlAbstraction& GetGlAbstraction();
TestGlSyncAbstraction& GetGlSyncAbstraction();
TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
- void ProcessEvent(const Integration::Event& event);
- void SendNotification();
- bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
- bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
- bool RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
- uint32_t GetUpdateStatus();
- bool UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
- bool RenderOnly();
- void ResetContext();
- bool GetRenderNeedsUpdate();
- bool GetRenderNeedsPostRender();
- uint32_t Wait(uint32_t durationToWait);
- static void EnableLogging(bool enabled)
+
+ void ProcessEvent(const Integration::Event& event);
+ void SendNotification();
+ bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
+ bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
+ bool RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
+ uint32_t GetUpdateStatus();
+ bool UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
+ bool RenderOnly();
+ void ResetContext();
+ bool GetRenderNeedsUpdate();
+ bool GetRenderNeedsPostRender();
+ uint32_t Wait(uint32_t durationToWait);
+ static void EnableLogging(bool enabled)
{
mLoggingEnabled = enabled;
}
void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
protected:
- TestPlatformAbstraction mPlatformAbstraction;
- TestRenderController mRenderController;
- TestGlAbstraction mGlAbstraction;
- TestGlSyncAbstraction mGlSyncAbstraction;
- TestGlContextHelperAbstraction mGlContextHelperAbstraction;
+ TestPlatformAbstraction mPlatformAbstraction;
+ TestRenderController mRenderController;
+ TestGraphicsController mGraphicsController;
Integration::UpdateStatus mStatus;
Integration::RenderStatus mRenderStatus;
--- /dev/null
+#ifndef TEST_GRAPHICS_CONTROLLER_H
+#define TEST_GRAPHICS_CONTROLLER_H
+
+/*
+ * Copyright (c) 2021 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/graphics-api/graphics-controller.h>
+#include "test-gl-abstraction.h"
+#include "test-gl-context-helper-abstraction.h"
+#include "test-gl-sync-abstraction.h"
+
+namespace Dali
+{
+class TestGraphicsController : public Dali::Graphics::Controller
+{
+public:
+ TestGraphicsController() = default;
+ virtual ~TestGraphicsController() = default;
+
+ void Initialize()
+ {
+ mGlAbstraction.Initialize();
+ }
+
+ Integration::GlAbstraction& GetGlAbstraction() override
+ {
+ return mGlAbstraction;
+ }
+
+ Integration::GlSyncAbstraction& GetGlSyncAbstraction() override
+ {
+ return mGlSyncAbstraction;
+ }
+
+ Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override
+ {
+ return mGlContextHelperAbstraction;
+ }
+
+private:
+ TestGlAbstraction mGlAbstraction;
+ TestGlSyncAbstraction mGlSyncAbstraction;
+ TestGlContextHelperAbstraction mGlContextHelperAbstraction;
+};
+
+} // namespace Dali
+
+#endif //TEST_GRAPHICS_CONTROLLER_H
INCLUDE( ${ROOT_SRC_DIR}/dali/integration-api/file.list )
INCLUDE( ${ROOT_SRC_DIR}/dali/public-api/file.list )
INCLUDE( ${ROOT_SRC_DIR}/dali/devel-api/file.list )
+INCLUDE( ${ROOT_SRC_DIR}/dali/graphics-api/file.list )
IF( WIN32 )
INCLUDE( ${ROOT_SRC_DIR}/dali/internal/file-windows.list )
ELSEIF( UNIX )
# Install headers using lists defined by ADD_SUBDIRECTORY
INSTALL_HEADERS_WITH_DIRECTORY(PUBLIC_API_HEADERS ${ROOT_SRC_DIR}/dali "dali")
INSTALL_HEADERS_WITH_DIRECTORY(DEVEL_API_HEADERS ${ROOT_SRC_DIR}/dali "dali")
+INSTALL_HEADERS_WITH_DIRECTORY(GRAPHICS_API_HEADERS ${ROOT_SRC_DIR}/dali "dali")
INSTALL_HEADERS_WITH_DIRECTORY(INTEGRATION_API_HEADERS ${ROOT_SRC_DIR}/dali "dali")
INSTALL_HEADERS_WITH_DIRECTORY(PACKAGE_DOXY_HEADERS ${PACKAGE_DOXY_SRC_DIR} "dali/doc" )
--- /dev/null
+# Set the header directory
+
+SET( graphics_src_dir ${ROOT_SRC_DIR}/dali/graphics-api )
+
+SET( GRAPHICS_API_HEADERS ${GRAPHICS_API_HEADERS}
+ ${graphics_src_dir}/graphics-controller.h
+)
--- /dev/null
+#ifndef DALI_GRAPHICS_CONTROLLER_H
+#define DALI_GRAPHICS_CONTROLLER_H
+
+/*
+ * Copyright (c) 2021 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+namespace Integration
+{
+class GlAbstraction;
+class GlSyncAbstraction;
+class GlContextHelperAbstraction;
+} // namespace Integration
+
+namespace Graphics
+{
+/**
+ * @brief The main controller for creating graphics objects and submitting render commands.
+ */
+class Controller
+{
+public:
+ virtual ~Controller() = default;
+
+ // Temporary until graphics api is complete
+ virtual Integration::GlAbstraction& GetGlAbstraction() = 0;
+ virtual Integration::GlSyncAbstraction& GetGlSyncAbstraction() = 0;
+ virtual Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() = 0;
+
+public:
+ // not copyable
+ Controller(const Controller&) = delete;
+ Controller& operator=(const Controller&) = delete;
+
+protected:
+ // derived types should not be moved direcly to prevent slicing
+ Controller(Controller&&) = default;
+ Controller& operator=(Controller&&) = default;
+
+ /**
+ * Objects of this type should not be directly instantiated.
+ */
+ Controller() = default;
+};
+
+} // namespace Graphics
+} // namespace Dali
+
+#endif // DALI_GRAPHICS_CONTROLLER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
// INTERNAL INCLUDES
#include <dali/integration-api/events/event.h>
-#include <dali/integration-api/gl-context-helper-abstraction.h>
-#include <dali/integration-api/gl-sync-abstraction.h>
#include <dali/integration-api/processor-interface.h>
#include <dali/internal/common/core-impl.h>
#include <dali/public-api/actors/layer.h>
{
namespace Integration
{
-Core* Core::New(RenderController& renderController,
- PlatformAbstraction& platformAbstraction,
- GlAbstraction& glAbstraction,
- GlSyncAbstraction& glSyncAbstraction,
- GlContextHelperAbstraction& glContextHelperAbstraction,
- RenderToFrameBuffer renderToFboEnabled,
- DepthBufferAvailable depthBufferAvailable,
- StencilBufferAvailable stencilBufferAvailable,
- PartialUpdateAvailable partialUpdateAvailable)
+Core* Core::New(RenderController& renderController,
+ PlatformAbstraction& platformAbstraction,
+ Graphics::Controller& graphicsController,
+ RenderToFrameBuffer renderToFboEnabled,
+ DepthBufferAvailable depthBufferAvailable,
+ StencilBufferAvailable stencilBufferAvailable,
+ PartialUpdateAvailable partialUpdateAvailable)
{
Core* instance = new Core;
instance->mImpl = new Internal::Core(renderController,
platformAbstraction,
- glAbstraction,
- glSyncAbstraction,
- glContextHelperAbstraction,
+ graphicsController,
renderToFboEnabled,
depthBufferAvailable,
stencilBufferAvailable,
#define DALI_INTEGRATION_CORE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
class ObjectRegistry;
class RenderTaskList;
+namespace Graphics
+{
+class Controller;
+}
+
namespace Internal
{
class Core;
namespace Integration
{
class Core;
-class GlAbstraction;
-class GlSyncAbstraction;
-class GlContextHelperAbstraction;
class PlatformAbstraction;
class Processor;
class RenderController;
* This object is used for integration with the native windowing system.
* @param[in] renderController The interface to an object which controls rendering.
* @param[in] platformAbstraction The interface providing platform specific services.
- * @param[in] glAbstraction The interface providing OpenGL services.
- * @param[in] glSyncAbstraction The interface providing OpenGL sync objects.
- * @param[in] glContextHelperAbstraction The interface providing OpenGL context helper objects.
+ * @param[in] graphicsController The interface providing graphics services
* @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
* @param[in] depthBufferAvailable Whether the depth buffer is available
* @param[in] stencilBufferAvailable Whether the stencil buffer is available
* @param[in] partialUpdateAvailable Whether the partial update is available
* @return A newly allocated Core.
*/
- static Core* New(RenderController& renderController,
- PlatformAbstraction& platformAbstraction,
- GlAbstraction& glAbstraction,
- GlSyncAbstraction& glSyncAbstraction,
- GlContextHelperAbstraction& glContextHelperAbstraction,
- RenderToFrameBuffer renderToFboEnabled,
- DepthBufferAvailable depthBufferAvailable,
- StencilBufferAvailable stencilBufferAvailable,
- PartialUpdateAvailable partialUpdateAvailable);
+ static Core* New(RenderController& renderController,
+ PlatformAbstraction& platformAbstraction,
+ Graphics::Controller& graphicsController,
+ RenderToFrameBuffer renderToFboEnabled,
+ DepthBufferAvailable depthBufferAvailable,
+ StencilBufferAvailable stencilBufferAvailable,
+ PartialUpdateAvailable partialUpdateAvailable);
/**
* Non-virtual destructor. Core is not intended as a base class.
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
#include <dali/internal/common/core-impl.h>
// INTERNAL INCLUDES
+#include <dali/graphics-api/graphics-controller.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/events/event.h>
-#include <dali/integration-api/gl-sync-abstraction.h>
#include <dali/integration-api/gl-context-helper-abstraction.h>
+#include <dali/integration-api/gl-sync-abstraction.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/integration-api/processor-interface.h>
#include <dali/integration-api/render-controller.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/animation/animation-playlist.h>
+#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/common/notification-manager.h>
#include <dali/internal/event/common/property-notification-manager.h>
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/common/type-registry-impl.h>
#include <dali/internal/event/effects/shader-factory.h>
#include <dali/internal/event/events/event-processor.h>
#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
#include <dali/internal/update/common/discard-queue.h>
-#include <dali/internal/update/manager/update-manager.h>
#include <dali/internal/update/manager/render-task-processor.h>
+#include <dali/internal/update/manager/update-manager.h>
#include <dali/internal/render/common/performance-monitor.h>
#include <dali/internal/render/common/render-manager.h>
#include <dali/internal/render/gl-resources/context.h>
-using Dali::Internal::SceneGraph::UpdateManager;
-using Dali::Internal::SceneGraph::RenderManager;
using Dali::Internal::SceneGraph::DiscardQueue;
+using Dali::Internal::SceneGraph::RenderManager;
using Dali::Internal::SceneGraph::RenderQueue;
+using Dali::Internal::SceneGraph::UpdateManager;
namespace
{
#if defined(DEBUG_ENABLED)
Debug::Filter* gCoreFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CORE");
#endif
-}
+} // namespace
namespace Dali
{
-
namespace Internal
{
-
-using Integration::RenderController;
-using Integration::PlatformAbstraction;
-using Integration::GlSyncAbstraction;
+using Integration::Event;
using Integration::GlAbstraction;
using Integration::GlContextHelperAbstraction;
-using Integration::Event;
-using Integration::UpdateStatus;
+using Integration::GlSyncAbstraction;
+using Integration::PlatformAbstraction;
+using Integration::RenderController;
using Integration::RenderStatus;
+using Integration::UpdateStatus;
-Core::Core( RenderController& renderController,
- PlatformAbstraction& platform,
- GlAbstraction& glAbstraction,
- GlSyncAbstraction& glSyncAbstraction,
- GlContextHelperAbstraction& glContextHelperAbstraction,
- Integration::RenderToFrameBuffer renderToFboEnabled,
- Integration::DepthBufferAvailable depthBufferAvailable,
- Integration::StencilBufferAvailable stencilBufferAvailable,
- Integration::PartialUpdateAvailable partialUpdateAvailable )
-: mRenderController( renderController ),
+Core::Core(RenderController& renderController,
+ PlatformAbstraction& platform,
+ Graphics::Controller& graphicsController,
+ Integration::RenderToFrameBuffer renderToFboEnabled,
+ Integration::DepthBufferAvailable depthBufferAvailable,
+ Integration::StencilBufferAvailable stencilBufferAvailable,
+ Integration::PartialUpdateAvailable partialUpdateAvailable)
+: mRenderController(renderController),
mPlatform(platform),
- mGlAbstraction(glAbstraction),
+ mGraphicsController(graphicsController),
mProcessingEvent(false),
- mForceNextUpdate( false )
+ mForceNextUpdate(false)
{
// Create the thread local storage
CreateThreadLocalStorage();
// This does nothing until Core is built with --enable-performance-monitor
- PERFORMANCE_MONITOR_INIT( platform );
+ PERFORMANCE_MONITOR_INIT(platform);
mNotificationManager = new NotificationManager();
mRenderTaskProcessor = new SceneGraph::RenderTaskProcessor();
- mRenderManager = RenderManager::New( glAbstraction, glSyncAbstraction, glContextHelperAbstraction, depthBufferAvailable, stencilBufferAvailable, partialUpdateAvailable );
+ mRenderManager = RenderManager::New(graphicsController, depthBufferAvailable, stencilBufferAvailable, partialUpdateAvailable);
RenderQueue& renderQueue = mRenderManager->GetRenderQueue();
- mDiscardQueue = new DiscardQueue( renderQueue );
+ mDiscardQueue = new DiscardQueue(renderQueue);
- mUpdateManager = new UpdateManager( *mNotificationManager,
- *mAnimationPlaylist,
- *mPropertyNotificationManager,
- *mDiscardQueue,
- renderController,
- *mRenderManager,
- renderQueue,
- *mRenderTaskProcessor );
+ mUpdateManager = new UpdateManager(*mNotificationManager,
+ *mAnimationPlaylist,
+ *mPropertyNotificationManager,
+ *mDiscardQueue,
+ renderController,
+ *mRenderManager,
+ renderQueue,
+ *mRenderTaskProcessor);
- mRenderManager->SetShaderSaver( *mUpdateManager );
+ mRenderManager->SetShaderSaver(*mUpdateManager);
mObjectRegistry = ObjectRegistry::New();
- mStage = IntrusivePtr<Stage>( Stage::New( *mUpdateManager ) );
+ mStage = IntrusivePtr<Stage>(Stage::New(*mUpdateManager));
// This must be called after stage is created but before stage initialization
- mRelayoutController = IntrusivePtr< RelayoutController >( new RelayoutController( mRenderController ) );
+ mRelayoutController = IntrusivePtr<RelayoutController>(new RelayoutController(mRenderController));
- mGestureEventProcessor = new GestureEventProcessor( *mUpdateManager, mRenderController );
+ mGestureEventProcessor = new GestureEventProcessor(*mUpdateManager, mRenderController);
mShaderFactory = new ShaderFactory();
- mUpdateManager->SetShaderSaver( *mShaderFactory );
+ mUpdateManager->SetShaderSaver(*mShaderFactory);
GetImplementation(Dali::TypeRegistry::Get()).CallInitFunctions();
}
// allows core to be created / deleted many times in the same thread (how TET cases work).
// Do this before mStage.Reset() so Stage::IsInstalled() returns false
ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
- if( tls )
+ if(tls)
{
tls->Remove();
tls->Unreference();
// remove (last?) reference to stage
mStage.Reset();
-
}
void Core::Initialize()
{
- mStage->Initialize( *mScenes[0] );
+ mStage->Initialize(*mScenes[0]);
}
Integration::ContextNotifierInterface* Core::GetContextNotifier()
mRenderManager->ContextDestroyed();
}
-void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
+void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo)
{
// set the time delta so adaptor can easily print FPS with a release build with 0 as
// it is cached by frametime
// Render returns true when there are updates on the stage or one or more animations are completed.
// Use the estimated time diff till we render as the elapsed time.
- status.keepUpdating = mUpdateManager->Update( elapsedSeconds,
- lastVSyncTimeMilliseconds,
- nextVSyncTimeMilliseconds,
- renderToFboEnabled,
- isRenderingToFbo );
+ status.keepUpdating = mUpdateManager->Update(elapsedSeconds,
+ lastVSyncTimeMilliseconds,
+ nextVSyncTimeMilliseconds,
+ renderToFboEnabled,
+ isRenderingToFbo);
// Check the Notification Manager message queue to set needsNotification
status.needsNotification = mNotificationManager->MessagesToProcess();
// Any message to update will wake it up anyways
}
-void Core::PreRender( RenderStatus& status, bool forceClear, bool uploadOnly )
+void Core::PreRender(RenderStatus& status, bool forceClear, bool uploadOnly)
{
- mRenderManager->PreRender( status, forceClear, uploadOnly );
+ mRenderManager->PreRender(status, forceClear, uploadOnly);
}
-void Core::PreRender( Integration::Scene& scene, std::vector<Rect<int>>& damagedRects )
+void Core::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
{
- mRenderManager->PreRender( scene, damagedRects );
+ mRenderManager->PreRender(scene, damagedRects);
}
-void Core::RenderScene( RenderStatus& status, Integration::Scene& scene, bool renderToFbo )
+void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo)
{
- mRenderManager->RenderScene( status, scene, renderToFbo );
+ mRenderManager->RenderScene(status, scene, renderToFbo);
}
-void Core::RenderScene( RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect )
+void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect)
{
- mRenderManager->RenderScene( status, scene, renderToFbo, clippingRect );
+ mRenderManager->RenderScene(status, scene, renderToFbo, clippingRect);
}
-void Core::PostRender( bool uploadOnly )
+void Core::PostRender(bool uploadOnly)
{
- mRenderManager->PostRender( uploadOnly );
+ mRenderManager->PostRender(uploadOnly);
}
void Core::SceneCreated()
mRelayoutController->OnApplicationSceneCreated();
- for( const auto& scene : mScenes )
+ for(const auto& scene : mScenes)
{
Dali::Actor sceneRootLayer = scene->GetRootLayer();
- mRelayoutController->RequestRelayoutTree( sceneRootLayer );
+ mRelayoutController->RequestRelayoutTree(sceneRootLayer);
}
}
-void Core::QueueEvent( const Integration::Event& event )
+void Core::QueueEvent(const Integration::Event& event)
{
- if (mScenes.size() != 0)
+ if(mScenes.size() != 0)
{
- mScenes.front()->QueueEvent( event );
+ mScenes.front()->QueueEvent(event);
}
}
void Core::ProcessEvents()
{
// Guard against calls to ProcessEvents() during ProcessEvents()
- if( mProcessingEvent )
+ if(mProcessingEvent)
{
- DALI_LOG_ERROR( "ProcessEvents should not be called from within ProcessEvents!\n" );
- mRenderController.RequestProcessEventsOnIdle( false );
+ DALI_LOG_ERROR("ProcessEvents should not be called from within ProcessEvents!\n");
+ mRenderController.RequestProcessEventsOnIdle(false);
return;
}
mProcessingEvent = true;
- mRelayoutController->SetProcessingCoreEvents( true );
+ mRelayoutController->SetProcessingCoreEvents(true);
// Signal that any messages received will be flushed soon
mUpdateManager->EventProcessingStarted();
SceneContainer scenes = mScenes;
// process events in all scenes
- for( auto scene : scenes )
+ for(auto scene : scenes)
{
scene->ProcessEvents();
}
mNotificationManager->ProcessMessages();
// Emit signal here to inform listeners that event processing has finished.
- for( auto scene : scenes )
+ for(auto scene : scenes)
{
scene->EmitEventProcessingFinishedSignal();
}
mRelayoutController->Relayout();
// Rebuild depth tree after event processing has finished
- for( auto scene : scenes )
+ for(auto scene : scenes)
{
scene->RebuildDepthTree();
}
// Check if the next update is forced.
const bool forceUpdate = IsNextUpdateForced();
- if( messagesToProcess || gestureNeedsUpdate || forceUpdate )
+ if(messagesToProcess || gestureNeedsUpdate || forceUpdate)
{
// tell the render controller to keep update thread running
- mRenderController.RequestUpdate( forceUpdate );
+ mRenderController.RequestUpdate(forceUpdate);
}
- mRelayoutController->SetProcessingCoreEvents( false );
+ mRelayoutController->SetProcessingCoreEvents(false);
// ProcessEvents() may now be called again
mProcessingEvent = false;
return MAXIMUM_UPDATE_COUNT;
}
-void Core::RegisterProcessor( Integration::Processor& processor )
+void Core::RegisterProcessor(Integration::Processor& processor)
{
mProcessors.PushBack(&processor);
}
-void Core::UnregisterProcessor( Integration::Processor& processor )
+void Core::UnregisterProcessor(Integration::Processor& processor)
{
- auto iter = std::find( mProcessors.Begin(), mProcessors.End(), &processor );
- if( iter != mProcessors.End() )
+ auto iter = std::find(mProcessors.Begin(), mProcessors.End(), &processor);
+ if(iter != mProcessors.End())
{
- mProcessors.Erase( iter );
+ mProcessors.Erase(iter);
}
}
void Core::RunProcessors()
{
// Copy processor pointers to prevent changes to vector affecting loop iterator.
- Dali::Vector<Integration::Processor*> processors( mProcessors );
+ Dali::Vector<Integration::Processor*> processors(mProcessors);
- for( auto processor : processors )
+ for(auto processor : processors)
{
- if( processor )
+ if(processor)
{
processor->Process();
}
Integration::GlAbstraction& Core::GetGlAbstraction() const
{
- return mGlAbstraction;
+ return mGraphicsController.GetGlAbstraction();
}
-void Core::AddScene( Scene* scene )
+void Core::AddScene(Scene* scene)
{
- mScenes.push_back( scene );
+ mScenes.push_back(scene);
}
-void Core::RemoveScene( Scene* scene )
+void Core::RemoveScene(Scene* scene)
{
- auto iter = std::find( mScenes.begin(), mScenes.end(), scene );
- if( iter != mScenes.end() )
+ auto iter = std::find(mScenes.begin(), mScenes.end(), scene);
+ if(iter != mScenes.end())
{
- mScenes.erase( iter );
+ mScenes.erase(iter);
}
}
tls->Reference();
}
-void Core::RegisterObject( Dali::BaseObject* object )
+void Core::RegisterObject(Dali::BaseObject* object)
{
mObjectRegistry = &ThreadLocalStorage::Get().GetObjectRegistry();
- mObjectRegistry->RegisterObject( object );
+ mObjectRegistry->RegisterObject(object);
}
-void Core::UnregisterObject( Dali::BaseObject* object )
+void Core::UnregisterObject(Dali::BaseObject* object)
{
mObjectRegistry = &ThreadLocalStorage::Get().GetObjectRegistry();
- mObjectRegistry->UnregisterObject( object );
+ mObjectRegistry->UnregisterObject(object);
}
Integration::RenderController& Core::GetRenderController()
return mRenderController;
}
-uint32_t* Core::ReserveMessageSlot( uint32_t size, bool updateScene )
+uint32_t* Core::ReserveMessageSlot(uint32_t size, bool updateScene)
{
- return mUpdateManager->ReserveMessageSlot( size, updateScene );
+ return mUpdateManager->ReserveMessageSlot(size, updateScene);
}
BufferIndex Core::GetEventBufferIndex() const
bool Core::IsNextUpdateForced()
{
bool nextUpdateForced = mForceNextUpdate;
- mForceNextUpdate = false;
+ mForceNextUpdate = false;
return nextUpdateForced;
}
#define DALI_INTERNAL_CORE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/object/ref-object.h>
+#include <dali/devel-api/common/owner-container.h>
#include <dali/integration-api/context-notifier.h>
#include <dali/integration-api/core-enumerations.h>
+#include <dali/integration-api/resource-policies.h>
#include <dali/internal/common/owner-pointer.h>
-#include <dali/devel-api/common/owner-container.h>
#include <dali/internal/event/animation/animation-playlist-declarations.h>
-#include <dali/internal/event/common/stage-def.h>
-#include <dali/integration-api/resource-policies.h>
-#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/common/object-registry-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/common/stage-def.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/object/ref-object.h>
namespace Dali
{
+namespace Graphics
+{
+class Controller;
+}
namespace Integration
{
class Processor;
class RenderController;
class PlatformAbstraction;
-class GlAbstraction;
-class GlSyncAbstraction;
-class GlContextHelperAbstraction;
class UpdateStatus;
class RenderStatus;
struct Event;
struct TouchEvent;
-}
+} // namespace Integration
namespace Internal
{
-
class NotificationManager;
class AnimationPlaylist;
class PropertyNotificationManager;
class RenderManager;
class DiscardQueue;
class RenderTaskProcessor;
-}
+} // namespace SceneGraph
/**
* Internal class for Dali::Integration::Core
class Core : public EventThreadServices
{
public:
-
/**
* Create and initialise a new Core instance
*/
- Core( Integration::RenderController& renderController,
- Integration::PlatformAbstraction& platform,
- Integration::GlAbstraction& glAbstraction,
- Integration::GlSyncAbstraction& glSyncAbstraction,
- Integration::GlContextHelperAbstraction& glContextHelperAbstraction,
- Integration::RenderToFrameBuffer renderToFboEnabled,
- Integration::DepthBufferAvailable depthBufferAvailable,
- Integration::StencilBufferAvailable stencilBufferAvailable,
- Integration::PartialUpdateAvailable partialUpdateAvailable );
+ Core(Integration::RenderController& renderController,
+ Integration::PlatformAbstraction& platform,
+ Graphics::Controller& graphicsController,
+ Integration::RenderToFrameBuffer renderToFboEnabled,
+ Integration::DepthBufferAvailable depthBufferAvailable,
+ Integration::StencilBufferAvailable stencilBufferAvailable,
+ Integration::PartialUpdateAvailable partialUpdateAvailable);
/**
* Destructor
/**
* @copydoc Dali::Integration::Core::Update()
*/
- void Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo );
+ void Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo);
/**
* @copydoc Dali::Integration::Core::PreRender()
*/
- void PreRender( Integration::RenderStatus& status, bool forceClear, bool uploadOnly );
+ void PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly);
/**
* @copydoc Dali::Integration::Core::PreRender()
*/
- void PreRender( Integration::Scene& scene, std::vector<Rect<int>>& damagedRects );
+ void PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects);
/**
* @copydoc Dali::Integration::Core::RenderScene()
*/
- void RenderScene( Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo );
+ void RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo);
/**
* @copydoc Dali::Integration::Core::RenderScene()
*/
- void RenderScene( Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect );
+ void RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect);
/**
* @copydoc Dali::Integration::Core::Render()
*/
- void PostRender( bool uploadOnly );
+ void PostRender(bool uploadOnly);
/**
* @copydoc Dali::Integration::Core::SceneCreated()
/**
* @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
*/
- void QueueEvent( const Integration::Event& event );
+ void QueueEvent(const Integration::Event& event);
/**
* @copydoc Dali::Integration::Core::ProcessEvents()
/**
* @copydoc Dali::Integration::Core::RegisterProcessor
*/
- void RegisterProcessor( Dali::Integration::Processor& processor );
+ void RegisterProcessor(Dali::Integration::Processor& processor);
/**
* @copydoc Dali::Integration::Core::UnregisterProcessor
*/
- void UnregisterProcessor( Dali::Integration::Processor& processor );
+ void UnregisterProcessor(Dali::Integration::Processor& processor);
/**
* @copydoc Dali::Internal::ThreadLocalStorage::AddScene()
*/
- void AddScene( Scene* scene );
+ void AddScene(Scene* scene);
/**
* @copydoc Dali::Internal::ThreadLocalStorage::RemoveScene()
*/
- void RemoveScene( Scene* scene );
+ void RemoveScene(Scene* scene);
/**
* @brief Gets the Object registry.
ObjectRegistry& GetObjectRegistry() const;
public: // Implementation of EventThreadServices
-
/**
* @copydoc EventThreadServices::RegisterObject
*/
- void RegisterObject( BaseObject* object) override;
+ void RegisterObject(BaseObject* object) override;
/**
* @copydoc EventThreadServices::UnregisterObject
*/
- void UnregisterObject( BaseObject* object) override;
+ void UnregisterObject(BaseObject* object) override;
/**
* @copydoc EventThreadServices::GetUpdateManager
/**
* @copydoc EventThreadServices::ReserveMessageSlot
*/
- uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene ) override;
+ uint32_t* ReserveMessageSlot(uint32_t size, bool updateScene) override;
/**
* @copydoc EventThreadServices::GetEventBufferIndex
bool IsNextUpdateForced() override;
private:
-
/**
* Run each registered processor
*/
Integration::GlAbstraction& GetGlAbstraction() const;
private:
-
/**
* Undefined copy and assignment operators
*/
- Core(const Core& core) = delete; // No definition
- Core& operator=(const Core& core) = delete; // No definition
+ Core(const Core& core) = delete; // No definition
+ Core& operator=(const Core& core) = delete; // No definition
/**
* Create Thread local storage
void CreateThreadLocalStorage();
private:
-
- Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
- Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
+ Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
+ Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
IntrusivePtr<Stage> mStage; ///< The current stage
AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
- IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
+ IntrusivePtr<RelayoutController> mRelayoutController; ///< Size negotiation relayout controller
- OwnerPointer<SceneGraph::RenderTaskProcessor> mRenderTaskProcessor; ///< Handles the processing of render tasks
- OwnerPointer<SceneGraph::RenderManager> mRenderManager; ///< Render manager
- OwnerPointer<SceneGraph::UpdateManager> mUpdateManager; ///< Update manager
- OwnerPointer<SceneGraph::DiscardQueue> mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
- OwnerPointer<ShaderFactory> mShaderFactory; ///< Shader resource factory
- OwnerPointer<NotificationManager> mNotificationManager; ///< Notification manager
- OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
- Dali::Vector<Integration::Processor*> mProcessors; ///< Registered processors (not owned)
+ OwnerPointer<SceneGraph::RenderTaskProcessor> mRenderTaskProcessor; ///< Handles the processing of render tasks
+ OwnerPointer<SceneGraph::RenderManager> mRenderManager; ///< Render manager
+ OwnerPointer<SceneGraph::UpdateManager> mUpdateManager; ///< Update manager
+ OwnerPointer<SceneGraph::DiscardQueue> mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
+ OwnerPointer<ShaderFactory> mShaderFactory; ///< Shader resource factory
+ OwnerPointer<NotificationManager> mNotificationManager; ///< Notification manager
+ OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
+ Dali::Vector<Integration::Processor*> mProcessors; ///< Registered processors (not owned)
using SceneContainer = std::vector<ScenePtr>;
- SceneContainer mScenes; ///< A container of scenes that bound to a surface for rendering, owned by Core
+ SceneContainer mScenes; ///< A container of scenes that bound to a surface for rendering, owned by Core
// The object registry
- ObjectRegistryPtr mObjectRegistry;
+ ObjectRegistryPtr mObjectRegistry;
- // GlAbstraction for capabilities of GL
- // Not to use this for bypass Context.
- Integration::GlAbstraction& mGlAbstraction;
+ Graphics::Controller& mGraphicsController;
- bool mProcessingEvent : 1; ///< True during ProcessEvents()
- bool mForceNextUpdate:1; ///< True if the next rendering is really required.
+ bool mProcessingEvent : 1; ///< True during ProcessEvents()
+ bool mForceNextUpdate : 1; ///< True if the next rendering is really required.
friend class ThreadLocalStorage;
-
};
} // namespace Internal
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
namespace Dali
{
-
namespace Internal
{
-
namespace SceneGraph
{
-
#if defined(DEBUG_ENABLED)
namespace
{
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_RENDER_MANAGER" );
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_RENDER_MANAGER");
} // unnamed namespace
#endif
*/
struct RenderManager::Impl
{
- Impl( Integration::GlAbstraction& glAbstraction,
- Integration::GlSyncAbstraction& glSyncAbstraction,
- Integration::GlContextHelperAbstraction& glContextHelperAbstraction,
- Integration::DepthBufferAvailable depthBufferAvailableParam,
- Integration::StencilBufferAvailable stencilBufferAvailableParam,
- Integration::PartialUpdateAvailable partialUpdateAvailableParam )
- : context( glAbstraction, &sceneContextContainer ),
- currentContext( &context ),
- glAbstraction( glAbstraction ),
- glSyncAbstraction( glSyncAbstraction ),
- glContextHelperAbstraction( glContextHelperAbstraction ),
+ Impl(Graphics::Controller& graphicsController,
+ Integration::DepthBufferAvailable depthBufferAvailableParam,
+ Integration::StencilBufferAvailable stencilBufferAvailableParam,
+ Integration::PartialUpdateAvailable partialUpdateAvailableParam)
+ : context(graphicsController.GetGlAbstraction(), &sceneContextContainer),
+ currentContext(&context),
+ graphicsController(graphicsController),
renderQueue(),
renderAlgorithms(),
- frameCount( 0u ),
- renderBufferIndex( SceneGraphBuffers::INITIAL_UPDATE_BUFFER_INDEX ),
+ frameCount(0u),
+ renderBufferIndex(SceneGraphBuffers::INITIAL_UPDATE_BUFFER_INDEX),
defaultSurfaceRect(),
rendererContainer(),
samplerContainer(),
textureContainer(),
frameBufferContainer(),
- lastFrameWasRendered( false ),
- programController( glAbstraction ),
- depthBufferAvailable( depthBufferAvailableParam ),
- stencilBufferAvailable( stencilBufferAvailableParam ),
- partialUpdateAvailable( partialUpdateAvailableParam ),
+ lastFrameWasRendered(false),
+ programController(graphicsController),
+ depthBufferAvailable(depthBufferAvailableParam),
+ stencilBufferAvailable(stencilBufferAvailableParam),
+ partialUpdateAvailable(partialUpdateAvailableParam),
defaultSurfaceOrientation(0)
{
- // Create thread pool with just one thread ( there may be a need to create more threads in the future ).
- threadPool = std::unique_ptr<Dali::ThreadPool>( new Dali::ThreadPool() );
- threadPool->Initialize( 1u );
+ // Create thread pool with just one thread ( there may be a need to create more threads in the future ).
+ threadPool = std::unique_ptr<Dali::ThreadPool>(new Dali::ThreadPool());
+ threadPool->Initialize(1u);
}
~Impl()
{
- threadPool.reset( nullptr ); // reset now to maintain correct destruction order
+ threadPool.reset(nullptr); // reset now to maintain correct destruction order
}
- void AddRenderTracker( Render::RenderTracker* renderTracker )
+ void AddRenderTracker(Render::RenderTracker* renderTracker)
{
- DALI_ASSERT_DEBUG( renderTracker != NULL );
- mRenderTrackers.PushBack( renderTracker );
+ DALI_ASSERT_DEBUG(renderTracker != NULL);
+ mRenderTrackers.PushBack(renderTracker);
}
- void RemoveRenderTracker( Render::RenderTracker* renderTracker )
+ void RemoveRenderTracker(Render::RenderTracker* renderTracker)
{
- mRenderTrackers.EraseObject( renderTracker );
+ mRenderTrackers.EraseObject(renderTracker);
}
Context* CreateSceneContext()
{
- Context* context = new Context( glAbstraction );
- sceneContextContainer.PushBack( context );
+ Context* context = new Context(graphicsController.GetGlAbstraction());
+ sceneContextContainer.PushBack(context);
return context;
}
- void DestroySceneContext( Context* sceneContext )
+ void DestroySceneContext(Context* sceneContext)
{
- auto iter = std::find( sceneContextContainer.Begin(), sceneContextContainer.End(), sceneContext );
- if( iter != sceneContextContainer.End() )
+ auto iter = std::find(sceneContextContainer.Begin(), sceneContextContainer.End(), sceneContext);
+ if(iter != sceneContextContainer.End())
{
- ( *iter )->GlContextDestroyed();
- sceneContextContainer.Erase( iter );
+ (*iter)->GlContextDestroyed();
+ sceneContextContainer.Erase(iter);
}
}
- Context* ReplaceSceneContext( Context* oldSceneContext )
+ Context* ReplaceSceneContext(Context* oldSceneContext)
{
- Context* newContext = new Context( glAbstraction );
+ Context* newContext = new Context(graphicsController.GetGlAbstraction());
oldSceneContext->GlContextDestroyed();
- std::replace( sceneContextContainer.begin(), sceneContextContainer.end(), oldSceneContext, newContext );
+ std::replace(sceneContextContainer.begin(), sceneContextContainer.end(), oldSceneContext, newContext);
return newContext;
}
void UpdateTrackers()
{
- for( auto&& iter : mRenderTrackers )
+ for(auto&& iter : mRenderTrackers)
{
iter->PollSyncObject();
}
// the order is important for destruction,
// programs are owned by context at the moment.
- Context context; ///< Holds the GL state of the share resource context
- Context* currentContext; ///< Holds the GL state of the current context for rendering
- OwnerContainer< Context* > sceneContextContainer; ///< List of owned contexts holding the GL state per scene
- Integration::GlAbstraction& glAbstraction; ///< GL abstraction
- Integration::GlSyncAbstraction& glSyncAbstraction; ///< GL sync abstraction
- Integration::GlContextHelperAbstraction& glContextHelperAbstraction; ///< GL context helper abstraction
- RenderQueue renderQueue; ///< A message queue for receiving messages from the update-thread.
-
- std::vector< SceneGraph::Scene* > sceneContainer; ///< List of pointers to the scene graph objects of the scenes
+ Context context; ///< Holds the GL state of the share resource context
+ Context* currentContext; ///< Holds the GL state of the current context for rendering
+ OwnerContainer<Context*> sceneContextContainer; ///< List of owned contexts holding the GL state per scene
+ Graphics::Controller& graphicsController;
+ RenderQueue renderQueue; ///< A message queue for receiving messages from the update-thread.
- Render::RenderAlgorithms renderAlgorithms; ///< The RenderAlgorithms object is used to action the renders required by a RenderInstruction
+ std::vector<SceneGraph::Scene*> sceneContainer; ///< List of pointers to the scene graph objects of the scenes
- uint32_t frameCount; ///< The current frame count
- BufferIndex renderBufferIndex; ///< The index of the buffer to read from; this is opposite of the "update" buffer
+ Render::RenderAlgorithms renderAlgorithms; ///< The RenderAlgorithms object is used to action the renders required by a RenderInstruction
- Rect<int32_t> defaultSurfaceRect; ///< Rectangle for the default surface we are rendering to
+ uint32_t frameCount; ///< The current frame count
+ BufferIndex renderBufferIndex; ///< The index of the buffer to read from; this is opposite of the "update" buffer
- OwnerContainer< Render::Renderer* > rendererContainer; ///< List of owned renderers
- OwnerContainer< Render::Sampler* > samplerContainer; ///< List of owned samplers
- OwnerContainer< Render::Texture* > textureContainer; ///< List of owned textures
- OwnerContainer< Render::FrameBuffer* > frameBufferContainer; ///< List of owned framebuffers
- OwnerContainer< Render::VertexBuffer* > vertexBufferContainer; ///< List of owned vertex buffers
- OwnerContainer< Render::Geometry* > geometryContainer; ///< List of owned Geometries
+ Rect<int32_t> defaultSurfaceRect; ///< Rectangle for the default surface we are rendering to
- bool lastFrameWasRendered; ///< Keeps track of the last frame being rendered due to having render instructions
+ OwnerContainer<Render::Renderer*> rendererContainer; ///< List of owned renderers
+ OwnerContainer<Render::Sampler*> samplerContainer; ///< List of owned samplers
+ OwnerContainer<Render::Texture*> textureContainer; ///< List of owned textures
+ OwnerContainer<Render::FrameBuffer*> frameBufferContainer; ///< List of owned framebuffers
+ OwnerContainer<Render::VertexBuffer*> vertexBufferContainer; ///< List of owned vertex buffers
+ OwnerContainer<Render::Geometry*> geometryContainer; ///< List of owned Geometries
- OwnerContainer< Render::RenderTracker* > mRenderTrackers; ///< List of render trackers
+ bool lastFrameWasRendered; ///< Keeps track of the last frame being rendered due to having render instructions
- ProgramController programController; ///< Owner of the GL programs
+ OwnerContainer<Render::RenderTracker*> mRenderTrackers; ///< List of render trackers
- Integration::DepthBufferAvailable depthBufferAvailable; ///< Whether the depth buffer is available
- Integration::StencilBufferAvailable stencilBufferAvailable; ///< Whether the stencil buffer is available
- Integration::PartialUpdateAvailable partialUpdateAvailable; ///< Whether the partial update is available
+ ProgramController programController; ///< Owner of the GL programs
- std::unique_ptr<Dali::ThreadPool> threadPool; ///< The thread pool
- Vector<GLuint> boundTextures; ///< The textures bound for rendering
- Vector<GLuint> textureDependencyList; ///< The dependency list of binded textures
+ Integration::DepthBufferAvailable depthBufferAvailable; ///< Whether the depth buffer is available
+ Integration::StencilBufferAvailable stencilBufferAvailable; ///< Whether the stencil buffer is available
+ Integration::PartialUpdateAvailable partialUpdateAvailable; ///< Whether the partial update is available
- int defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to
+ std::unique_ptr<Dali::ThreadPool> threadPool; ///< The thread pool
+ Vector<GLuint> boundTextures; ///< The textures bound for rendering
+ Vector<GLuint> textureDependencyList; ///< The dependency list of binded textures
+ int defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to
};
-RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction,
- Integration::GlSyncAbstraction& glSyncAbstraction,
- Integration::GlContextHelperAbstraction& glContextHelperAbstraction,
- Integration::DepthBufferAvailable depthBufferAvailable,
- Integration::StencilBufferAvailable stencilBufferAvailable,
- Integration::PartialUpdateAvailable partialUpdateAvailable )
+RenderManager* RenderManager::New(Graphics::Controller& graphicsController,
+ Integration::DepthBufferAvailable depthBufferAvailable,
+ Integration::StencilBufferAvailable stencilBufferAvailable,
+ Integration::PartialUpdateAvailable partialUpdateAvailable)
{
RenderManager* manager = new RenderManager;
- manager->mImpl = new Impl( glAbstraction,
- glSyncAbstraction,
- glContextHelperAbstraction,
- depthBufferAvailable,
- stencilBufferAvailable,
- partialUpdateAvailable );
+ manager->mImpl = new Impl(graphicsController,
+ depthBufferAvailable,
+ stencilBufferAvailable,
+ partialUpdateAvailable);
return manager;
}
mImpl->programController.GlContextDestroyed();
//Inform textures
- for( auto&& texture : mImpl->textureContainer )
+ for(auto&& texture : mImpl->textureContainer)
{
texture->GlContextDestroyed();
}
//Inform framebuffers
- for( auto&& framebuffer : mImpl->frameBufferContainer )
+ for(auto&& framebuffer : mImpl->frameBufferContainer)
{
framebuffer->GlContextDestroyed();
}
// inform renderers
- for( auto&& renderer : mImpl->rendererContainer )
+ for(auto&& renderer : mImpl->rendererContainer)
{
renderer->GlContextDestroyed();
}
// inform context
- for( auto&& context : mImpl->sceneContextContainer )
+ for(auto&& context : mImpl->sceneContextContainer)
{
context->GlContextDestroyed();
}
}
-void RenderManager::SetShaderSaver( ShaderSaver& upstream )
+void RenderManager::SetShaderSaver(ShaderSaver& upstream)
{
- mImpl->programController.SetShaderSaver( upstream );
+ mImpl->programController.SetShaderSaver(upstream);
}
void RenderManager::SetDefaultSurfaceRect(const Rect<int32_t>& rect)
mImpl->defaultSurfaceOrientation = orientation;
}
-void RenderManager::AddRenderer( OwnerPointer< Render::Renderer >& renderer )
+void RenderManager::AddRenderer(OwnerPointer<Render::Renderer>& renderer)
{
// Initialize the renderer as we are now in render thread
- renderer->Initialize( mImpl->context );
+ renderer->Initialize(mImpl->context);
- mImpl->rendererContainer.PushBack( renderer.Release() );
+ mImpl->rendererContainer.PushBack(renderer.Release());
}
-void RenderManager::RemoveRenderer( Render::Renderer* renderer )
+void RenderManager::RemoveRenderer(Render::Renderer* renderer)
{
- mImpl->rendererContainer.EraseObject( renderer );
+ mImpl->rendererContainer.EraseObject(renderer);
}
-void RenderManager::AddSampler( OwnerPointer< Render::Sampler >& sampler )
+void RenderManager::AddSampler(OwnerPointer<Render::Sampler>& sampler)
{
- mImpl->samplerContainer.PushBack( sampler.Release() );
+ mImpl->samplerContainer.PushBack(sampler.Release());
}
-void RenderManager::RemoveSampler( Render::Sampler* sampler )
+void RenderManager::RemoveSampler(Render::Sampler* sampler)
{
- mImpl->samplerContainer.EraseObject( sampler );
+ mImpl->samplerContainer.EraseObject(sampler);
}
-void RenderManager::AddTexture( OwnerPointer< Render::Texture >& texture )
+void RenderManager::AddTexture(OwnerPointer<Render::Texture>& texture)
{
- texture->Initialize( mImpl->context );
- mImpl->textureContainer.PushBack( texture.Release() );
+ texture->Initialize(mImpl->context);
+ mImpl->textureContainer.PushBack(texture.Release());
}
-void RenderManager::RemoveTexture( Render::Texture* texture )
+void RenderManager::RemoveTexture(Render::Texture* texture)
{
- DALI_ASSERT_DEBUG( NULL != texture );
+ DALI_ASSERT_DEBUG(NULL != texture);
// Find the texture, use reference to pointer so we can do the erase safely
- for ( auto&& iter : mImpl->textureContainer )
+ for(auto&& iter : mImpl->textureContainer)
{
- if ( iter == texture )
+ if(iter == texture)
{
- texture->Destroy( mImpl->context );
- mImpl->textureContainer.Erase( &iter ); // Texture found; now destroy it
+ texture->Destroy(mImpl->context);
+ mImpl->textureContainer.Erase(&iter); // Texture found; now destroy it
return;
}
}
}
-void RenderManager::UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
+void RenderManager::UploadTexture(Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params)
{
- texture->Upload( mImpl->context, pixelData, params );
+ texture->Upload(mImpl->context, pixelData, params);
}
-void RenderManager::GenerateMipmaps( Render::Texture* texture )
+void RenderManager::GenerateMipmaps(Render::Texture* texture)
{
- texture->GenerateMipmaps( mImpl->context );
+ texture->GenerateMipmaps(mImpl->context);
}
-void RenderManager::SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode )
+void RenderManager::SetFilterMode(Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode)
{
- sampler->mMinificationFilter = static_cast<Dali::FilterMode::Type>(minFilterMode);
- sampler->mMagnificationFilter = static_cast<Dali::FilterMode::Type>(magFilterMode );
+ sampler->mMinificationFilter = static_cast<Dali::FilterMode::Type>(minFilterMode);
+ sampler->mMagnificationFilter = static_cast<Dali::FilterMode::Type>(magFilterMode);
}
-void RenderManager::SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode )
+void RenderManager::SetWrapMode(Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode)
{
sampler->mRWrapMode = static_cast<Dali::WrapMode::Type>(rWrapMode);
sampler->mSWrapMode = static_cast<Dali::WrapMode::Type>(sWrapMode);
sampler->mTWrapMode = static_cast<Dali::WrapMode::Type>(tWrapMode);
}
-void RenderManager::AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer )
+void RenderManager::AddFrameBuffer(OwnerPointer<Render::FrameBuffer>& frameBuffer)
{
Render::FrameBuffer* frameBufferPtr = frameBuffer.Release();
- mImpl->frameBufferContainer.PushBack( frameBufferPtr );
- frameBufferPtr->Initialize( mImpl->context );
+ mImpl->frameBufferContainer.PushBack(frameBufferPtr);
+ frameBufferPtr->Initialize(mImpl->context);
}
-void RenderManager::RemoveFrameBuffer( Render::FrameBuffer* frameBuffer )
+void RenderManager::RemoveFrameBuffer(Render::FrameBuffer* frameBuffer)
{
- DALI_ASSERT_DEBUG( NULL != frameBuffer );
+ DALI_ASSERT_DEBUG(NULL != frameBuffer);
// Find the sampler, use reference so we can safely do the erase
- for ( auto&& iter : mImpl->frameBufferContainer )
+ for(auto&& iter : mImpl->frameBufferContainer)
{
- if ( iter == frameBuffer )
+ if(iter == frameBuffer)
{
- frameBuffer->Destroy( mImpl->context );
- mImpl->frameBufferContainer.Erase( &iter ); // frameBuffer found; now destroy it
+ frameBuffer->Destroy(mImpl->context);
+ mImpl->frameBufferContainer.Erase(&iter); // frameBuffer found; now destroy it
break;
}
}
}
-void RenderManager::InitializeScene( SceneGraph::Scene* scene )
+void RenderManager::InitializeScene(SceneGraph::Scene* scene)
{
- scene->Initialize( *mImpl->CreateSceneContext() );
- mImpl->sceneContainer.push_back( scene );
+ scene->Initialize(*mImpl->CreateSceneContext());
+ mImpl->sceneContainer.push_back(scene);
}
-void RenderManager::UninitializeScene( SceneGraph::Scene* scene )
+void RenderManager::UninitializeScene(SceneGraph::Scene* scene)
{
- mImpl->DestroySceneContext( scene->GetContext() );
+ mImpl->DestroySceneContext(scene->GetContext());
- auto iter = std::find( mImpl->sceneContainer.begin(), mImpl->sceneContainer.end(), scene );
- if( iter != mImpl->sceneContainer.end() )
+ auto iter = std::find(mImpl->sceneContainer.begin(), mImpl->sceneContainer.end(), scene);
+ if(iter != mImpl->sceneContainer.end())
{
- mImpl->sceneContainer.erase( iter );
+ mImpl->sceneContainer.erase(iter);
}
}
-void RenderManager::SurfaceReplaced( SceneGraph::Scene* scene )
+void RenderManager::SurfaceReplaced(SceneGraph::Scene* scene)
{
- Context* newContext = mImpl->ReplaceSceneContext( scene->GetContext() );
- scene->Initialize( *newContext );
+ Context* newContext = mImpl->ReplaceSceneContext(scene->GetContext());
+ scene->Initialize(*newContext);
}
-void RenderManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
+void RenderManager::AttachColorTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer)
{
- frameBuffer->AttachColorTexture( mImpl->context, texture, mipmapLevel, layer );
+ frameBuffer->AttachColorTexture(mImpl->context, texture, mipmapLevel, layer);
}
-void RenderManager::AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+void RenderManager::AttachDepthTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
{
- frameBuffer->AttachDepthTexture( mImpl->context, texture, mipmapLevel );
+ frameBuffer->AttachDepthTexture(mImpl->context, texture, mipmapLevel);
}
-void RenderManager::AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+void RenderManager::AttachDepthStencilTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
{
- frameBuffer->AttachDepthStencilTexture( mImpl->context, texture, mipmapLevel );
+ frameBuffer->AttachDepthStencilTexture(mImpl->context, texture, mipmapLevel);
}
-void RenderManager::AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& vertexBuffer )
+void RenderManager::AddVertexBuffer(OwnerPointer<Render::VertexBuffer>& vertexBuffer)
{
- mImpl->vertexBufferContainer.PushBack( vertexBuffer.Release() );
+ mImpl->vertexBufferContainer.PushBack(vertexBuffer.Release());
}
-void RenderManager::RemoveVertexBuffer( Render::VertexBuffer* vertexBuffer )
+void RenderManager::RemoveVertexBuffer(Render::VertexBuffer* vertexBuffer)
{
- mImpl->vertexBufferContainer.EraseObject( vertexBuffer );
+ mImpl->vertexBufferContainer.EraseObject(vertexBuffer);
}
-void RenderManager::SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format )
+void RenderManager::SetVertexBufferFormat(Render::VertexBuffer* vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format)
{
- vertexBuffer->SetFormat( format.Release() );
+ vertexBuffer->SetFormat(format.Release());
}
-void RenderManager::SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size )
+void RenderManager::SetVertexBufferData(Render::VertexBuffer* vertexBuffer, OwnerPointer<Vector<uint8_t>>& data, uint32_t size)
{
- vertexBuffer->SetData( data.Release(), size );
+ vertexBuffer->SetData(data.Release(), size);
}
-void RenderManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& indices )
+void RenderManager::SetIndexBuffer(Render::Geometry* geometry, Dali::Vector<uint16_t>& indices)
{
- geometry->SetIndexBuffer( indices );
+ geometry->SetIndexBuffer(indices);
}
-void RenderManager::AddGeometry( OwnerPointer< Render::Geometry >& geometry )
+void RenderManager::AddGeometry(OwnerPointer<Render::Geometry>& geometry)
{
- mImpl->geometryContainer.PushBack( geometry.Release() );
+ mImpl->geometryContainer.PushBack(geometry.Release());
}
-void RenderManager::RemoveGeometry( Render::Geometry* geometry )
+void RenderManager::RemoveGeometry(Render::Geometry* geometry)
{
- mImpl->geometryContainer.EraseObject( geometry );
+ mImpl->geometryContainer.EraseObject(geometry);
}
-void RenderManager::AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer )
+void RenderManager::AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer)
{
- DALI_ASSERT_DEBUG( NULL != geometry );
+ DALI_ASSERT_DEBUG(NULL != geometry);
// Find the geometry
- for ( auto&& iter : mImpl->geometryContainer )
+ for(auto&& iter : mImpl->geometryContainer)
{
- if ( iter == geometry )
+ if(iter == geometry)
{
- iter->AddVertexBuffer( vertexBuffer );
+ iter->AddVertexBuffer(vertexBuffer);
break;
}
}
}
-void RenderManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer )
+void RenderManager::RemoveVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer)
{
- DALI_ASSERT_DEBUG( NULL != geometry );
+ DALI_ASSERT_DEBUG(NULL != geometry);
// Find the geometry
- for ( auto&& iter : mImpl->geometryContainer )
+ for(auto&& iter : mImpl->geometryContainer)
{
- if ( iter == geometry )
+ if(iter == geometry)
{
- iter->RemoveVertexBuffer( vertexBuffer );
+ iter->RemoveVertexBuffer(vertexBuffer);
break;
}
}
}
-void RenderManager::SetGeometryType( Render::Geometry* geometry, uint32_t geometryType )
+void RenderManager::SetGeometryType(Render::Geometry* geometry, uint32_t geometryType)
{
- geometry->SetType( Render::Geometry::Type(geometryType) );
+ geometry->SetType(Render::Geometry::Type(geometryType));
}
-void RenderManager::AddRenderTracker( Render::RenderTracker* renderTracker )
+void RenderManager::AddRenderTracker(Render::RenderTracker* renderTracker)
{
mImpl->AddRenderTracker(renderTracker);
}
-void RenderManager::RemoveRenderTracker( Render::RenderTracker* renderTracker )
+void RenderManager::RemoveRenderTracker(Render::RenderTracker* renderTracker)
{
mImpl->RemoveRenderTracker(renderTracker);
}
return &(mImpl->programController);
}
-void RenderManager::PreRender( Integration::RenderStatus& status, bool forceClear, bool uploadOnly )
+void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly)
{
- DALI_PRINT_RENDER_START( mImpl->renderBufferIndex );
+ DALI_PRINT_RENDER_START(mImpl->renderBufferIndex);
// Core::Render documents that GL context must be current before calling Render
- DALI_ASSERT_DEBUG( mImpl->context.IsGlContextCreated() );
+ DALI_ASSERT_DEBUG(mImpl->context.IsGlContextCreated());
// Increment the frame count at the beginning of each frame
++mImpl->frameCount;
// Process messages queued during previous update
- mImpl->renderQueue.ProcessMessages( mImpl->renderBufferIndex );
+ mImpl->renderQueue.ProcessMessages(mImpl->renderBufferIndex);
uint32_t count = 0u;
- for( uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i )
+ for(uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i)
{
- count += mImpl->sceneContainer[i]->GetRenderInstructions().Count( mImpl->renderBufferIndex );
+ count += mImpl->sceneContainer[i]->GetRenderInstructions().Count(mImpl->renderBufferIndex);
}
const bool haveInstructions = count > 0u;
- DALI_LOG_INFO( gLogFilter, Debug::General,
- "Render: haveInstructions(%s) || mImpl->lastFrameWasRendered(%s) || forceClear(%s)\n",
- haveInstructions ? "true" : "false",
- mImpl->lastFrameWasRendered ? "true" : "false",
- forceClear ? "true" : "false" );
+ DALI_LOG_INFO(gLogFilter, Debug::General, "Render: haveInstructions(%s) || mImpl->lastFrameWasRendered(%s) || forceClear(%s)\n", haveInstructions ? "true" : "false", mImpl->lastFrameWasRendered ? "true" : "false", forceClear ? "true" : "false");
// Only render if we have instructions to render, or the last frame was rendered (and therefore a clear is required).
- if( haveInstructions || mImpl->lastFrameWasRendered || forceClear )
+ if(haveInstructions || mImpl->lastFrameWasRendered || forceClear)
{
- DALI_LOG_INFO( gLogFilter, Debug::General, "Render: Processing\n" );
+ DALI_LOG_INFO(gLogFilter, Debug::General, "Render: Processing\n");
// Switch to the shared context
- if ( mImpl->currentContext != &mImpl->context )
+ if(mImpl->currentContext != &mImpl->context)
{
mImpl->currentContext = &mImpl->context;
- if ( mImpl->currentContext->IsSurfacelessContextSupported() )
+ if(mImpl->currentContext->IsSurfacelessContextSupported())
{
- mImpl->glContextHelperAbstraction.MakeSurfacelessContextCurrent();
+ mImpl->graphicsController.GetGlContextHelperAbstraction().MakeSurfacelessContextCurrent();
}
// Clear the current cached program when the context is switched
}
// Upload the geometries
- for( uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i )
+ for(uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i)
{
RenderInstructionContainer& instructions = mImpl->sceneContainer[i]->GetRenderInstructions();
- for ( uint32_t j = 0; j < instructions.Count( mImpl->renderBufferIndex ); ++j )
+ for(uint32_t j = 0; j < instructions.Count(mImpl->renderBufferIndex); ++j)
{
- RenderInstruction& instruction = instructions.At( mImpl->renderBufferIndex, j );
+ RenderInstruction& instruction = instructions.At(mImpl->renderBufferIndex, j);
- const Matrix* viewMatrix = instruction.GetViewMatrix( mImpl->renderBufferIndex );
- const Matrix* projectionMatrix = instruction.GetProjectionMatrix( mImpl->renderBufferIndex );
+ const Matrix* viewMatrix = instruction.GetViewMatrix(mImpl->renderBufferIndex);
+ const Matrix* projectionMatrix = instruction.GetProjectionMatrix(mImpl->renderBufferIndex);
- DALI_ASSERT_DEBUG( viewMatrix );
- DALI_ASSERT_DEBUG( projectionMatrix );
+ DALI_ASSERT_DEBUG(viewMatrix);
+ DALI_ASSERT_DEBUG(projectionMatrix);
- if( viewMatrix && projectionMatrix )
+ if(viewMatrix && projectionMatrix)
{
const RenderListContainer::SizeType renderListCount = instruction.RenderListCount();
// Iterate through each render list.
- for( RenderListContainer::SizeType index = 0; index < renderListCount; ++index )
+ for(RenderListContainer::SizeType index = 0; index < renderListCount; ++index)
{
- const RenderList* renderList = instruction.GetRenderList( index );
+ const RenderList* renderList = instruction.GetRenderList(index);
- if( renderList && !renderList->IsEmpty() )
+ if(renderList && !renderList->IsEmpty())
{
const std::size_t itemCount = renderList->Count();
- for( uint32_t itemIndex = 0u; itemIndex < itemCount; ++itemIndex )
+ for(uint32_t itemIndex = 0u; itemIndex < itemCount; ++itemIndex)
{
- const RenderItem& item = renderList->GetItem( itemIndex );
- if( DALI_LIKELY( item.mRenderer ) )
+ const RenderItem& item = renderList->GetItem(itemIndex);
+ if(DALI_LIKELY(item.mRenderer))
{
- item.mRenderer->Upload( *mImpl->currentContext );
+ item.mRenderer->Upload(*mImpl->currentContext);
}
}
}
}
}
-void RenderManager::PreRender( Integration::Scene& scene, std::vector<Rect<int>>& damagedRects )
+void RenderManager::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
{
- if (mImpl->partialUpdateAvailable != Integration::PartialUpdateAvailable::TRUE)
+ if(mImpl->partialUpdateAvailable != Integration::PartialUpdateAvailable::TRUE)
{
return;
}
- Internal::Scene& sceneInternal = GetImplementation(scene);
- SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject();
+ Internal::Scene& sceneInternal = GetImplementation(scene);
+ SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject();
- if( sceneObject->IsRenderingSkipped() )
+ if(sceneObject->IsRenderingSkipped())
{
// We don't need to calculate dirty rects
return;
~DamagedRectsCleaner()
{
- if (mCleanOnReturn)
+ if(mCleanOnReturn)
{
mDamagedRects.clear();
}
private:
std::vector<Rect<int>>& mDamagedRects;
- bool mCleanOnReturn;
+ bool mCleanOnReturn;
};
- Rect<int32_t> surfaceRect = Rect<int32_t>(0, 0, static_cast<int32_t>( scene.GetSize().width ), static_cast<int32_t>( scene.GetSize().height ));
+ Rect<int32_t> surfaceRect = Rect<int32_t>(0, 0, static_cast<int32_t>(scene.GetSize().width), static_cast<int32_t>(scene.GetSize().height));
// Clean collected dirty/damaged rects on exit if 3d layer or 3d node or other conditions.
DamagedRectsCleaner damagedRectCleaner(damagedRects);
// Mark previous dirty rects in the sorted array. The array is already sorted by node and renderer, frame number.
// so you don't need to sort: std::stable_sort(itemsDirtyRects.begin(), itemsDirtyRects.end());
std::vector<DirtyRect>& itemsDirtyRects = sceneInternal.GetItemsDirtyRects();
- for (DirtyRect& dirtyRect : itemsDirtyRects)
+ for(DirtyRect& dirtyRect : itemsDirtyRects)
{
dirtyRect.visited = false;
}
- uint32_t count = sceneObject->GetRenderInstructions().Count( mImpl->renderBufferIndex );
- for (uint32_t i = 0; i < count; ++i)
+ uint32_t count = sceneObject->GetRenderInstructions().Count(mImpl->renderBufferIndex);
+ for(uint32_t i = 0; i < count; ++i)
{
- RenderInstruction& instruction = sceneObject->GetRenderInstructions().At( mImpl->renderBufferIndex, i );
+ RenderInstruction& instruction = sceneObject->GetRenderInstructions().At(mImpl->renderBufferIndex, i);
- if (instruction.mFrameBuffer)
+ if(instruction.mFrameBuffer)
{
return; // TODO: reset, we don't deal with render tasks with framebuffers (for now)
}
const Camera* camera = instruction.GetCamera();
- if (camera->mType == Camera::DEFAULT_TYPE && camera->mTargetPosition == Camera::DEFAULT_TARGET_POSITION)
+ if(camera->mType == Camera::DEFAULT_TYPE && camera->mTargetPosition == Camera::DEFAULT_TARGET_POSITION)
{
const Node* node = instruction.GetCamera()->GetNode();
- if (node)
+ if(node)
{
- Vector3 position;
- Vector3 scale;
+ Vector3 position;
+ Vector3 scale;
Quaternion orientation;
node->GetWorldMatrix(mImpl->renderBufferIndex).GetTransformComponents(position, orientation, scale);
Vector3 orientationAxis;
- Radian orientationAngle;
- orientation.ToAxisAngle( orientationAxis, orientationAngle );
-
- if (position.x > Math::MACHINE_EPSILON_10000 ||
- position.y > Math::MACHINE_EPSILON_10000 ||
- orientationAxis != Vector3(0.0f, 1.0f, 0.0f) ||
- orientationAngle != ANGLE_180 ||
- scale != Vector3(1.0f, 1.0f, 1.0f))
+ Radian orientationAngle;
+ orientation.ToAxisAngle(orientationAxis, orientationAngle);
+
+ if(position.x > Math::MACHINE_EPSILON_10000 ||
+ position.y > Math::MACHINE_EPSILON_10000 ||
+ orientationAxis != Vector3(0.0f, 1.0f, 0.0f) ||
+ orientationAngle != ANGLE_180 ||
+ scale != Vector3(1.0f, 1.0f, 1.0f))
{
return;
}
}
Rect<int32_t> viewportRect;
- if (instruction.mIsViewportSet)
+ if(instruction.mIsViewportSet)
{
const int32_t y = (surfaceRect.height - instruction.mViewport.height) - instruction.mViewport.y;
- viewportRect.Set(instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height);
- if (viewportRect.IsEmpty() || !viewportRect.IsValid())
+ viewportRect.Set(instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height);
+ if(viewportRect.IsEmpty() || !viewportRect.IsValid())
{
return; // just skip funny use cases for now, empty viewport means it is set somewhere else
}
const Matrix* viewMatrix = instruction.GetViewMatrix(mImpl->renderBufferIndex);
const Matrix* projectionMatrix = instruction.GetProjectionMatrix(mImpl->renderBufferIndex);
- if (viewMatrix && projectionMatrix)
+ if(viewMatrix && projectionMatrix)
{
const RenderListContainer::SizeType count = instruction.RenderListCount();
- for (RenderListContainer::SizeType index = 0u; index < count; ++index)
+ for(RenderListContainer::SizeType index = 0u; index < count; ++index)
{
- const RenderList* renderList = instruction.GetRenderList( index );
- if (renderList && !renderList->IsEmpty())
+ const RenderList* renderList = instruction.GetRenderList(index);
+ if(renderList && !renderList->IsEmpty())
{
const std::size_t count = renderList->Count();
- for (uint32_t index = 0u; index < count; ++index)
+ for(uint32_t index = 0u; index < count; ++index)
{
- RenderItem& item = renderList->GetItem( index );
+ RenderItem& item = renderList->GetItem(index);
// If the item does 3D transformation, do early exit and clean the damaged rect array
- if (item.mUpdateSize == Vector3::ZERO)
+ if(item.mUpdateSize == Vector3::ZERO)
{
return;
}
Rect<int> rect;
DirtyRect dirtyRect(item.mNode, item.mRenderer, mImpl->frameCount, rect);
// If the item refers to updated node or renderer.
- if (item.mIsUpdated ||
- (item.mNode &&
+ if(item.mIsUpdated ||
+ (item.mNode &&
(item.mNode->Updated() || (item.mRenderer && item.mRenderer->Updated(mImpl->renderBufferIndex, item.mNode)))))
{
item.mIsUpdated = false;
item.mNode->SetUpdated(false);
rect = item.CalculateViewportSpaceAABB(item.mUpdateSize, viewportRect.width, viewportRect.height);
- if (rect.IsValid() && rect.Intersect(viewportRect) && !rect.IsEmpty())
+ if(rect.IsValid() && rect.Intersect(viewportRect) && !rect.IsEmpty())
{
- const int left = rect.x;
- const int top = rect.y;
- const int right = rect.x + rect.width;
+ const int left = rect.x;
+ const int top = rect.y;
+ const int right = rect.x + rect.width;
const int bottom = rect.y + rect.height;
- rect.x = (left / 16) * 16;
- rect.y = (top / 16) * 16;
- rect.width = ((right + 16) / 16) * 16 - rect.x;
- rect.height = ((bottom + 16) / 16) * 16 - rect.y;
+ rect.x = (left / 16) * 16;
+ rect.y = (top / 16) * 16;
+ rect.width = ((right + 16) / 16) * 16 - rect.x;
+ rect.height = ((bottom + 16) / 16) * 16 - rect.y;
// Found valid dirty rect.
// 1. Insert it in the sorted array of the dirty rects.
// 2. Mark the related dirty rects as visited so they will not be removed below.
// 3. Keep only last 3 dirty rects for the same node and renderer (Tizen uses 3 back buffers, Ubuntu 1).
- dirtyRect.rect = rect;
+ dirtyRect.rect = rect;
auto dirtyRectPos = std::lower_bound(itemsDirtyRects.begin(), itemsDirtyRects.end(), dirtyRect);
- dirtyRectPos = itemsDirtyRects.insert(dirtyRectPos, dirtyRect);
+ dirtyRectPos = itemsDirtyRects.insert(dirtyRectPos, dirtyRect);
int c = 1;
- while (++dirtyRectPos != itemsDirtyRects.end())
+ while(++dirtyRectPos != itemsDirtyRects.end())
{
- if (dirtyRectPos->node != item.mNode || dirtyRectPos->renderer != item.mRenderer)
+ if(dirtyRectPos->node != item.mNode || dirtyRectPos->renderer != item.mRenderer)
{
break;
}
dirtyRectPos->visited = true;
- Rect<int>& dirtRect = dirtyRectPos->rect;
+ Rect<int>& dirtRect = dirtyRectPos->rect;
rect.Merge(dirtRect);
c++;
- if (c > 3) // no more then 3 previous rects
+ if(c > 3) // no more then 3 previous rects
{
itemsDirtyRects.erase(dirtyRectPos);
break;
// 1. The item is not dirty, the node and renderer referenced by the item are still exist.
// 2. Mark the related dirty rects as visited so they will not be removed below.
auto dirtyRectPos = std::lower_bound(itemsDirtyRects.begin(), itemsDirtyRects.end(), dirtyRect);
- while (dirtyRectPos != itemsDirtyRects.end())
+ while(dirtyRectPos != itemsDirtyRects.end())
{
- if (dirtyRectPos->node != item.mNode || dirtyRectPos->renderer != item.mRenderer)
+ if(dirtyRectPos->node != item.mNode || dirtyRectPos->renderer != item.mRenderer)
{
break;
}
// Check removed nodes or removed renderers dirty rects
auto i = itemsDirtyRects.begin();
auto j = itemsDirtyRects.begin();
- while (i != itemsDirtyRects.end())
+ while(i != itemsDirtyRects.end())
{
- if (i->visited)
+ if(i->visited)
{
*j++ = *i;
}
damagedRectCleaner.SetCleanOnReturn(false);
}
-void RenderManager::RenderScene( Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo )
+void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo)
{
Rect<int> clippingRect;
- RenderScene( status, scene, renderToFbo, clippingRect);
+ RenderScene(status, scene, renderToFbo, clippingRect);
}
-void RenderManager::RenderScene( Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect )
+void RenderManager::RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect)
{
- Internal::Scene& sceneInternal = GetImplementation( scene );
- SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject();
+ Internal::Scene& sceneInternal = GetImplementation(scene);
+ SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject();
- uint32_t count = sceneObject->GetRenderInstructions().Count( mImpl->renderBufferIndex );
+ uint32_t count = sceneObject->GetRenderInstructions().Count(mImpl->renderBufferIndex);
- for( uint32_t i = 0; i < count; ++i )
+ for(uint32_t i = 0; i < count; ++i)
{
- RenderInstruction& instruction = sceneObject->GetRenderInstructions().At( mImpl->renderBufferIndex, i );
+ RenderInstruction& instruction = sceneObject->GetRenderInstructions().At(mImpl->renderBufferIndex, i);
- if ( ( renderToFbo && !instruction.mFrameBuffer ) || ( !renderToFbo && instruction.mFrameBuffer ) )
+ if((renderToFbo && !instruction.mFrameBuffer) || (!renderToFbo && instruction.mFrameBuffer))
{
continue; // skip
}
// Mark that we will require a post-render step to be performed (includes swap-buffers).
- status.SetNeedsPostRender( true );
+ status.SetNeedsPostRender(true);
Rect<int32_t> viewportRect;
- Vector4 clearColor;
+ Vector4 clearColor;
- if ( instruction.mIsClearColorSet )
+ if(instruction.mIsClearColorSet)
{
clearColor = instruction.mClearColor;
}
clearColor = Dali::RenderTask::DEFAULT_CLEAR_COLOR;
}
- Rect<int32_t> surfaceRect = mImpl->defaultSurfaceRect;
- Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable;
+ Rect<int32_t> surfaceRect = mImpl->defaultSurfaceRect;
+ Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable;
Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable;
- int surfaceOrientation = sceneInternal.GetSurfaceOrientation();
+ int surfaceOrientation = sceneInternal.GetSurfaceOrientation();
- if ( instruction.mFrameBuffer )
+ if(instruction.mFrameBuffer)
{
// offscreen buffer
- if ( mImpl->currentContext != &mImpl->context )
+ if(mImpl->currentContext != &mImpl->context)
{
// Switch to shared context for off-screen buffer
mImpl->currentContext = &mImpl->context;
- if ( mImpl->currentContext->IsSurfacelessContextSupported() )
+ if(mImpl->currentContext->IsSurfacelessContextSupported())
{
- mImpl->glContextHelperAbstraction.MakeSurfacelessContextCurrent();
+ mImpl->graphicsController.GetGlContextHelperAbstraction().MakeSurfacelessContextCurrent();
}
// Clear the current cached program when the context is switched
}
else
{
- if ( mImpl->currentContext->IsSurfacelessContextSupported() )
+ if(mImpl->currentContext->IsSurfacelessContextSupported())
{
- if ( mImpl->currentContext != sceneObject->GetContext() )
+ if(mImpl->currentContext != sceneObject->GetContext())
{
// Switch the correct context if rendering to a surface
mImpl->currentContext = sceneObject->GetContext();
}
}
- surfaceRect = Rect<int32_t>( 0, 0, static_cast<int32_t>( scene.GetSize().width ), static_cast<int32_t>( scene.GetSize().height ) );
+ surfaceRect = Rect<int32_t>(0, 0, static_cast<int32_t>(scene.GetSize().width), static_cast<int32_t>(scene.GetSize().height));
}
// Make sure that GL context must be created
- mImpl->currentContext->GlContextCreated();
+ mImpl->currentContext->GlContextCreated();
// reset the program matrices for all programs once per frame
// this ensures we will set view and projection matrix once per program per camera
mImpl->programController.ResetProgramMatrices();
- if( instruction.mFrameBuffer )
+ if(instruction.mFrameBuffer)
{
- instruction.mFrameBuffer->Bind( *mImpl->currentContext );
+ instruction.mFrameBuffer->Bind(*mImpl->currentContext);
// For each offscreen buffer, update the dependency list with the new texture id used by this frame buffer.
- for (unsigned int i0 = 0, i1 = instruction.mFrameBuffer->GetColorAttachmentCount(); i0 < i1; ++i0)
+ for(unsigned int i0 = 0, i1 = instruction.mFrameBuffer->GetColorAttachmentCount(); i0 < i1; ++i0)
{
- mImpl->textureDependencyList.PushBack( instruction.mFrameBuffer->GetTextureId(i0) );
+ mImpl->textureDependencyList.PushBack(instruction.mFrameBuffer->GetTextureId(i0));
}
}
else
{
- mImpl->currentContext->BindFramebuffer( GL_FRAMEBUFFER, 0u );
+ mImpl->currentContext->BindFramebuffer(GL_FRAMEBUFFER, 0u);
}
- if ( !instruction.mFrameBuffer )
+ if(!instruction.mFrameBuffer)
{
- mImpl->currentContext->Viewport( surfaceRect.x,
- surfaceRect.y,
- surfaceRect.width,
- surfaceRect.height );
+ mImpl->currentContext->Viewport(surfaceRect.x,
+ surfaceRect.y,
+ surfaceRect.width,
+ surfaceRect.height);
}
// Clear the entire color, depth and stencil buffers for the default framebuffer, if required.
// and then stall. That problem is only noticeable when rendering a large number of vertices per frame.
GLbitfield clearMask = GL_COLOR_BUFFER_BIT;
- mImpl->currentContext->ColorMask( true );
+ mImpl->currentContext->ColorMask(true);
- if( depthBufferAvailable == Integration::DepthBufferAvailable::TRUE )
+ if(depthBufferAvailable == Integration::DepthBufferAvailable::TRUE)
{
- mImpl->currentContext->DepthMask( true );
+ mImpl->currentContext->DepthMask(true);
clearMask |= GL_DEPTH_BUFFER_BIT;
}
- if( stencilBufferAvailable == Integration::StencilBufferAvailable::TRUE)
+ if(stencilBufferAvailable == Integration::StencilBufferAvailable::TRUE)
{
- mImpl->currentContext->ClearStencil( 0 );
- mImpl->currentContext->StencilMask( 0xFF ); // 8 bit stencil mask, all 1's
+ mImpl->currentContext->ClearStencil(0);
+ mImpl->currentContext->StencilMask(0xFF); // 8 bit stencil mask, all 1's
clearMask |= GL_STENCIL_BUFFER_BIT;
}
- if( !instruction.mIgnoreRenderToFbo && ( instruction.mFrameBuffer != nullptr ) )
+ if(!instruction.mIgnoreRenderToFbo && (instruction.mFrameBuffer != nullptr))
{
// Offscreen buffer rendering
- if ( instruction.mIsViewportSet )
+ if(instruction.mIsViewportSet)
{
// For glViewport the lower-left corner is (0,0)
- const int32_t y = ( instruction.mFrameBuffer->GetHeight() - instruction.mViewport.height ) - instruction.mViewport.y;
- viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height );
+ const int32_t y = (instruction.mFrameBuffer->GetHeight() - instruction.mViewport.height) - instruction.mViewport.y;
+ viewportRect.Set(instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height);
}
else
{
- viewportRect.Set( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() );
+ viewportRect.Set(0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight());
}
surfaceOrientation = 0;
}
else // No Offscreen frame buffer rendering
{
// Check whether a viewport is specified, otherwise the full surface size is used
- if ( instruction.mIsViewportSet )
+ if(instruction.mIsViewportSet)
{
// For glViewport the lower-left corner is (0,0)
- const int32_t y = ( surfaceRect.height - instruction.mViewport.height ) - instruction.mViewport.y;
- viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height );
+ const int32_t y = (surfaceRect.height - instruction.mViewport.height) - instruction.mViewport.y;
+ viewportRect.Set(instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height);
}
else
{
mImpl->currentContext->SetSurfaceOrientation(surfaceOrientation);
bool clearFullFrameRect = true;
- if( instruction.mFrameBuffer != nullptr )
+ if(instruction.mFrameBuffer != nullptr)
{
- Viewport frameRect( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() );
- clearFullFrameRect = ( frameRect == viewportRect );
+ Viewport frameRect(0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight());
+ clearFullFrameRect = (frameRect == viewportRect);
}
else
{
- clearFullFrameRect = ( surfaceRect == viewportRect );
+ clearFullFrameRect = (surfaceRect == viewportRect);
}
- if (!clippingRect.IsEmpty())
+ if(!clippingRect.IsEmpty())
{
- if (!clippingRect.Intersect(viewportRect))
+ if(!clippingRect.Intersect(viewportRect))
{
DALI_LOG_ERROR("Invalid clipping rect %d %d %d %d\n", clippingRect.x, clippingRect.y, clippingRect.width, clippingRect.height);
clippingRect = Rect<int>();
mImpl->currentContext->Viewport(viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height);
- if (instruction.mIsClearColorSet)
+ if(instruction.mIsClearColorSet)
{
mImpl->currentContext->ClearColor(clearColor.r,
clearColor.g,
clearColor.b,
clearColor.a);
- if (!clearFullFrameRect)
+ if(!clearFullFrameRect)
{
- if (!clippingRect.IsEmpty())
+ if(!clippingRect.IsEmpty())
{
mImpl->currentContext->SetScissorTest(true);
mImpl->currentContext->Scissor(clippingRect.x, clippingRect.y, clippingRect.width, clippingRect.height);
mImpl->boundTextures.Clear();
mImpl->renderAlgorithms.ProcessRenderInstruction(
- instruction,
- *mImpl->currentContext,
- mImpl->renderBufferIndex,
- depthBufferAvailable,
- stencilBufferAvailable,
- mImpl->boundTextures,
- clippingRect );
+ instruction,
+ *mImpl->currentContext,
+ mImpl->renderBufferIndex,
+ depthBufferAvailable,
+ stencilBufferAvailable,
+ mImpl->boundTextures,
+ clippingRect);
// Synchronise the FBO/Texture access when there are multiple contexts
- if ( mImpl->currentContext->IsSurfacelessContextSupported() )
+ if(mImpl->currentContext->IsSurfacelessContextSupported())
{
// Check whether any binded texture is in the dependency list
bool textureFound = false;
- if ( mImpl->boundTextures.Count() > 0u && mImpl->textureDependencyList.Count() > 0u )
+ if(mImpl->boundTextures.Count() > 0u && mImpl->textureDependencyList.Count() > 0u)
{
- for ( auto textureId : mImpl->textureDependencyList )
+ for(auto textureId : mImpl->textureDependencyList)
{
-
- textureFound = std::find_if( mImpl->boundTextures.Begin(), mImpl->boundTextures.End(),
- [textureId]( GLuint id )
- {
- return textureId == id;
- } ) != mImpl->boundTextures.End();
+ textureFound = std::find_if(mImpl->boundTextures.Begin(), mImpl->boundTextures.End(), [textureId](GLuint id) {
+ return textureId == id;
+ }) != mImpl->boundTextures.End();
}
}
- if ( textureFound )
+ if(textureFound)
{
- if ( instruction.mFrameBuffer )
+ if(instruction.mFrameBuffer)
{
// For off-screen buffer
// Wait until all rendering calls for the currently context are executed
- mImpl->glContextHelperAbstraction.WaitClient();
+ mImpl->graphicsController.GetGlContextHelperAbstraction().WaitClient();
// Clear the dependency list
mImpl->textureDependencyList.Clear();
else
{
// Worker thread lambda function
- auto& glContextHelperAbstraction = mImpl->glContextHelperAbstraction;
- auto workerFunction = [&glContextHelperAbstraction]( int workerThread )
- {
+ auto& glContextHelperAbstraction = mImpl->graphicsController.GetGlContextHelperAbstraction();
+ auto workerFunction = [&glContextHelperAbstraction](int workerThread) {
// Switch to the shared context in the worker thread
glContextHelperAbstraction.MakeSurfacelessContextCurrent();
glContextHelperAbstraction.MakeContextNull();
};
- auto future = mImpl->threadPool->SubmitTask( 0u, workerFunction );
- if ( future )
+ auto future = mImpl->threadPool->SubmitTask(0u, workerFunction);
+ if(future)
{
mImpl->threadPool->Wait();
}
}
- if( instruction.mRenderTracker && instruction.mFrameBuffer )
+ if(instruction.mRenderTracker && instruction.mFrameBuffer)
{
// This will create a sync object every frame this render tracker
// is alive (though it should be now be created only for
// render-once render tasks)
- instruction.mRenderTracker->CreateSyncObject( mImpl->glSyncAbstraction );
+ instruction.mRenderTracker->CreateSyncObject(mImpl->graphicsController.GetGlSyncAbstraction());
instruction.mRenderTracker = nullptr; // Only create once.
}
- if ( renderToFbo )
+ if(renderToFbo)
{
mImpl->currentContext->Flush();
}
}
- GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
+ GLenum attachments[] = {GL_DEPTH, GL_STENCIL};
mImpl->currentContext->InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
-
}
-void RenderManager::PostRender( bool uploadOnly )
+void RenderManager::PostRender(bool uploadOnly)
{
- if ( !uploadOnly )
+ if(!uploadOnly)
{
- if ( mImpl->currentContext->IsSurfacelessContextSupported() )
+ if(mImpl->currentContext->IsSurfacelessContextSupported())
{
- mImpl->glContextHelperAbstraction.MakeSurfacelessContextCurrent();
+ mImpl->graphicsController.GetGlContextHelperAbstraction().MakeSurfacelessContextCurrent();
}
- GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
+ GLenum attachments[] = {GL_DEPTH, GL_STENCIL};
mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
}
//Notify RenderGeometries that rendering has finished
- for ( auto&& iter : mImpl->geometryContainer )
+ for(auto&& iter : mImpl->geometryContainer)
{
iter->OnRenderFinished();
}
mImpl->UpdateTrackers();
-
uint32_t count = 0u;
- for( uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i )
+ for(uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i)
{
- count += mImpl->sceneContainer[i]->GetRenderInstructions().Count( mImpl->renderBufferIndex );
+ count += mImpl->sceneContainer[i]->GetRenderInstructions().Count(mImpl->renderBufferIndex);
}
const bool haveInstructions = count > 0u;
#define DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/math/rect.h>
+#include <dali/graphics-api/graphics-controller.h>
#include <dali/integration-api/core-enumerations.h>
#include <dali/internal/common/shader-saver.h>
#include <dali/internal/event/rendering/texture-impl.h>
#include <dali/internal/render/gl-resources/gpu-buffer.h>
#include <dali/internal/render/renderers/render-vertex-buffer.h>
+#include <dali/public-api/math/rect.h>
namespace Dali
{
-
namespace Integration
{
class GlAbstraction;
class GlContextHelperAbstraction;
class RenderStatus;
class Scene;
-}
+} // namespace Integration
struct Vector4;
class RenderTracker;
class Geometry;
class Texture;
-}
+} // namespace Render
namespace SceneGraph
{
class RenderManager
{
public:
-
/**
* Construct a new RenderManager.
- * @param[in] glAbstraction The GL abstraction used for rendering.
- * @param[in] glSyncAbstraction The GL sync abstraction used fence sync creation/deletion.
- * @param[in] glContextHelperAbstraction The GL context helper abstraction for accessing GL context.
+ * @param[in] graphicsController The graphics controller for a given rendering backend
* @param[in] depthBufferAvailable Whether the depth buffer is available
* @param[in] stencilBufferAvailable Whether the stencil buffer is available
*/
- static RenderManager* New( Integration::GlAbstraction& glAbstraction,
- Integration::GlSyncAbstraction& glSyncAbstraction,
- Integration::GlContextHelperAbstraction& glContextHelperAbstraction,
- Integration::DepthBufferAvailable depthBufferAvailable,
- Integration::StencilBufferAvailable stencilBufferAvailable,
- Integration::PartialUpdateAvailable partialUpdateAvailable );
+ static RenderManager* New(Graphics::Controller& graphicsController,
+ Integration::DepthBufferAvailable depthBufferAvailable,
+ Integration::StencilBufferAvailable stencilBufferAvailable,
+ Integration::PartialUpdateAvailable partialUpdateAvailable);
/**
* Non-virtual destructor; not intended as a base class
* @param[in] upstream The abstract interface to send any received ShaderDatas onwards to..
* @note This should be called during core initialisation if shader binaries are to be used.
*/
- void SetShaderSaver( ShaderSaver& upstream );
+ void SetShaderSaver(ShaderSaver& upstream);
- // The following methods should be called via RenderQueue messages
+ // The foltlowing methods should be called via RenderQueue messages
/*
* Set the frame time delta (time elapsed since the last frame.
* @param[in] deltaTime the delta time
*/
- void SetFrameDeltaTime( float deltaTime );
+ void SetFrameDeltaTime(float deltaTime);
/**
* Returns the rectangle for the default surface (probably the application window).
* @return Rectangle for the surface.
*/
- void SetDefaultSurfaceRect( const Rect<int>& rect );
+ void SetDefaultSurfaceRect(const Rect<int>& rect);
/**
* Returns the orintation for the default surface (probably the application window).
* @param[in] renderer The renderer to add.
* @post renderer is owned by RenderManager
*/
- void AddRenderer( OwnerPointer< Render::Renderer >& renderer );
+ void AddRenderer(OwnerPointer<Render::Renderer>& renderer);
/**
* Remove a Renderer from the render manager.
* @param[in] renderer The renderer to remove.
* @post renderer is destroyed.
*/
- void RemoveRenderer( Render::Renderer* renderer );
+ void RemoveRenderer(Render::Renderer* renderer);
/**
* Add a sampler to the render manager.
* @param[in] sampler The sampler to add.
* @post sampler is owned by RenderManager
*/
- void AddSampler( OwnerPointer< Render::Sampler >& sampler );
+ void AddSampler(OwnerPointer<Render::Sampler>& sampler);
/**
* Remove a sampler from the render manager.
* @param[in] sampler The sampler to remove.
* @post sampler is destroyed.
*/
- void RemoveSampler( Render::Sampler* sampler );
+ void RemoveSampler(Render::Sampler* sampler);
/**
* Set minification and magnification filter modes for a sampler
* @param[in] minFilterMode Filter mode to use when the texture is minificated
* @param[in] magFilterMode Filter mode to use when the texture is magnified
*/
- void SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode );
+ void SetFilterMode(Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode);
/**
* Set wrapping mode for a sampler
* @param[in] uWrapMode Wrap mode in the x direction
* @param[in] vWrapMode Wrap mode in the y direction
*/
- void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode );
+ void SetWrapMode(Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode);
/**
* Add a property buffer to the render manager.
* @param[in] vertexBuffer The property buffer to add.
* @post propertBuffer is owned by RenderManager
*/
- void AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& vertexBuffer );
+ void AddVertexBuffer(OwnerPointer<Render::VertexBuffer>& vertexBuffer);
/**
* Remove a property buffer from the render manager.
* @param[in] vertexBuffer The property buffer to remove.
* @post vertexBuffer is destroyed.
*/
- void RemoveVertexBuffer( Render::VertexBuffer* vertexBuffer );
+ void RemoveVertexBuffer(Render::VertexBuffer* vertexBuffer);
/**
* Add a geometry to the render manager.
* @param[in] geometry The geometry to add.
* @post geometry is owned by RenderManager
*/
- void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
+ void AddGeometry(OwnerPointer<Render::Geometry>& geometry);
/**
* Remove a geometry from the render manager.
* @param[in] geometry The geometry to remove.
* @post geometry is destroyed.
*/
- void RemoveGeometry( Render::Geometry* geometry );
+ void RemoveGeometry(Render::Geometry* geometry);
/**
* Adds a property buffer to a geometry from the render manager.
* @param[in] geometry The geometry
* @param[in] vertexBuffer The property buffer to remove.
*/
- void AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer );
+ void AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
/**
* Remove a property buffer from a Render::Geometry from the render manager.
* @param[in] vertexBuffer The property buffer to remove.
* @post property buffer is destroyed.
*/
- void RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer );
+ void RemoveVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
/**
* Sets the format of an existing property buffer
* @param[in] vertexBuffer The property buffer.
* @param[in] format The new format of the buffer
*/
- void SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format );
+ void SetVertexBufferFormat(Render::VertexBuffer* vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format);
/**
* Sets the data of an existing property buffer
* @param[in] data The new data of the buffer
* @param[in] size The new size of the buffer
*/
- void SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size );
+ void SetVertexBufferData(Render::VertexBuffer* vertexBuffer, OwnerPointer<Vector<uint8_t>>& data, uint32_t size);
/**
* Sets the data for the index buffer of an existing geometry
* @param[in] geometry The geometry
* @param[in] data A vector containing the indices
*/
- void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& data );
+ void SetIndexBuffer(Render::Geometry* geometry, Dali::Vector<uint16_t>& data);
/**
* Set the geometry type of an existing render geometry
* @param[in] geometry The render geometry
* @param[in] geometryType The new geometry type
*/
- void SetGeometryType( Render::Geometry* geometry, uint32_t geometryType );
+ void SetGeometryType(Render::Geometry* geometry, uint32_t geometryType);
/**
* Adds a texture to the render manager
* @param[in] texture The texture to add
*/
- void AddTexture( OwnerPointer< Render::Texture >& texture );
+ void AddTexture(OwnerPointer<Render::Texture>& texture);
/**
* Removes a texture from the render manager
* @param[in] texture The texture to remove
*/
- void RemoveTexture( Render::Texture* texture );
+ void RemoveTexture(Render::Texture* texture);
/**
* Uploads data to an existing texture
* @param[in] pixelData The pixel data object
* @param[in] params The parameters for the upload
*/
- void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params );
+ void UploadTexture(Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params);
/**
* Generates mipmaps for a given texture
* @param[in] texture The texture
*/
- void GenerateMipmaps( Render::Texture* texture );
+ void GenerateMipmaps(Render::Texture* texture);
/**
* Adds a framebuffer to the render manager
* @param[in] frameBuffer The framebuffer to add
*/
- void AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer );
+ void AddFrameBuffer(OwnerPointer<Render::FrameBuffer>& frameBuffer);
/**
* Removes a framebuffer from the render manager
* @param[in] frameBuffer The framebuffer to remove
*/
- void RemoveFrameBuffer( Render::FrameBuffer* frameBuffer );
+ void RemoveFrameBuffer(Render::FrameBuffer* frameBuffer);
/**
* Attaches a texture as color output to the existing frame buffer
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
+ void AttachColorTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer);
/**
* Attaches a texture as depth output to the existing frame buffer
* @param[in] texture The texture that will be used as output when rendering
* @param[in] mipmapLevel The mipmap of the texture to be attached
*/
- void AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+ void AttachDepthTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
/**
* Attaches a texture as depth/stencil output to the existing frame buffer
* @param[in] texture The texture that will be used as output when rendering
* @param[in] mipmapLevel The mipmap of the texture to be attached
*/
- void AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+ void AttachDepthStencilTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
/**
* Initializes a Scene to the render manager
* @param[in] scene The Scene to initialize
*/
- void InitializeScene( SceneGraph::Scene* scene );
+ void InitializeScene(SceneGraph::Scene* scene);
/**
* Uninitializes a Scene to the render manager
* @param[in] scene The Scene to uninitialize
*/
- void UninitializeScene( SceneGraph::Scene* scene );
+ void UninitializeScene(SceneGraph::Scene* scene);
/**
* This is called when the surface of the scene has been replaced.
* @param[in] scene The scene.
*/
- void SurfaceReplaced( SceneGraph::Scene* scene );
+ void SurfaceReplaced(SceneGraph::Scene* scene);
/**
* Adds a render tracker to the RenderManager. RenderManager takes ownership of the
* object, usually an offscreen render task.
* @param[in] renderTracker The render tracker
*/
- void AddRenderTracker( Render::RenderTracker* renderTracker );
+ void AddRenderTracker(Render::RenderTracker* renderTracker);
/**
* Removes a render tracker from the RenderManager.
* @param[in] renderTracker The render tracker to remove.
*/
- void RemoveRenderTracker( Render::RenderTracker* renderTracker );
+ void RemoveRenderTracker(Render::RenderTracker* renderTracker);
/**
* returns the Program controller for sending program messages
* @param[in] forceClear force the Clear on the framebuffer even if nothing is rendered.
* @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
*/
- void PreRender( Integration::RenderStatus& status, bool forceClear, bool uploadOnly );
+ void PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly);
// This method should be called from Core::PreRender()
* @param[in] scene The scene to be rendered.
* @param[out] damagedRects The list of damaged rects for the current render pass.
*/
- void PreRender( Integration::Scene& scene, std::vector<Rect<int>>& damagedRects );
+ void PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects);
// This method should be called from Core::RenderScene()
* @param[in] scene The scene to be rendered.
* @param[in] renderToFbo True to render off-screen frame buffers only if any, and False to render the surface only.
*/
- void RenderScene( Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo );
+ void RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo);
/**
* Render a scene in the next frame. This method should be preceded by a call up PreRender.
* @param[in] renderToFbo True to render off-screen frame buffers only if any, and False to render the surface only.
* @param[in] clippingRect The clipping rect for the rendered scene.
*/
- void RenderScene( Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect );
+ void RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect);
// This method should be called from Core::PostRender()
* @pre The GL context must have been created, and made current.
* @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
*/
- void PostRender( bool uploadOnly );
-
+ void PostRender(bool uploadOnly);
private:
-
private:
-
/**
* Construct a new RenderManager.
*/
RenderManager();
// Undefined
- RenderManager( const RenderManager& );
+ RenderManager(const RenderManager&);
// Undefined
- RenderManager& operator=( const RenderManager& rhs );
+ RenderManager& operator=(const RenderManager& rhs);
private:
-
struct Impl;
Impl* mImpl;
-
};
} // namespace SceneGraph
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
#include <type_traits>
// INTERNAL INCLUDES
-#include <dali/public-api/common/constants.h>
-#include <dali/public-api/rendering/texture-set.h>
-#include <dali/integration-api/platform-abstraction.h>
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/platform-abstraction.h>
#include <dali/internal/render/common/render-manager.h>
+#include <dali/public-api/common/constants.h>
+#include <dali/public-api/rendering/texture-set.h>
namespace Dali
{
-
namespace Internal
{
-
namespace // unnamed namespace
{
-
-static_assert( TEXTURE_UNIT_LAST <= Context::MAX_TEXTURE_UNITS, "TEXTURE_UNIT_LAST is greater than Context::MAX_TEXTURE_UNITS" );
+static_assert(TEXTURE_UNIT_LAST <= Context::MAX_TEXTURE_UNITS, "TEXTURE_UNIT_LAST is greater than Context::MAX_TEXTURE_UNITS");
/**
* GL error strings
struct errorStrings
{
const GLenum errorCode;
- const char* errorString;
+ const char* errorString;
};
errorStrings errors[] =
-{
- { GL_NO_ERROR, "GL_NO_ERROR" },
- { GL_INVALID_ENUM, "GL_INVALID_ENUM" },
- { GL_INVALID_VALUE, "GL_INVALID_VALUE" },
- { GL_INVALID_OPERATION, "GL_INVALID_OPERATION" },
- { GL_OUT_OF_MEMORY, "GL_OUT_OF_MEMORY" }
-};
+ {
+ {GL_NO_ERROR, "GL_NO_ERROR"},
+ {GL_INVALID_ENUM, "GL_INVALID_ENUM"},
+ {GL_INVALID_VALUE, "GL_INVALID_VALUE"},
+ {GL_INVALID_OPERATION, "GL_INVALID_OPERATION"},
+ {GL_OUT_OF_MEMORY, "GL_OUT_OF_MEMORY"}};
} // unnamed namespace
Debug::Filter* gContextLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CONTEXT_STATE");
#endif
-Context::Context( Integration::GlAbstraction& glAbstraction )
-: Context( glAbstraction, nullptr )
+Context::Context(Integration::GlAbstraction& glAbstraction)
+: Context(glAbstraction, nullptr)
{
}
-Context::Context( Integration::GlAbstraction& glAbstraction, OwnerContainer< Context* >* contexts )
+Context::Context(Integration::GlAbstraction& glAbstraction, OwnerContainer<Context*>* contexts)
: mGlAbstraction(glAbstraction),
mGlContextCreated(false),
mColorMask(true),
mBoundArrayBufferId(0),
mBoundElementArrayBufferId(0),
mBoundTransformFeedbackBufferId(0),
- mActiveTextureUnit( TEXTURE_UNIT_LAST ),
+ mActiveTextureUnit(TEXTURE_UNIT_LAST),
mBlendColor(Color::TRANSPARENT),
mBlendFuncSeparateSrcRGB(GL_ONE),
mBlendFuncSeparateDstRGB(GL_ZERO),
mBlendFuncSeparateSrcAlpha(GL_ONE),
mBlendFuncSeparateDstAlpha(GL_ZERO),
- mBlendEquationSeparateModeRGB( GL_FUNC_ADD ),
- mBlendEquationSeparateModeAlpha( GL_FUNC_ADD ),
- mStencilFunc( GL_ALWAYS ),
- mStencilFuncRef( 0 ),
- mStencilFuncMask( 0xFFFFFFFF ),
- mStencilOpFail( GL_KEEP ),
- mStencilOpDepthFail( GL_KEEP ),
- mStencilOpDepthPass( GL_KEEP ),
- mDepthFunction( GL_LESS ),
+ mBlendEquationSeparateModeRGB(GL_FUNC_ADD),
+ mBlendEquationSeparateModeAlpha(GL_FUNC_ADD),
+ mStencilFunc(GL_ALWAYS),
+ mStencilFuncRef(0),
+ mStencilFuncMask(0xFFFFFFFF),
+ mStencilOpFail(GL_KEEP),
+ mStencilOpDepthFail(GL_KEEP),
+ mStencilOpDepthPass(GL_KEEP),
+ mDepthFunction(GL_LESS),
mMaxTextureSize(0),
- mClearColor(Color::WHITE), // initial color, never used until it's been set by the user
- mCullFaceMode( FaceCullingMode::NONE ),
- mViewPort( 0, 0, 0, 0 ),
- mSceneContexts( contexts ),
+ mClearColor(Color::WHITE), // initial color, never used until it's been set by the user
+ mCullFaceMode(FaceCullingMode::NONE),
+ mViewPort(0, 0, 0, 0),
+ mSceneContexts(contexts),
mSurfaceOrientation(0)
{
}
{
DALI_LOG_INFO(gContextLogFilter, Debug::Verbose, "Context::GlContextCreated()\n");
- if( !mGlContextCreated )
+ if(!mGlContextCreated)
{
mGlContextCreated = true;
mGlContextCreated = false;
}
-const char* Context::ErrorToString( GLenum errorCode )
+const char* Context::ErrorToString(GLenum errorCode)
{
- for( unsigned int i = 0; i < sizeof(errors) / sizeof(errors[0]); ++i)
+ for(unsigned int i = 0; i < sizeof(errors) / sizeof(errors[0]); ++i)
{
- if (errorCode == errors[i].errorCode)
+ if(errorCode == errors[i].errorCode)
{
return errors[i].errorString;
}
return "Unknown Open GLES error";
}
-const Rect< int >& Context::GetViewport()
+const Rect<int>& Context::GetViewport()
{
return mViewPort;
}
void Context::FlushVertexAttributeLocations()
{
- for( unsigned int i = 0; i < MAX_ATTRIBUTE_CACHE_SIZE; ++i )
+ for(unsigned int i = 0; i < MAX_ATTRIBUTE_CACHE_SIZE; ++i)
{
// see if our cached state is different to the actual state
- if (mVertexAttributeCurrentState[ i ] != mVertexAttributeCachedState[ i ] )
+ if(mVertexAttributeCurrentState[i] != mVertexAttributeCachedState[i])
{
// it's different so make the change to the driver
// and update the cached state
- mVertexAttributeCurrentState[ i ] = mVertexAttributeCachedState[ i ];
+ mVertexAttributeCurrentState[i] = mVertexAttributeCachedState[i];
- if (mVertexAttributeCurrentState[ i ] )
+ if(mVertexAttributeCurrentState[i])
{
LOG_GL("EnableVertexAttribArray %d\n", i);
- CHECK_GL( mGlAbstraction, mGlAbstraction.EnableVertexAttribArray( i ) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.EnableVertexAttribArray(i));
}
else
{
LOG_GL("DisableVertexAttribArray %d\n", i);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DisableVertexAttribArray( i ) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DisableVertexAttribArray(i));
}
}
}
-
}
void Context::SetVertexAttributeLocation(unsigned int location, bool state)
{
-
- if( location >= MAX_ATTRIBUTE_CACHE_SIZE )
+ if(location >= MAX_ATTRIBUTE_CACHE_SIZE)
{
// not cached, make the gl call through context
- if ( state )
+ if(state)
{
- LOG_GL("EnableVertexAttribArray %d\n", location);
- CHECK_GL( mGlAbstraction, mGlAbstraction.EnableVertexAttribArray( location ) );
+ LOG_GL("EnableVertexAttribArray %d\n", location);
+ CHECK_GL(mGlAbstraction, mGlAbstraction.EnableVertexAttribArray(location));
}
else
{
LOG_GL("DisableVertexAttribArray %d\n", location);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DisableVertexAttribArray( location ) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DisableVertexAttribArray(location));
}
}
else
{
// set the cached state, it will be set at the next draw call
// if it's different from the current driver state
- mVertexAttributeCachedState[ location ] = state;
+ mVertexAttributeCachedState[location] = state;
}
}
DALI_LOG_INFO(gContextLogFilter, Debug::Verbose, "Context::InitializeGlState()\n");
DALI_ASSERT_DEBUG(mGlContextCreated);
- mClearColorSet = false;
- mColorMask = true;
- mStencilMask = 0xFF;
- mBlendEnabled = false;
- mDepthBufferEnabled = false;
- mDepthMaskEnabled = false;
- mPolygonOffsetFillEnabled = false;
+ mClearColorSet = false;
+ mColorMask = true;
+ mStencilMask = 0xFF;
+ mBlendEnabled = false;
+ mDepthBufferEnabled = false;
+ mDepthMaskEnabled = false;
+ mPolygonOffsetFillEnabled = false;
mSampleAlphaToCoverageEnabled = false;
- mSampleCoverageEnabled = false;
- mScissorTestEnabled = false;
- mStencilBufferEnabled = false;
- mDitherEnabled = false; // This and GL_MULTISAMPLE are the only GL capability which defaults to true
+ mSampleCoverageEnabled = false;
+ mScissorTestEnabled = false;
+ mStencilBufferEnabled = false;
+ mDitherEnabled = false; // This and GL_MULTISAMPLE are the only GL capability which defaults to true
mGlAbstraction.Disable(GL_DITHER);
- mBoundArrayBufferId = 0;
- mBoundElementArrayBufferId = 0;
+ mBoundArrayBufferId = 0;
+ mBoundElementArrayBufferId = 0;
mBoundTransformFeedbackBufferId = 0;
- mActiveTextureUnit = TEXTURE_UNIT_IMAGE;
+ mActiveTextureUnit = TEXTURE_UNIT_IMAGE;
mUsingDefaultBlendColor = true; //Default blend color is (0,0,0,0)
- mBlendFuncSeparateSrcRGB = GL_ONE;
- mBlendFuncSeparateDstRGB = GL_ZERO;
+ mBlendFuncSeparateSrcRGB = GL_ONE;
+ mBlendFuncSeparateDstRGB = GL_ZERO;
mBlendFuncSeparateSrcAlpha = GL_ONE;
mBlendFuncSeparateDstAlpha = GL_ZERO;
// initial state is GL_FUNC_ADD for both RGB and Alpha blend modes
- mBlendEquationSeparateModeRGB = GL_FUNC_ADD;
+ mBlendEquationSeparateModeRGB = GL_FUNC_ADD;
mBlendEquationSeparateModeAlpha = GL_FUNC_ADD;
mCullFaceMode = FaceCullingMode::NONE; //By default cullface is disabled, front face is set to CCW and cull face is set to back
mViewPort.x = mViewPort.y = mViewPort.width = mViewPort.height = 0;
//Initialze vertex attribute cache
- memset( &mVertexAttributeCachedState, 0, sizeof(mVertexAttributeCachedState) );
- memset( &mVertexAttributeCurrentState, 0, sizeof(mVertexAttributeCurrentState) );
+ memset(&mVertexAttributeCachedState, 0, sizeof(mVertexAttributeCachedState));
+ memset(&mVertexAttributeCurrentState, 0, sizeof(mVertexAttributeCurrentState));
//Initialize bound 2d texture cache
- memset( &mBoundTextureId, 0, sizeof(mBoundTextureId) );
+ memset(&mBoundTextureId, 0, sizeof(mBoundTextureId));
mFrameBufferStateCache.Reset();
}
void Context::PrintCurrentState()
{
- const char* cullFaceModes[] = { "CullNone", "CullFront", "CullBack", "CullFrontAndBack" };
- DALI_LOG_INFO( gContextLogFilter, Debug::General,
+ const char* cullFaceModes[] = {"CullNone", "CullFront", "CullBack", "CullFrontAndBack"};
+ DALI_LOG_INFO(gContextLogFilter, Debug::General,
"\n----------------- Context State BEGIN -----------------\n"
"Blend = %s\n"
"Cull Face = %s\n"
"Stencil Test = %s\n"
"----------------- Context State END -----------------\n",
mBlendEnabled ? "Enabled" : "Disabled",
- cullFaceModes[ mCullFaceMode ],
+ cullFaceModes[mCullFaceMode],
mDepthBufferEnabled ? "Enabled" : "Disabled",
mDepthMaskEnabled ? "Enabled" : "Disabled",
mDitherEnabled ? "Enabled" : "Disabled",
#define DALI_INTERNAL_CONTEXT_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/rendering/renderer.h>
#include <dali/devel-api/common/owner-container.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
#include <dali/internal/render/common/performance-monitor.h>
-#include <dali/internal/render/gl-resources/texture-units.h>
#include <dali/internal/render/gl-resources/frame-buffer-state-cache.h>
#include <dali/internal/render/gl-resources/gl-call-debug.h>
+#include <dali/internal/render/gl-resources/texture-units.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/math/vector4.h>
+#include <dali/public-api/rendering/renderer.h>
namespace Dali
{
-
namespace Internal
{
-
/**
* Context records the current GL state, and provides access to the OpenGL ES 2.0 API.
* Context avoids duplicate GL calls, if the same setting etc. is requested repeatedly.
class Context
{
public:
-
/**
* FrameBuffer Clear mode
*/
*/
static constexpr unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 8;
- static constexpr unsigned int MAX_TEXTURE_UNITS = 8; // for GLES 2.0 8 is guaranteed, which is more than DALi uses anyways
+ static constexpr unsigned int MAX_TEXTURE_UNITS = 8; // for GLES 2.0 8 is guaranteed, which is more than DALi uses anyways
static constexpr unsigned int MAX_TEXTURE_TARGET = 3; // We support only GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP and GL_TEXTURE_EXTERNAL_OES now
/**
* @exception Context already created.
* @param glAbstraction the gl abstraction.
*/
- Context( Integration::GlAbstraction& glAbstraction );
+ Context(Integration::GlAbstraction& glAbstraction);
/**
* Creates the Dali Context object for texture (and surface rendering if required).
* @param glAbstraction the gl abstraction.
* @param contexts The list of scene contexts (for surface rendering)
*/
- Context( Integration::GlAbstraction& glAbstraction, OwnerContainer< Context* >* contexts );
+ Context(Integration::GlAbstraction& glAbstraction, OwnerContainer<Context*>* contexts);
/**
* Destructor
* Query whether the OpenGL context has been created.
* @return True if the OpenGL context has been created.
*/
- bool IsGlContextCreated() { return mGlContextCreated; }
+ bool IsGlContextCreated()
+ {
+ return mGlContextCreated;
+ }
/**
* @return the GLAbstraction
*/
- Integration::GlAbstraction& GetAbstraction() { return mGlAbstraction; }
+ Integration::GlAbstraction& GetAbstraction()
+ {
+ return mGlAbstraction;
+ }
#ifdef DEBUG_ENABLED
* @param errorCode to convert
* @return C string
*/
- const char* ErrorToString( GLenum errorCode );
+ const char* ErrorToString(GLenum errorCode);
/**
* Helper to print GL string to debug log
*/
void PrintGlString(const char* stringName, GLenum stringId)
{
- DALI_LOG_INFO(Debug::Filter::gRender, Debug::General, "GL %s = %s\n", stringName, reinterpret_cast< const char * >( GetString( stringId ) ) );
+ DALI_LOG_INFO(Debug::Filter::gRender, Debug::General, "GL %s = %s\n", stringName, reinterpret_cast<const char*>(GetString(stringId)));
}
/**
// reset the cached buffer id's
// fixes problem where some drivers will a generate a buffer with the
// same id, as the last deleted buffer id.
- mBoundArrayBufferId = 0;
- mBoundElementArrayBufferId = 0;
+ mBoundArrayBufferId = 0;
+ mBoundElementArrayBufferId = 0;
mBoundTransformFeedbackBufferId = 0;
}
/**
* Wrapper for TextureRequiresConverting of Dali::Integration::GlAbstraction
*/
- bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const
+ bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const
{
- return mGlAbstraction.TextureRequiresConverting( imageGlFormat, textureGlFormat, isSubImage );
+ return mGlAbstraction.TextureRequiresConverting(imageGlFormat, textureGlFormat, isSubImage);
}
/**
* Wrapper for OpenGL ES 2.0 glActiveTexture()
*/
- void ActiveTexture( TextureUnit textureUnit )
+ void ActiveTexture(TextureUnit textureUnit)
{
- if ( textureUnit != mActiveTextureUnit )
+ if(textureUnit != mActiveTextureUnit)
{
mActiveTextureUnit = textureUnit;
LOG_GL("ActiveTexture %x\n", textureUnit);
- CHECK_GL( mGlAbstraction, mGlAbstraction.ActiveTexture(TextureUnitAsGLenum(textureUnit)) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.ActiveTexture(TextureUnitAsGLenum(textureUnit)));
}
}
void BeginQuery(GLenum target, GLuint id)
{
LOG_GL("BeginQuery %d %d\n", target, id);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BeginQuery(target, id) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BeginQuery(target, id));
}
/**
void BeginTransformFeedback(GLenum primitiveMode)
{
LOG_GL("BeginTransformFeedback %x\n", primitiveMode);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BeginTransformFeedback(primitiveMode) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BeginTransformFeedback(primitiveMode));
}
/**
void BindArrayBuffer(GLuint buffer)
{
// Avoid unecessary calls to BindBuffer
- if (mBoundArrayBufferId != buffer)
+ if(mBoundArrayBufferId != buffer)
{
mBoundArrayBufferId = buffer;
LOG_GL("BindBuffer GL_ARRAY_BUFFER %d\n", buffer);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BindBuffer(GL_ARRAY_BUFFER, buffer) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BindBuffer(GL_ARRAY_BUFFER, buffer));
}
}
void BindElementArrayBuffer(GLuint buffer)
{
// Avoid unecessary calls to BindBuffer
- if (mBoundElementArrayBufferId!= buffer)
+ if(mBoundElementArrayBufferId != buffer)
{
mBoundElementArrayBufferId = buffer;
LOG_GL("BindBuffer GL_ELEMENT_ARRAY_BUFFER %d\n", buffer);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer));
}
}
void BindTransformFeedbackBuffer(GLuint buffer)
{
// Avoid unecessary calls to BindBuffer
- if (mBoundTransformFeedbackBufferId != buffer)
+ if(mBoundTransformFeedbackBufferId != buffer)
{
mBoundTransformFeedbackBufferId = buffer;
LOG_GL("BindBuffer GL_TRANSFORM_FEEDBACK_BUFFER %d\n", buffer);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER , buffer) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buffer));
}
}
void BindTransformFeedbackBufferBase(GLuint index, GLuint buffer)
{
// Avoid unecessary calls to BindBufferBase
- if (mBoundTransformFeedbackBufferId != buffer)
+ if(mBoundTransformFeedbackBufferId != buffer)
{
mBoundTransformFeedbackBufferId = buffer;
LOG_GL("BindBufferBase GL_TRANSFORM_FEEDBACK_BUFFER %d %d\n", index, buffer);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, index, buffer) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, index, buffer));
}
}
*/
void BindFramebuffer(GLenum target, GLuint framebuffer)
{
- mFrameBufferStateCache.SetCurrentFrameBuffer( framebuffer );
+ mFrameBufferStateCache.SetCurrentFrameBuffer(framebuffer);
LOG_GL("BindFramebuffer %d %d\n", target, framebuffer);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BindFramebuffer(target, framebuffer) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BindFramebuffer(target, framebuffer));
}
/**
void BindRenderbuffer(GLenum target, GLuint renderbuffer)
{
LOG_GL("BindRenderbuffer %d %d\n", target, renderbuffer);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BindRenderbuffer(target, renderbuffer) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BindRenderbuffer(target, renderbuffer));
}
/**
void BindTransformFeedback(GLenum target, GLuint id)
{
LOG_GL("BindTransformFeedback %d %d\n", target, id);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BindTransformFeedback(target, id) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BindTransformFeedback(target, id));
}
/**
* @param textureunit to bind to
* @param texture to bind
*/
- void BindTextureForUnit( TextureUnit textureunit, int target, GLuint texture )
+ void BindTextureForUnit(TextureUnit textureunit, int target, GLuint texture)
{
ActiveTexture(textureunit);
BindTexture(target, texture);
/**
* Wrapper for OpenGL ES 2.0 glBindTexture( target )
*/
- void BindTexture( int target, GLuint texture )
+ void BindTexture(int target, GLuint texture)
{
int16_t index = GetTextureIndexFromGlFormat(target);
if(index >= 0)
{
- if(mBoundTextureId[ mActiveTextureUnit ][index] != texture)
+ if(mBoundTextureId[mActiveTextureUnit][index] != texture)
{
- mBoundTextureId[ mActiveTextureUnit ][index] = texture;
+ mBoundTextureId[mActiveTextureUnit][index] = texture;
LOG_GL("BindTexture target(%d) %d\n", target, texture);
CHECK_GL(mGlAbstraction, mGlAbstraction.BindTexture(target, texture));
*/
void SetDefaultBlendColor()
{
- if( ! mUsingDefaultBlendColor )
+ if(!mUsingDefaultBlendColor)
{
- SetCustomBlendColor( Color::TRANSPARENT );
+ SetCustomBlendColor(Color::TRANSPARENT);
mUsingDefaultBlendColor = true;
}
}
/**
* Wrapper for OpenGL ES 2.0 glBlendColor()
*/
- void SetCustomBlendColor( const Vector4& color )
+ void SetCustomBlendColor(const Vector4& color)
{
- if( mUsingDefaultBlendColor || mBlendColor != color )
+ if(mUsingDefaultBlendColor || mBlendColor != color)
{
- LOG_GL( "BlendColor %f %f %f %f\n", color.r, color.g, color.b, color.a );
- CHECK_GL( mGlAbstraction, mGlAbstraction.BlendColor( color.r, color.g, color.b, color.a ) );
+ LOG_GL("BlendColor %f %f %f %f\n", color.r, color.g, color.b, color.a);
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BlendColor(color.r, color.g, color.b, color.a));
mUsingDefaultBlendColor = false;
- mBlendColor = color;
+ mBlendColor = color;
}
}
// DO NOT USE BlendEquationSeparate to set the same rgb and alpha modes
// KHR blending extensions require use of glBlendEquation
- if( mBlendEquationSeparateModeRGB != mode || mBlendEquationSeparateModeAlpha != mode )
+ if(mBlendEquationSeparateModeRGB != mode || mBlendEquationSeparateModeAlpha != mode)
{
- mBlendEquationSeparateModeRGB = mode;
+ mBlendEquationSeparateModeRGB = mode;
mBlendEquationSeparateModeAlpha = mode;
LOG_GL("BlendEquation %d\n", mode);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BlendEquation( mode ) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BlendEquation(mode));
}
}
*/
void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
{
- if( ( modeRGB != mBlendEquationSeparateModeRGB ) ||
- ( modeAlpha != mBlendEquationSeparateModeAlpha ) )
+ if((modeRGB != mBlendEquationSeparateModeRGB) ||
+ (modeAlpha != mBlendEquationSeparateModeAlpha))
{
- mBlendEquationSeparateModeRGB = modeRGB;
+ mBlendEquationSeparateModeRGB = modeRGB;
mBlendEquationSeparateModeAlpha = modeAlpha;
LOG_GL("BlendEquationSeparate %d %d\n", modeRGB, modeAlpha);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BlendEquationSeparate(modeRGB, modeAlpha) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BlendEquationSeparate(modeRGB, modeAlpha));
}
}
void BlendFunc(GLenum sfactor, GLenum dfactor)
{
// reuse the BlendFuncSeparate as thats what the DDK does anyways
- BlendFuncSeparate( sfactor, dfactor, sfactor, dfactor );
+ BlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
}
/**
* Wrapper for OpenGL ES 2.0 glBlendFuncSeparate()
*/
- void BlendFuncSeparate( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+ void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
- if( ( mBlendFuncSeparateSrcRGB != srcRGB )||( mBlendFuncSeparateDstRGB != dstRGB )||
- ( mBlendFuncSeparateSrcAlpha != srcAlpha )||( mBlendFuncSeparateDstAlpha != dstAlpha ) )
+ if((mBlendFuncSeparateSrcRGB != srcRGB) || (mBlendFuncSeparateDstRGB != dstRGB) ||
+ (mBlendFuncSeparateSrcAlpha != srcAlpha) || (mBlendFuncSeparateDstAlpha != dstAlpha))
{
- mBlendFuncSeparateSrcRGB = srcRGB;
- mBlendFuncSeparateDstRGB = dstRGB;
+ mBlendFuncSeparateSrcRGB = srcRGB;
+ mBlendFuncSeparateDstRGB = dstRGB;
mBlendFuncSeparateSrcAlpha = srcAlpha;
mBlendFuncSeparateDstAlpha = dstAlpha;
- LOG_GL( "BlendFuncSeparate %d %d %d %d\n", srcRGB, dstRGB, srcAlpha, dstAlpha );
- CHECK_GL( mGlAbstraction, mGlAbstraction.BlendFuncSeparate( srcRGB, dstRGB, srcAlpha, dstAlpha ) );
+ LOG_GL("BlendFuncSeparate %d %d %d %d\n", srcRGB, dstRGB, srcAlpha, dstAlpha);
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha));
}
}
*/
void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
{
- LOG_GL( "BlitFramebuffer %d %d %d %d %d %d %d %d %x %d\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter );
- CHECK_GL( mGlAbstraction, mGlAbstraction.BlitFramebuffer( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter ) );
+ LOG_GL("BlitFramebuffer %d %d %d %d %d %d %d %d %x %d\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
}
/**
void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
{
LOG_GL("BufferData %d %d %p %d\n", target, size, data, usage);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BufferData(target, size, data, usage) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BufferData(target, size, data, usage));
}
/**
void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
{
LOG_GL("BufferSubData %d %d %d %p\n", target, offset, size, data);
- CHECK_GL( mGlAbstraction, mGlAbstraction.BufferSubData(target, offset, size, data) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BufferSubData(target, offset, size, data));
}
/**
GLenum CheckFramebufferStatus(GLenum target)
{
LOG_GL("CheckFramebufferStatus %d\n", target);
- GLenum value = CHECK_GL( mGlAbstraction, mGlAbstraction.CheckFramebufferStatus(target) );
+ GLenum value = CHECK_GL(mGlAbstraction, mGlAbstraction.CheckFramebufferStatus(target));
return value;
}
/**
* Wrapper for OpenGL ES 2.0 glClear()
*/
- void Clear(GLbitfield mask, ClearMode mode )
+ void Clear(GLbitfield mask, ClearMode mode)
{
- bool forceClear = (mode == FORCE_CLEAR );
- mask = mFrameBufferStateCache.GetClearMask( mask, forceClear , mScissorTestEnabled );
+ bool forceClear = (mode == FORCE_CLEAR);
+ mask = mFrameBufferStateCache.GetClearMask(mask, forceClear, mScissorTestEnabled);
- if( mask > 0 )
+ if(mask > 0)
{
LOG_GL("Clear %d\n", mask);
- CHECK_GL( mGlAbstraction, mGlAbstraction.Clear( mask ) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Clear(mask));
}
}
*/
void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
- Vector4 newCol(red,green,blue,alpha);
+ Vector4 newCol(red, green, blue, alpha);
- if (!mClearColorSet || mClearColor !=newCol )
+ if(!mClearColorSet || mClearColor != newCol)
{
LOG_GL("ClearColor %f %f %f %f\n", red, green, blue, alpha);
- CHECK_GL( mGlAbstraction, mGlAbstraction.ClearColor(red, green, blue, alpha) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.ClearColor(red, green, blue, alpha));
mClearColorSet = true;
- mClearColor = newCol;
+ mClearColor = newCol;
}
}
void ClearDepthf(GLclampf depth)
{
LOG_GL("ClearDepthf %f\n", depth);
- CHECK_GL( mGlAbstraction, mGlAbstraction.ClearDepthf(depth) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.ClearDepthf(depth));
}
/**
void ClearStencil(GLint s)
{
LOG_GL("ClearStencil %d\n", s);
- CHECK_GL( mGlAbstraction, mGlAbstraction.ClearStencil(s) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.ClearStencil(s));
}
/**
* Wrapper for OpenGL ES 2.0 glColorMask()
* @note This has been optimized to a single boolean value (masking individual channels is not required)
*/
- void ColorMask( bool flag )
+ void ColorMask(bool flag)
{
// only change state if needed
- if( flag != mColorMask )
+ if(flag != mColorMask)
{
mColorMask = flag;
LOG_GL("ColorMask %s %s %s %s\n", flag ? "True" : "False", flag ? "True" : "False", flag ? "True" : "False", flag ? "True" : "False");
- CHECK_GL( mGlAbstraction, mGlAbstraction.ColorMask(flag, flag, flag, flag) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.ColorMask(flag, flag, flag, flag));
}
}
/**
* Wrapper for OpenGL ES 2.0 glCompressedTexImage2D()
*/
- void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const void* data)
+ void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
{
LOG_GL("CompressedTexImage2D %d %d %x %d %d %d %d %p\n", target, level, internalformat, width, height, border, imageSize, data);
- CHECK_GL( mGlAbstraction, mGlAbstraction.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data));
}
/**
* Wrapper for OpenGL ES 3.0 glCompressedTexImage3D()
*/
- void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLsizei imageSize, const void* data)
+ void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data)
{
LOG_GL("CompressedTexImage3D %d %d %x %d %d %d %d %d %p\n", target, level, internalformat, width, height, depth, border, imageSize, data);
- CHECK_GL( mGlAbstraction, mGlAbstraction.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data));
}
/**
* Wrapper for OpenGL ES 2.0 glCompressedTexSubImage2D()
*/
- void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const void* data)
+ void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
{
LOG_GL("CompressedTexSubImage2D %x %d %d %d %d %d %x %d %p\n", target, level, xoffset, yoffset, width, height, format, imageSize, data);
- CHECK_GL( mGlAbstraction, mGlAbstraction.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data));
}
/**
* Wrapper for OpenGL ES 3.0 glCompressedTexSubImage3D()
*/
- void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLsizei imageSize, const void* data)
+ void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data)
{
LOG_GL("CompressedTexSubImage3D %x %d %d %d %d %d %d %d %x %d %p\n", target, level, xoffset, yoffset, xoffset, width, height, depth, format, imageSize, data);
- CHECK_GL( mGlAbstraction, mGlAbstraction.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data));
}
/**
void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
{
LOG_GL("CopyTexImage2D %x %d %x %d %d %d %d %d\n", target, level, internalformat, x, y, width, height, border);
- CHECK_GL( mGlAbstraction, mGlAbstraction.CopyTexImage2D(target, level, internalformat, x, y, width, height, border) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CopyTexImage2D(target, level, internalformat, x, y, width, height, border));
}
/**
void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
{
LOG_GL("CopyTexSubImage2D %x %d %d %d %d %d %d %d\n", target, level, xoffset, yoffset, x, y, width, height);
- CHECK_GL( mGlAbstraction, mGlAbstraction.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height));
}
/**
void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
{
LOG_GL("CopyTexSubImage3D %x %d %d %d %d %d %d %d %d\n", target, level, xoffset, yoffset, zoffset, x, y, width, height);
- CHECK_GL( mGlAbstraction, mGlAbstraction.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height));
}
/**
* enables GL_CULL_FACE if in any of the face culling modes
* otherwise disables GL_CULL_FACE
*/
- void CullFace( Dali::FaceCullingMode::Type mode )
+ void CullFace(Dali::FaceCullingMode::Type mode)
{
// Avoid unnecessary calls to gl
if(mCullFaceMode != mode)
case Dali::FaceCullingMode::NONE:
{
LOG_GL("Disable GL_CULL_FACE\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_CULL_FACE) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_CULL_FACE));
break;
}
case Dali::FaceCullingMode::FRONT:
{
LOG_GL("Enable GL_CULL_FACE\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE));
LOG_GL("Enable GL_FRONT\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.CullFace(GL_FRONT) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CullFace(GL_FRONT));
break;
}
case Dali::FaceCullingMode::BACK:
{
LOG_GL("Enable GL_CULL_FACE\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE));
LOG_GL("Enable GL_BACK\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.CullFace(GL_BACK) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CullFace(GL_BACK));
break;
}
case Dali::FaceCullingMode::FRONT_AND_BACK:
{
LOG_GL("Enable GL_CULL_FACE\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE));
LOG_GL("Enable GL_FRONT_AND_BACK\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.CullFace(GL_FRONT_AND_BACK) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.CullFace(GL_FRONT_AND_BACK));
break;
}
*/
void DeleteBuffers(GLsizei n, const GLuint* buffers)
{
- if( this->IsGlContextCreated() )
+ if(this->IsGlContextCreated())
{
LOG_GL("DeleteBuffers %d %p\n", n, buffers);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteBuffers(n, buffers) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DeleteBuffers(n, buffers));
}
ResetBufferCache();
// Need to reset the buffer cache in the surface contexts
// This will only be executed by the surfaceless context when there are contexts for surface rendering
- if ( mSceneContexts )
+ if(mSceneContexts)
{
- for ( auto&& context : *mSceneContexts )
+ for(auto&& context : *mSceneContexts)
{
- if ( context )
+ if(context)
{
context->ResetBufferCache();
}
*/
void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
{
- mFrameBufferStateCache.FrameBuffersDeleted( n, framebuffers );
+ mFrameBufferStateCache.FrameBuffersDeleted(n, framebuffers);
LOG_GL("DeleteFramebuffers %d %p\n", n, framebuffers);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteFramebuffers(n, framebuffers) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DeleteFramebuffers(n, framebuffers));
}
/**
void DeleteQueries(GLsizei n, GLuint* ids)
{
LOG_GL("DeleteQueries %d %p\n", n, ids);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteQueries(n, ids) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DeleteQueries(n, ids));
}
/**
void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
{
LOG_GL("DeleteRenderbuffers %d %p\n", n, renderbuffers);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteRenderbuffers(n, renderbuffers) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DeleteRenderbuffers(n, renderbuffers));
}
/**
void DeleteTextures(GLsizei n, const GLuint* textures)
{
LOG_GL("DeleteTextures %d %p\n", n, textures);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteTextures(n, textures) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DeleteTextures(n, textures));
ResetTextureCache();
// Need to reset the texture cache in the scene contexts
// This will only be executed by the surfaceless context when there are contexts for surface rendering
- if ( mSceneContexts )
+ if(mSceneContexts)
{
- for ( auto&& context : *mSceneContexts )
+ for(auto&& context : *mSceneContexts)
{
- if ( context )
+ if(context)
{
context->ResetTextureCache();
}
void DeleteTransformFeedbacks(GLsizei n, GLuint* ids)
{
LOG_GL("DeleteTransformFeedbacks %d %p\n", n, ids);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DeleteTransformFeedbacks(n, ids) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DeleteTransformFeedbacks(n, ids));
}
/**
*/
void DepthFunc(GLenum func)
{
- if( func != mDepthFunction )
+ if(func != mDepthFunction)
{
mDepthFunction = func;
LOG_GL("DepthFunc %x\n", func);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DepthFunc(func) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DepthFunc(func));
}
}
{
bool booleanFlag = flag != GL_FALSE;
// only change state if needed
- if( booleanFlag != mDepthMaskEnabled )
+ if(booleanFlag != mDepthMaskEnabled)
{
mDepthMaskEnabled = booleanFlag;
LOG_GL("DepthMask %s\n", booleanFlag ? "True" : "False");
- CHECK_GL( mGlAbstraction, mGlAbstraction.DepthMask( mDepthMaskEnabled ) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DepthMask(mDepthMaskEnabled));
}
}
void DepthRangef(GLclampf zNear, GLclampf zFar)
{
LOG_GL("DepthRangef %f %f\n", zNear, zFar);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DepthRangef(zNear, zFar) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DepthRangef(zNear, zFar));
}
/**
*/
void DrawArrays(GLenum mode, GLint first, GLsizei count)
{
- mFrameBufferStateCache.DrawOperation( mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled() );
+ mFrameBufferStateCache.DrawOperation(mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled());
FlushVertexAttributeLocations();
LOG_GL("DrawArrays %x %d %d\n", mode, first, count);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DrawArrays(mode, first, count) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DrawArrays(mode, first, count));
}
/**
*/
void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
{
- mFrameBufferStateCache.DrawOperation( mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled() );
+ mFrameBufferStateCache.DrawOperation(mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled());
FlushVertexAttributeLocations();
LOG_GL("DrawArraysInstanced %x %d %d %d\n", mode, first, count, instanceCount);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DrawArraysInstanced(mode, first, count,instanceCount) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DrawArraysInstanced(mode, first, count, instanceCount));
}
/**
*/
void DrawBuffers(GLsizei n, const GLenum* bufs)
{
- mFrameBufferStateCache.DrawOperation( mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled() );
+ mFrameBufferStateCache.DrawOperation(mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled());
LOG_GL("DrawBuffers %d %p\n", n, bufs);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DrawBuffers(n, bufs) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DrawBuffers(n, bufs));
}
/**
*/
void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
{
- mFrameBufferStateCache.DrawOperation( mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled() );
+ mFrameBufferStateCache.DrawOperation(mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled());
FlushVertexAttributeLocations();
LOG_GL("DrawElements %x %d %d %p\n", mode, count, type, indices);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DrawElements(mode, count, type, indices) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DrawElements(mode, count, type, indices));
}
/**
*/
void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instanceCount)
{
- mFrameBufferStateCache.DrawOperation( mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled() );
+ mFrameBufferStateCache.DrawOperation(mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled());
FlushVertexAttributeLocations();
LOG_GL("DrawElementsInstanced %x %d %d %p %d\n", mode, count, type, indices, instanceCount);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DrawElementsInstanced(mode, count, type, indices, instanceCount) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DrawElementsInstanced(mode, count, type, indices, instanceCount));
}
/**
*/
void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices)
{
- mFrameBufferStateCache.DrawOperation( mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled() );
+ mFrameBufferStateCache.DrawOperation(mColorMask, DepthBufferWriteEnabled(), StencilBufferWriteEnabled());
FlushVertexAttributeLocations();
LOG_GL("DrawRangeElements %x %u %u %d %d %p\n", mode, start, end, count, type, indices);
- CHECK_GL( mGlAbstraction, mGlAbstraction.DrawRangeElements(mode, start, end, count, type, indices) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.DrawRangeElements(mode, start, end, count, type, indices));
}
/**
void GenQueries(GLsizei n, GLuint* ids)
{
LOG_GL("GenQueries %d %p\n", n, ids);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GenQueries(n, ids) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GenQueries(n, ids));
}
/**
void GenTransformFeedbacks(GLsizei n, GLuint* ids)
{
LOG_GL("GenTransformFeedbacks %d %p\n", n, ids);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GenTransformFeedbacks(n, ids) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GenTransformFeedbacks(n, ids));
}
/**
return result;
}
- void EnableVertexAttributeArray( GLuint location )
+ void EnableVertexAttributeArray(GLuint location)
{
- SetVertexAttributeLocation( location, true);
+ SetVertexAttributeLocation(location, true);
}
- void DisableVertexAttributeArray( GLuint location )
+ void DisableVertexAttributeArray(GLuint location)
{
- SetVertexAttributeLocation( location, false);
+ SetVertexAttributeLocation(location, false);
}
/**
* Wrapper for OpenGL ES 3.0 glVertexAttribDivisor()
*/
- void VertexAttribDivisor ( GLuint index, GLuint divisor )
+ void VertexAttribDivisor(GLuint index, GLuint divisor)
{
- LOG_GL("VertexAttribDivisor(%d, %d)\n", index, divisor );
- CHECK_GL( mGlAbstraction, mGlAbstraction.VertexAttribDivisor( index, divisor ) );
+ LOG_GL("VertexAttribDivisor(%d, %d)\n", index, divisor);
+ CHECK_GL(mGlAbstraction, mGlAbstraction.VertexAttribDivisor(index, divisor));
}
/**
* Wrapper for OpenGL ES 2.0 glVertexAttribPointer()
*/
- void VertexAttribPointer( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr )
+ void VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
{
- LOG_GL("VertexAttribPointer(%d, %d, %d, %d, %d, %x)\n", index, size, type, normalized, stride, ptr );
- CHECK_GL( mGlAbstraction, mGlAbstraction.VertexAttribPointer( index, size, type, normalized, stride, ptr ) );
+ LOG_GL("VertexAttribPointer(%d, %d, %d, %d, %d, %x)\n", index, size, type, normalized, stride, ptr);
+ CHECK_GL(mGlAbstraction, mGlAbstraction.VertexAttribPointer(index, size, type, normalized, stride, ptr));
}
/**
* Wrapper for OpenGL ES 3.0 glInvalidateFramebuffer()
*/
- void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
+ void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
{
LOG_GL("InvalidateFramebuffer\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.InvalidateFramebuffer(target, numAttachments, attachments) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.InvalidateFramebuffer(target, numAttachments, attachments));
}
/**
void SetBlend(bool enable)
{
// Avoid unecessary calls to glEnable/glDisable
- if (enable != mBlendEnabled)
+ if(enable != mBlendEnabled)
{
mBlendEnabled = enable;
- if (enable)
+ if(enable)
{
LOG_GL("Enable GL_BLEND\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_BLEND) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_BLEND));
}
else
{
LOG_GL("Disable GL_BLEND\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_BLEND) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_BLEND));
}
}
}
*
* @param[in] enable True if GL_DEPTH_TEST should be enabled.
*/
- void EnableDepthBuffer( bool enable )
+ void EnableDepthBuffer(bool enable)
{
// Avoid unecessary calls to glEnable/glDisable
- if( enable != mDepthBufferEnabled )
+ if(enable != mDepthBufferEnabled)
{
mDepthBufferEnabled = enable;
- if (enable)
+ if(enable)
{
LOG_GL("Enable GL_DEPTH_TEST\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_DEPTH_TEST) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_DEPTH_TEST));
}
else
{
LOG_GL("Disable GL_DEPTH_TEST\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_DEPTH_TEST) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_DEPTH_TEST));
}
}
}
void SetDither(bool enable)
{
// Avoid unecessary calls to glEnable/glDisable
- if (enable != mDitherEnabled)
+ if(enable != mDitherEnabled)
{
mDitherEnabled = enable;
- if (enable)
+ if(enable)
{
LOG_GL("Enable GL_DITHER\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_DITHER) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_DITHER));
}
else
{
LOG_GL("Disable GL_DITHER\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_DITHER) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_DITHER));
}
}
}
void SetPolygonOffsetFill(bool enable)
{
// Avoid unecessary calls to glEnable/glDisable
- if (enable != mPolygonOffsetFillEnabled)
+ if(enable != mPolygonOffsetFillEnabled)
{
mPolygonOffsetFillEnabled = enable;
- if (enable)
+ if(enable)
{
LOG_GL("Enable GL_POLYGON_OFFSET_FILL\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_POLYGON_OFFSET_FILL) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_POLYGON_OFFSET_FILL));
}
else
{
LOG_GL("Disable GL_POLYGON_OFFSET_FILL\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_POLYGON_OFFSET_FILL) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_POLYGON_OFFSET_FILL));
}
}
}
void SetSampleAlphaToCoverage(bool enable)
{
// Avoid unecessary calls to glEnable/glDisable
- if (enable != mSampleAlphaToCoverageEnabled)
+ if(enable != mSampleAlphaToCoverageEnabled)
{
mSampleAlphaToCoverageEnabled = enable;
- if (enable)
+ if(enable)
{
LOG_GL("Enable GL_SAMPLE_ALPHA_TO_COVERAGE\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_SAMPLE_ALPHA_TO_COVERAGE) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_SAMPLE_ALPHA_TO_COVERAGE));
}
else
{
LOG_GL("Disable GL_SAMPLE_ALPHA_TO_COVERAGE\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_SAMPLE_ALPHA_TO_COVERAGE) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_SAMPLE_ALPHA_TO_COVERAGE));
}
}
}
void SetSampleCoverage(bool enable)
{
// Avoid unecessary calls to glEnable/glDisable
- if (enable != mSampleCoverageEnabled)
+ if(enable != mSampleCoverageEnabled)
{
mSampleCoverageEnabled = enable;
- if (enable)
+ if(enable)
{
LOG_GL("Enable GL_SAMPLE_COVERAGE\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_SAMPLE_COVERAGE) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_SAMPLE_COVERAGE));
}
else
{
LOG_GL("Disable GL_SAMPLE_COVERAGE\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_SAMPLE_COVERAGE) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_SAMPLE_COVERAGE));
}
}
}
void SetScissorTest(bool enable)
{
// Avoid unecessary calls to glEnable/glDisable
- if (enable != mScissorTestEnabled)
+ if(enable != mScissorTestEnabled)
{
mScissorTestEnabled = enable;
- if (enable)
+ if(enable)
{
LOG_GL("Enable GL_SCISSOR_TEST\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_SCISSOR_TEST) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_SCISSOR_TEST));
}
else
{
LOG_GL("Disable GL_SCISSOR_TEST\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_SCISSOR_TEST) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_SCISSOR_TEST));
}
}
}
void EnableStencilBuffer(bool enable)
{
// Avoid unecessary calls to glEnable/glDisable
- if( enable != mStencilBufferEnabled )
+ if(enable != mStencilBufferEnabled)
{
mStencilBufferEnabled = enable;
- if (enable)
+ if(enable)
{
LOG_GL("Enable GL_STENCIL_TEST\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_STENCIL_TEST) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Enable(GL_STENCIL_TEST));
}
else
{
LOG_GL("Disable GL_STENCIL_TEST\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_STENCIL_TEST) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Disable(GL_STENCIL_TEST));
}
}
}
void EndQuery(GLenum target)
{
LOG_GL("EndQuery %d\n", target);
- CHECK_GL( mGlAbstraction, mGlAbstraction.EndQuery(target) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.EndQuery(target));
}
/**
void EndTransformFeedback()
{
LOG_GL("EndTransformFeedback\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.EndTransformFeedback() );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.EndTransformFeedback());
}
/**
void Finish(void)
{
LOG_GL("Finish\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Finish() );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Finish());
}
/**
void Flush(void)
{
LOG_GL("Flush\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.Flush() );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Flush());
}
/**
void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
{
LOG_GL("FramebufferRenderbuffer %x %x %x %d\n", target, attachment, renderbuffertarget, renderbuffer);
- CHECK_GL( mGlAbstraction, mGlAbstraction.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer));
}
/**
void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
LOG_GL("FramebufferTexture2D %x %x %x %d %d\n", target, attachment, textarget, texture, level);
- CHECK_GL( mGlAbstraction, mGlAbstraction.FramebufferTexture2D(target, attachment, textarget, texture, level) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.FramebufferTexture2D(target, attachment, textarget, texture, level));
}
/**
void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
LOG_GL("FramebufferTextureLayer %x %x %d %d %d\n", target, attachment, texture, level, layer);
- CHECK_GL( mGlAbstraction, mGlAbstraction.FramebufferTextureLayer(target, attachment, texture, level, layer) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.FramebufferTextureLayer(target, attachment, texture, level, layer));
}
/**
void FrontFace(GLenum mode)
{
LOG_GL("FrontFace %x\n", mode);
- CHECK_GL( mGlAbstraction, mGlAbstraction.FrontFace(mode) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.FrontFace(mode));
}
/**
void GenBuffers(GLsizei n, GLuint* buffers)
{
LOG_GL("GenBuffers %d\n", n, buffers);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GenBuffers(n, buffers) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GenBuffers(n, buffers));
}
/**
void GenerateMipmap(GLenum target)
{
LOG_GL("GenerateMipmap %x\n", target);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GenerateMipmap(target) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GenerateMipmap(target));
}
/**
void GenFramebuffers(GLsizei n, GLuint* framebuffers)
{
LOG_GL("GenFramebuffers %d %p\n", n, framebuffers);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GenFramebuffers(n, framebuffers) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GenFramebuffers(n, framebuffers));
- mFrameBufferStateCache.FrameBuffersCreated( n, framebuffers );
+ mFrameBufferStateCache.FrameBuffersCreated(n, framebuffers);
}
/**
void GenRenderbuffers(GLsizei n, GLuint* renderbuffers)
{
LOG_GL("GenRenderbuffers %d %p\n", n, renderbuffers);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GenRenderbuffers(n, renderbuffers) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GenRenderbuffers(n, renderbuffers));
}
/**
void GenTextures(GLsizei n, GLuint* textures)
{
LOG_GL("GenTextures %d %p\n", n, textures);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GenTextures(n, textures) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GenTextures(n, textures));
}
/**
void GetBooleanv(GLenum pname, GLboolean* params)
{
LOG_GL("GetBooleanv %x\n", pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetBooleanv(pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetBooleanv(pname, params));
}
/**
void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
LOG_GL("GetBufferParameteriv %x %x %p\n", target, pname, params);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetBufferParameteriv(target, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetBufferParameteriv(target, pname, params));
}
/**
void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
{
LOG_GL("GetBufferPointerv %x %x %p\n", target, pname, params);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetBufferPointerv(target, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetBufferPointerv(target, pname, params));
}
/**
void GetFloatv(GLenum pname, GLfloat* params)
{
LOG_GL("GetFloatv %x\n", pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetFloatv(pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetFloatv(pname, params));
}
/**
void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
{
LOG_GL("GetFramebufferAttachmentParameteriv %x %x %x\n", target, attachment, pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetFramebufferAttachmentParameteriv(target, attachment, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetFramebufferAttachmentParameteriv(target, attachment, pname, params));
}
/**
void GetIntegerv(GLenum pname, GLint* params)
{
LOG_GL("GetIntegerv %x\n", pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetIntegerv(pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetIntegerv(pname, params));
}
/**
void GetQueryiv(GLenum target, GLenum pname, GLint* params)
{
LOG_GL("GetQueryiv %x %x\n", target, pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetQueryiv(target, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetQueryiv(target, pname, params));
}
/**
void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
{
LOG_GL("GetQueryObjectuiv %u %x %p\n", id, pname, params);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetQueryObjectuiv(id, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetQueryObjectuiv(id, pname, params));
}
/**
void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
LOG_GL("GetRenderbufferParameteriv %x %x\n", target, pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetRenderbufferParameteriv(target, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetRenderbufferParameteriv(target, pname, params));
}
/**
const GLubyte* GetString(GLenum name)
{
LOG_GL("GetString %x\n", name);
- const GLubyte* str = CHECK_GL( mGlAbstraction, mGlAbstraction.GetString(name) );
+ const GLubyte* str = CHECK_GL(mGlAbstraction, mGlAbstraction.GetString(name));
return str;
}
void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
{
LOG_GL("GetTexParameterfv %x %x\n", target, pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetTexParameterfv(target, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetTexParameterfv(target, pname, params));
}
/**
void GetTexParameteriv(GLenum target, GLenum pname, GLint* params)
{
LOG_GL("GetTexParameteriv %x %x\n", target, pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetTexParameteriv(target, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.GetTexParameteriv(target, pname, params));
}
/**
void Hint(GLenum target, GLenum mode)
{
LOG_GL("Hint %x %x\n", target, mode);
- CHECK_GL( mGlAbstraction, mGlAbstraction.Hint(target, mode) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.Hint(target, mode));
}
/**
GLboolean IsBuffer(GLuint buffer)
{
LOG_GL("IsBuffer %d\n", buffer);
- GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.IsBuffer(buffer) );
+ GLboolean val = CHECK_GL(mGlAbstraction, mGlAbstraction.IsBuffer(buffer));
return val;
}
GLboolean IsEnabled(GLenum cap)
{
LOG_GL("IsEnabled %x\n", cap);
- GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.IsEnabled(cap) );
+ GLboolean val = CHECK_GL(mGlAbstraction, mGlAbstraction.IsEnabled(cap));
return val;
}
GLboolean IsFramebuffer(GLuint framebuffer)
{
LOG_GL("IsFramebuffer %d\n", framebuffer);
- GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.IsFramebuffer(framebuffer) );
+ GLboolean val = CHECK_GL(mGlAbstraction, mGlAbstraction.IsFramebuffer(framebuffer));
return val;
}
GLboolean IsQuery(GLuint id)
{
LOG_GL("IsQuery %u\n", id);
- GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.IsQuery(id) );
+ GLboolean val = CHECK_GL(mGlAbstraction, mGlAbstraction.IsQuery(id));
return val;
}
GLboolean IsRenderbuffer(GLuint renderbuffer)
{
LOG_GL("IsRenderbuffer %d\n", renderbuffer);
- GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.IsRenderbuffer(renderbuffer) );
+ GLboolean val = CHECK_GL(mGlAbstraction, mGlAbstraction.IsRenderbuffer(renderbuffer));
return val;
}
GLboolean IsTexture(GLuint texture)
{
LOG_GL("IsTexture %d\n", texture);
- GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.IsTexture(texture) );
+ GLboolean val = CHECK_GL(mGlAbstraction, mGlAbstraction.IsTexture(texture));
return val;
}
GLboolean IsTransformFeedback(GLuint id)
{
LOG_GL("IsTransformFeedback %u\n", id);
- GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.IsTransformFeedback(id) );
+ GLboolean val = CHECK_GL(mGlAbstraction, mGlAbstraction.IsTransformFeedback(id));
return val;
}
void LineWidth(GLfloat width)
{
LOG_GL("LineWidth %f\n", width);
- CHECK_GL( mGlAbstraction, mGlAbstraction.LineWidth(width) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.LineWidth(width));
}
/**
void PauseTransformFeedback()
{
LOG_GL("PauseTransformFeedback\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.PauseTransformFeedback() );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.PauseTransformFeedback());
}
/**
void PixelStorei(GLenum pname, GLint param)
{
LOG_GL("PixelStorei %x %d\n", pname, param);
- CHECK_GL( mGlAbstraction, mGlAbstraction.PixelStorei(pname, param) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.PixelStorei(pname, param));
}
/**
void PolygonOffset(GLfloat factor, GLfloat units)
{
LOG_GL("PolygonOffset %f %f\n", factor, units);
- CHECK_GL( mGlAbstraction, mGlAbstraction.PolygonOffset(factor, units) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.PolygonOffset(factor, units));
}
/**
void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
{
LOG_GL("ReadPixels %d %d %d %d %x %x\n", x, y, width, height, format, type);
- CHECK_GL( mGlAbstraction, mGlAbstraction.ReadPixels(x, y, width, height, format, type, pixels) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.ReadPixels(x, y, width, height, format, type, pixels));
}
/**
void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
{
LOG_GL("RenderbufferStorage %x %x %d %d\n", target, internalformat, width, height);
- CHECK_GL( mGlAbstraction, mGlAbstraction.RenderbufferStorage(target, internalformat, width, height) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.RenderbufferStorage(target, internalformat, width, height));
}
/**
void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
{
LOG_GL("RenderbufferStorageMultisample %x %u %x %d %d\n", target, samples, internalformat, width, height);
- CHECK_GL( mGlAbstraction, mGlAbstraction.RenderbufferStorageMultisample(target, samples, internalformat, width, height) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.RenderbufferStorageMultisample(target, samples, internalformat, width, height));
}
/**
void ResumeTransformFeedback()
{
LOG_GL("ResumeTransformFeedback\n");
- CHECK_GL( mGlAbstraction, mGlAbstraction.ResumeTransformFeedback() );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.ResumeTransformFeedback());
}
/**
void SampleCoverage(GLclampf value, GLboolean invert)
{
LOG_GL("SampleCoverage %f %s\n", value, invert ? "True" : "False");
- CHECK_GL( mGlAbstraction, mGlAbstraction.SampleCoverage(value, invert) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.SampleCoverage(value, invert));
}
/**
*/
void StencilFunc(GLenum func, GLint ref, GLuint mask)
{
- if( ( func != mStencilFunc ) || ( ref != mStencilFuncRef ) || ( mask != mStencilFuncMask ) )
+ if((func != mStencilFunc) || (ref != mStencilFuncRef) || (mask != mStencilFuncMask))
{
- mStencilFunc = func;
- mStencilFuncRef = ref;
+ mStencilFunc = func;
+ mStencilFuncRef = ref;
mStencilFuncMask = mask;
LOG_GL("StencilFunc %x %d %d\n", func, ref, mask);
- CHECK_GL( mGlAbstraction, mGlAbstraction.StencilFunc(func, ref, mask) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.StencilFunc(func, ref, mask));
}
}
void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
{
LOG_GL("StencilFuncSeparate %x %x %d %d\n", face, func, ref, mask);
- CHECK_GL( mGlAbstraction, mGlAbstraction.StencilFuncSeparate(face, func, ref, mask) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.StencilFuncSeparate(face, func, ref, mask));
}
/**
*/
void StencilMask(GLuint mask)
{
- if( mask != mStencilMask )
+ if(mask != mStencilMask)
{
mStencilMask = mask;
LOG_GL("StencilMask %d\n", mask);
- CHECK_GL( mGlAbstraction, mGlAbstraction.StencilMask(mask) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.StencilMask(mask));
}
}
void StencilMaskSeparate(GLenum face, GLuint mask)
{
LOG_GL("StencilMaskSeparate %x %d\n", face, mask);
- CHECK_GL( mGlAbstraction, mGlAbstraction.StencilMaskSeparate(face, mask) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.StencilMaskSeparate(face, mask));
}
/**
*/
void StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
{
- if( ( fail != mStencilOpFail ) || ( zfail != mStencilOpDepthFail ) || ( zpass != mStencilOpDepthPass ) )
+ if((fail != mStencilOpFail) || (zfail != mStencilOpDepthFail) || (zpass != mStencilOpDepthPass))
{
- mStencilOpFail = fail;
+ mStencilOpFail = fail;
mStencilOpDepthFail = zfail;
mStencilOpDepthPass = zpass;
LOG_GL("StencilOp %x %x %x\n", fail, zfail, zpass);
- CHECK_GL( mGlAbstraction, mGlAbstraction.StencilOp(fail, zfail, zpass) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.StencilOp(fail, zfail, zpass));
}
}
void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
{
LOG_GL("StencilOpSeparate %x %x %x %x\n", face, fail, zfail, zpass);
- CHECK_GL( mGlAbstraction, mGlAbstraction.StencilOpSeparate(face, fail, zfail, zpass) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.StencilOpSeparate(face, fail, zfail, zpass));
}
/**
* Wrapper for OpenGL ES 2.0 glTexImage2D()
*/
- void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type, const void* pixels)
+ void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
{
LOG_GL("TexImage2D %x %d %d %dx%d %d %x %x %p\n", target, level, internalformat, width, height, border, format, type, pixels);
- CHECK_GL( mGlAbstraction, mGlAbstraction.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels));
}
/**
* Wrapper for OpenGL ES 3.0 glTexImage3D()
*/
- void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type, const void* pixels)
+ void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels)
{
LOG_GL("TexImage3D %x %d %d %dx%dx%d %d %x %x %p\n", target, level, internalformat, width, height, depth, border, format, type, pixels);
- CHECK_GL( mGlAbstraction, mGlAbstraction.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels));
}
/**
void TexParameterf(GLenum target, GLenum pname, GLfloat param)
{
LOG_GL("TexParameterf %x %x %f\n", target, pname, param);
- CHECK_GL( mGlAbstraction, mGlAbstraction.TexParameterf(target, pname, param) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.TexParameterf(target, pname, param));
}
/**
void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
{
LOG_GL("TexParameterfv %x %x\n", target, pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.TexParameterfv(target, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.TexParameterfv(target, pname, params));
}
/**
void TexParameteri(GLenum target, GLenum pname, GLint param)
{
LOG_GL("TexParameteri %x %x %d\n", target, pname, param);
- CHECK_GL( mGlAbstraction, mGlAbstraction.TexParameteri(target, pname, param) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.TexParameteri(target, pname, param));
}
/**
void TexParameteriv(GLenum target, GLenum pname, const GLint* params)
{
LOG_GL("TexParameteriv %x %x\n", target, pname);
- CHECK_GL( mGlAbstraction, mGlAbstraction.TexParameteriv(target, pname, params) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.TexParameteriv(target, pname, params));
}
/**
* Wrapper for OpenGL ES 2.0 glTexSubImage2D()
*/
- void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const void* pixels)
+ void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
{
LOG_GL("TexSubImage2D %x %d %d %d %d %d %x %x %p\n", target, level, xoffset, yoffset, width, height, format, type, pixels);
- CHECK_GL( mGlAbstraction, mGlAbstraction.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels));
}
/**
* Wrapper for OpenGL ES 3.0 glTexSubImage3D()
*/
- void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const void* pixels)
+ void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels)
{
LOG_GL("TexSubImage3D %x %d %d %d %d %d %d %d %x %x %p\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
- CHECK_GL( mGlAbstraction, mGlAbstraction.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels) );
+ CHECK_GL(mGlAbstraction, mGlAbstraction.TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels));
}
/**
GLboolean UnmapBuffer(GLenum target)
{
LOG_GL("UnmapBuffer %x \n", target);
- GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.UnmapBuffer(target) );
+ GLboolean val = CHECK_GL(mGlAbstraction, mGlAbstraction.UnmapBuffer(target));
return val;
}
*/
void BlendBarrier()
{
- LOG_GL( "BlendBarrier\n" );
- CHECK_GL( mGlAbstraction, mGlAbstraction.BlendBarrier() );
+ LOG_GL("BlendBarrier\n");
+ CHECK_GL(mGlAbstraction, mGlAbstraction.BlendBarrier());
}
/**
void SetSurfaceOrientation(int orientation)
{
- LOG_GL( "SetSurfaceOrientation: orientation: %d\n", orientation );
+ LOG_GL("SetSurfaceOrientation: orientation: %d\n", orientation);
mSurfaceOrientation = orientation;
}
* Get the current viewport.
* @return Viewport rectangle.
*/
- const Rect< int >& GetViewport();
+ const Rect<int>& GetViewport();
private: // Implementation
-
/**
* @return true if next draw operation will write to depth buffer
*/
*/
bool StencilBufferWriteEnabled() const
{
- return mStencilBufferEnabled && ( mStencilMask > 0 );
+ return mStencilBufferEnabled && (mStencilMask > 0);
}
/**
void InitializeGlState();
private: // Data
-
Integration::GlAbstraction& mGlAbstraction;
bool mGlContextCreated; ///< True if the OpenGL context has been created
// glEnable/glDisable states
- bool mColorMask;
+ bool mColorMask;
GLuint mStencilMask;
- bool mBlendEnabled;
- bool mDepthBufferEnabled;
- bool mDepthMaskEnabled;
- bool mDitherEnabled;
- bool mPolygonOffsetFillEnabled;
- bool mSampleAlphaToCoverageEnabled;
- bool mSampleCoverageEnabled;
- bool mScissorTestEnabled;
- bool mStencilBufferEnabled;
- bool mClearColorSet;
- bool mUsingDefaultBlendColor;
+ bool mBlendEnabled;
+ bool mDepthBufferEnabled;
+ bool mDepthMaskEnabled;
+ bool mDitherEnabled;
+ bool mPolygonOffsetFillEnabled;
+ bool mSampleAlphaToCoverageEnabled;
+ bool mSampleCoverageEnabled;
+ bool mScissorTestEnabled;
+ bool mStencilBufferEnabled;
+ bool mClearColorSet;
+ bool mUsingDefaultBlendColor;
// glBindBuffer() state
- GLuint mBoundArrayBufferId; ///< The ID passed to glBindBuffer(GL_ARRAY_BUFFER)
- GLuint mBoundElementArrayBufferId; ///< The ID passed to glBindBuffer(GL_ELEMENT_ARRAY_BUFFER)
+ GLuint mBoundArrayBufferId; ///< The ID passed to glBindBuffer(GL_ARRAY_BUFFER)
+ GLuint mBoundElementArrayBufferId; ///< The ID passed to glBindBuffer(GL_ELEMENT_ARRAY_BUFFER)
GLuint mBoundTransformFeedbackBufferId; ///< The ID passed to glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER)
// glBindTexture() state
TextureUnit mActiveTextureUnit;
- GLuint mBoundTextureId[ MAX_TEXTURE_UNITS ][MAX_TEXTURE_TARGET]; ///< The ID passed to glBindTexture()
+ GLuint mBoundTextureId[MAX_TEXTURE_UNITS][MAX_TEXTURE_TARGET]; ///< The ID passed to glBindTexture()
// glBlendColor() state
Vector4 mBlendColor; ///< Blend color
GLenum mBlendFuncSeparateDstAlpha; ///< The dstAlpha parameter passed to glBlendFuncSeparate()
// glBlendEquationSeparate state
- GLenum mBlendEquationSeparateModeRGB; ///< Controls RGB blend mode
- GLenum mBlendEquationSeparateModeAlpha; ///< Controls Alpha blend mode
+ GLenum mBlendEquationSeparateModeRGB; ///< Controls RGB blend mode
+ GLenum mBlendEquationSeparateModeAlpha; ///< Controls Alpha blend mode
// glStencilFunc() and glStencilOp() state.
GLenum mStencilFunc;
- GLint mStencilFuncRef;
+ GLint mStencilFuncRef;
GLuint mStencilFuncMask;
GLenum mStencilOpFail;
GLenum mStencilOpDepthFail;
GLenum mStencilOpDepthPass;
- GLenum mDepthFunction; ///The depth function
+ GLenum mDepthFunction; ///The depth function
- GLint mMaxTextureSize; ///< return value from GetIntegerv(GL_MAX_TEXTURE_SIZE)
- Vector4 mClearColor; ///< clear color
+ GLint mMaxTextureSize; ///< return value from GetIntegerv(GL_MAX_TEXTURE_SIZE)
+ Vector4 mClearColor; ///< clear color
// Face culling mode
Dali::FaceCullingMode::Type mCullFaceMode;
// cached viewport size
- Rect< int > mViewPort;
+ Rect<int> mViewPort;
// Vertex Attribute Buffer enable caching
- bool mVertexAttributeCachedState[ MAX_ATTRIBUTE_CACHE_SIZE ]; ///< Value cache for Enable Vertex Attribute
- bool mVertexAttributeCurrentState[ MAX_ATTRIBUTE_CACHE_SIZE ]; ///< Current state on the driver for Enable Vertex Attribute
+ bool mVertexAttributeCachedState[MAX_ATTRIBUTE_CACHE_SIZE]; ///< Value cache for Enable Vertex Attribute
+ bool mVertexAttributeCurrentState[MAX_ATTRIBUTE_CACHE_SIZE]; ///< Current state on the driver for Enable Vertex Attribute
- FrameBufferStateCache mFrameBufferStateCache; ///< frame buffer state cache
+ FrameBufferStateCache mFrameBufferStateCache; ///< frame buffer state cache
- OwnerContainer< Context* >* mSceneContexts; ///< The pointer of the container of contexts for surface rendering
+ OwnerContainer<Context*>* mSceneContexts; ///< The pointer of the container of contexts for surface rendering
int mSurfaceOrientation;
};
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
namespace Dali
{
-
namespace Internal
{
-
-ProgramController::ProgramController( Integration::GlAbstraction& glAbstraction )
-: mShaderSaver( nullptr ),
- mGlAbstraction( glAbstraction ),
- mCurrentProgram( nullptr ),
- mProgramBinaryFormat( 0 ),
- mNumberOfProgramBinaryFormats( 0 )
+ProgramController::ProgramController(Graphics::Controller& graphicsController)
+: mShaderSaver(nullptr),
+ mGraphicsController(graphicsController),
+ mCurrentProgram(nullptr),
+ mProgramBinaryFormat(0),
+ mNumberOfProgramBinaryFormats(0)
{
// we have 17 default programs so make room for those and a few custom ones as well
- mProgramCache.Reserve( 32 );
+ mProgramCache.Reserve(32);
}
ProgramController::~ProgramController() = default;
void ProgramController::ResetProgramMatrices()
{
const ProgramIterator end = mProgramCache.End();
- for ( ProgramIterator iter = mProgramCache.Begin(); iter != end; ++iter )
+ for(ProgramIterator iter = mProgramCache.Begin(); iter != end; ++iter)
{
Program* program = (*iter)->GetProgram();
- program->SetProjectionMatrix( nullptr );
- program->SetViewMatrix( nullptr );
+ program->SetProjectionMatrix(nullptr);
+ program->SetViewMatrix(nullptr);
}
}
void ProgramController::GlContextCreated()
{
// reset any potential previous errors
- LOG_GL( "GetError()\n" );
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetError() );
+ LOG_GL("GetError()\n");
+ Integration::GlAbstraction& glAbstraction = GetGlAbstraction();
+ CHECK_GL(glAbstraction, glAbstraction.GetError());
// find out if program binaries are supported and the format enum as well
Dali::Vector<GLint> programBinaryFormats;
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES, &mNumberOfProgramBinaryFormats ) );
- LOG_GL("GetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES) = %d\n", mNumberOfProgramBinaryFormats );
+ CHECK_GL(glAbstraction(), glAbstraction.GetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES, &mNumberOfProgramBinaryFormats));
+ LOG_GL("GetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES) = %d\n", mNumberOfProgramBinaryFormats);
- if( GL_NO_ERROR == mGlAbstraction.GetError() && 0 < mNumberOfProgramBinaryFormats )
+ if(GL_NO_ERROR == glAbstraction.GetError() && 0 < mNumberOfProgramBinaryFormats)
{
- programBinaryFormats.Resize( mNumberOfProgramBinaryFormats );
- CHECK_GL( mGlAbstraction, mGlAbstraction.GetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES, &programBinaryFormats[0] ) );
- LOG_GL("GetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES) = %d\n", programBinaryFormats[0] );
+ programBinaryFormats.Resize(mNumberOfProgramBinaryFormats);
+ CHECK_GL(glAbstraction, glAbstraction.GetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES, &programBinaryFormats[0]));
+ LOG_GL("GetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES) = %d\n", programBinaryFormats[0]);
mProgramBinaryFormat = programBinaryFormats[0];
}
}
void ProgramController::GlContextDestroyed()
{
mNumberOfProgramBinaryFormats = 0;
- mProgramBinaryFormat = 0;
+ mProgramBinaryFormat = 0;
- SetCurrentProgram( nullptr );
+ SetCurrentProgram(nullptr);
// Inform programs they are no longer valid
const ProgramIterator end = mProgramCache.End();
- for ( ProgramIterator iter = mProgramCache.Begin(); iter != end; ++iter )
+ for(ProgramIterator iter = mProgramCache.Begin(); iter != end; ++iter)
{
(*iter)->GetProgram()->GlContextDestroyed();
}
Integration::GlAbstraction& ProgramController::GetGlAbstraction()
{
- return mGlAbstraction;
+ return mGraphicsController.GetGlAbstraction();
}
-Program* ProgramController::GetProgram( size_t shaderHash )
+Program* ProgramController::GetProgram(size_t shaderHash)
{
- Program* program = nullptr;
- const ProgramIterator end = mProgramCache.End();
- for ( ProgramIterator iter = mProgramCache.Begin(); iter != end; ++iter )
+ Program* program = nullptr;
+ const ProgramIterator end = mProgramCache.End();
+ for(ProgramIterator iter = mProgramCache.Begin(); iter != end; ++iter)
{
size_t hash = (*iter)->GetHash();
- if( shaderHash == hash )
+ if(shaderHash == hash)
{
program = (*iter)->GetProgram();
break;
return program;
}
-void ProgramController::AddProgram( size_t shaderHash, Program* program )
+void ProgramController::AddProgram(size_t shaderHash, Program* program)
{
// we expect unique hash values so its event thread sides job to guarantee that
// AddProgram is only called after program checks that GetProgram returns NULL
- mProgramCache.PushBack( new ProgramPair( program, shaderHash ) );
+ mProgramCache.PushBack(new ProgramPair(program, shaderHash));
}
Program* ProgramController::GetCurrentProgram()
return mCurrentProgram;
}
-void ProgramController::SetCurrentProgram( Program* program )
+void ProgramController::SetCurrentProgram(Program* program)
{
mCurrentProgram = program;
}
return mProgramBinaryFormat;
}
-void ProgramController::StoreBinary( Internal::ShaderDataPtr programData )
+void ProgramController::StoreBinary(Internal::ShaderDataPtr programData)
{
- DALI_ASSERT_DEBUG( programData->GetBufferSize() > 0 );
- DALI_ASSERT_DEBUG( mShaderSaver && "SetShaderSaver() should have been called during startup." );
+ DALI_ASSERT_DEBUG(programData->GetBufferSize() > 0);
+ DALI_ASSERT_DEBUG(mShaderSaver && "SetShaderSaver() should have been called during startup.");
- if( mShaderSaver != nullptr )
+ if(mShaderSaver != nullptr)
{
- mShaderSaver->SaveBinary( programData );
+ mShaderSaver->SaveBinary(programData);
}
}
-void ProgramController::SetShaderSaver( ShaderSaver& shaderSaver )
+void ProgramController::SetShaderSaver(ShaderSaver& shaderSaver)
{
mShaderSaver = &shaderSaver;
}
void ProgramController::ClearCurrentProgram()
{
- SetCurrentProgram( nullptr );
+ SetCurrentProgram(nullptr);
}
} // namespace Internal
#define DALI_INTERNAL_PROGRAM_CONTROLLER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
// INTERNAL INCLUDES
#include <dali/devel-api/common/owner-container.h>
+#include <dali/graphics-api/graphics-controller.h>
#include <dali/internal/common/shader-data.h>
-#include <dali/internal/render/shaders/program.h>
#include <dali/internal/render/shaders/program-cache.h>
+#include <dali/internal/render/shaders/program.h>
namespace Dali
{
-
namespace Internal
{
-
class ShaderSaver;
/**
class ProgramController : public ProgramCache
{
public:
-
/**
* Wrapper for a program and its hash code
*/
class ProgramPair
{
public: // API
-
/**
* Constructor
* @param program
* @param shaderHash
*/
- ProgramPair( Program* program, size_t shaderHash )
- : mProgram( program ), mShaderHash( shaderHash )
- { }
+ ProgramPair(Program* program, size_t shaderHash)
+ : mProgram(program),
+ mShaderHash(shaderHash)
+ {
+ }
/**
* Destructor, non-virtual as not a base
}
private: // Not implemented
- ProgramPair( const ProgramPair& );
- ProgramPair& operator=( const ProgramPair& );
+ ProgramPair(const ProgramPair&);
+ ProgramPair& operator=(const ProgramPair&);
private: // Data
Program* mProgram;
- size_t mShaderHash;
+ size_t mShaderHash;
};
/**
* Constructor
- * @param postProcessDispatcher to send save binary message back to update
+ * graphicsController The graphics backend controller
*/
- ProgramController( Integration::GlAbstraction& glAbstraction );
+ ProgramController(Graphics::Controller& graphicsController);
/**
* Destructor, non virtual as not a base class
~ProgramController() override;
public: // API
-
/**
* Resets the program matrices. Must be called at the beginning of every frame
*/
* Set the destination for compiler shader binaries so they can be saved.
* @note Must be called during initialisation.
*/
- void SetShaderSaver( ShaderSaver& shaderSaver );
+ void SetShaderSaver(ShaderSaver& shaderSaver);
/**
* Clear current cached program
void ClearCurrentProgram();
private: // From ProgramCache
-
/**
* @copydoc ProgramCache::GetGlAbstraction
*/
/**
* @copydoc ProgramCache::GetProgram
*/
- Program* GetProgram( size_t shaderHash ) override;
+ Program* GetProgram(size_t shaderHash) override;
/**
* @copydoc ProgramCache::AddProgram
*/
- void AddProgram( size_t shaderHash, Program* program ) override;
+ void AddProgram(size_t shaderHash, Program* program) override;
/**
* @copydoc ProgramCache::GetCurrentProgram
/**
* @copydoc ProgramCache::SetCurrentProgram
*/
- void SetCurrentProgram( Program* program ) override;
+ void SetCurrentProgram(Program* program) override;
/**
* @copydoc ProgramCache::IsBinarySupported
/**
* @copydoc ProgramCache::StoreBinary
*/
- void StoreBinary( Internal::ShaderDataPtr programData ) override;
+ void StoreBinary(Internal::ShaderDataPtr programData) override;
private: // not implemented as non-copyable
-
- ProgramController( const ProgramController& rhs );
- ProgramController& operator=( const ProgramController& rhs );
+ ProgramController(const ProgramController& rhs);
+ ProgramController& operator=(const ProgramController& rhs);
private: // Data
-
- ShaderSaver* mShaderSaver;
- Integration::GlAbstraction& mGlAbstraction;
- Program* mCurrentProgram;
+ ShaderSaver* mShaderSaver;
+ Graphics::Controller& mGraphicsController;
+ Program* mCurrentProgram;
using ProgramContainer = OwnerContainer<ProgramPair*>;
using ProgramIterator = ProgramContainer::Iterator;
GLint mProgramBinaryFormat;
GLint mNumberOfProgramBinaryFormats;
-
};
} // namespace Internal
} // namespace Dali
#endif // DALI_INTERNAL_PROGRAM_CONTROLLER_H
-
%files integration-devel
%defattr(-,root,root,-)
%{_includedir}/dali/integration-api/*
+%{_includedir}/dali/graphics-api/*