Merge "Add ApplyCustomFragmentPrefix" into devel/master
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 21 Jul 2021 06:23:35 +0000 (06:23 +0000)
committerGerrit Code Review <gerrit@review>
Wed, 21 Jul 2021 06:23:35 +0000 (06:23 +0000)
24 files changed:
automated-tests/src/dali/dali-test-suite-utils/test-gesture-generator.cpp
automated-tests/src/dali/dali-test-suite-utils/test-gesture-generator.h
automated-tests/src/dali/dali-test-suite-utils/test-graphics-reflection.cpp
automated-tests/src/dali/dali-test-suite-utils/test-graphics-reflection.h
automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp
automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp
automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp
automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp
automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp
automated-tests/src/dali/utc-Dali-TapGestureRecognizer.cpp
dali/graphics-api/graphics-reflection.h
dali/internal/event/events/event-processor.cpp
dali/internal/event/events/tap-gesture/tap-gesture-recognizer.cpp
dali/internal/event/events/tap-gesture/tap-gesture-recognizer.h
dali/internal/render/common/render-manager.cpp
dali/internal/render/renderers/render-geometry.h
dali/internal/render/renderers/render-renderer.cpp
dali/internal/render/renderers/render-renderer.h
dali/internal/render/renderers/uniform-buffer.cpp
dali/internal/update/rendering/scene-graph-renderer.cpp
dali/internal/update/rendering/scene-graph-renderer.h
dali/public-api/actors/actor.h
dali/public-api/dali-core-version.cpp
packaging/dali.spec

index 4b465a7..4532c6e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -149,16 +149,23 @@ void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time)
   application.ProcessEvent(GenerateSingleTouch(PointState::UP, pos, time));
 }
 
+void TestTriggerTap(TestApplication& application)
+{
+  application.GetPlatform().TriggerTimer();
+}
+
 void TestGenerateTap(TestApplication& application, float x, float y, uint32_t time_down)
 {
   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(x, y), time_down));
   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(x, y), time_down + 20));
+  TestTriggerTap(application);
 }
 
 void TestGenerateTwoPointTap(TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down)
 {
   application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(x1, y1), PointState::DOWN, Vector2(x2, y2), time_down));
   application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(x1, y1), PointState::UP, Vector2(x2, y2), time_down + 20));
+  TestTriggerTap(application);
 }
 
 void TestGenerateRotation(TestApplication& application)
index e6e367d..cb3b1a6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TEST_GESTURE_GENERATOR_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.
@@ -94,6 +94,11 @@ void TestMovePan(TestApplication& application, Vector2 pos, uint32_t time = 400)
 void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time = 500);
 
 /**
+ * Triggers the timer to begin a tap gesture
+ */
+void TestTriggerTap(TestApplication& application);
+
+/**
  * Produces a single point tap gesture with a 20ms interval
  */
 void TestGenerateTap(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100);
index d59f29f..8493992 100644 (file)
@@ -240,9 +240,10 @@ bool TestGraphicsReflection::GetNamedUniform(const std::string& name, Dali::Grap
   return true;
 }
 
-std::vector<Dali::Graphics::UniformInfo> TestGraphicsReflection::GetSamplers() const
+const std::vector<Dali::Graphics::UniformInfo>& TestGraphicsReflection::GetSamplers() const
 {
-  return std::vector<Dali::Graphics::UniformInfo>{};
+  static std::vector<Dali::Graphics::UniformInfo> samplers{};
+  return samplers;
 }
 
 Graphics::ShaderLanguage TestGraphicsReflection::GetLanguage() const
index 7af052e..2147cae 100644 (file)
@@ -28,22 +28,22 @@ class TestGraphicsReflection : public Graphics::Reflection
 public:
   TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vertexFormats, const Graphics::ProgramCreateInfo& createInfo, std::vector<UniformData>& customUniforms);
 
-  uint32_t                                   GetVertexAttributeLocation(const std::string& name) const override;
-  Dali::Graphics::VertexInputAttributeFormat GetVertexAttributeFormat(uint32_t location) const override;
-  std::string                                GetVertexAttributeName(uint32_t location) const override;
-  std::vector<uint32_t>                      GetVertexAttributeLocations() const override;
-  uint32_t                                   GetUniformBlockCount() const override;
-  uint32_t                                   GetUniformBlockBinding(uint32_t index) const override;
-  uint32_t                                   GetUniformBlockSize(uint32_t index) const override;
-  bool                                       GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInfo& out) const override;
-  std::vector<uint32_t>                      GetUniformBlockLocations() const override;
-  std::string                                GetUniformBlockName(uint32_t blockIndex) const override;
-  uint32_t                                   GetUniformBlockMemberCount(uint32_t blockIndex) const override;
-  std::string                                GetUniformBlockMemberName(uint32_t blockIndex, uint32_t memberLocation) const override;
-  uint32_t                                   GetUniformBlockMemberOffset(uint32_t blockIndex, uint32_t memberLocation) const override;
-  bool                                       GetNamedUniform(const std::string& name, Dali::Graphics::UniformInfo& out) const override;
-  std::vector<Dali::Graphics::UniformInfo>   GetSamplers() const override;
-  Graphics::ShaderLanguage                   GetLanguage() const override;
+  uint32_t                                        GetVertexAttributeLocation(const std::string& name) const override;
+  Dali::Graphics::VertexInputAttributeFormat      GetVertexAttributeFormat(uint32_t location) const override;
+  std::string                                     GetVertexAttributeName(uint32_t location) const override;
+  std::vector<uint32_t>                           GetVertexAttributeLocations() const override;
+  uint32_t                                        GetUniformBlockCount() const override;
+  uint32_t                                        GetUniformBlockBinding(uint32_t index) const override;
+  uint32_t                                        GetUniformBlockSize(uint32_t index) const override;
+  bool                                            GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInfo& out) const override;
+  std::vector<uint32_t>                           GetUniformBlockLocations() const override;
+  std::string                                     GetUniformBlockName(uint32_t blockIndex) const override;
+  uint32_t                                        GetUniformBlockMemberCount(uint32_t blockIndex) const override;
+  std::string                                     GetUniformBlockMemberName(uint32_t blockIndex, uint32_t memberLocation) const override;
+  uint32_t                                        GetUniformBlockMemberOffset(uint32_t blockIndex, uint32_t memberLocation) const override;
+  bool                                            GetNamedUniform(const std::string& name, Dali::Graphics::UniformInfo& out) const override;
+  const std::vector<Dali::Graphics::UniformInfo>& GetSamplers() const override;
+  Graphics::ShaderLanguage                        GetLanguage() const override;
 
 public: // Test methods
   void SetAttributes(std::vector<std::string> locations)
index 983aefe..0909376 100644 (file)
@@ -994,49 +994,6 @@ int UtcDaliLongPressGestureSetMinimumHoldingTime(void)
   END_TEST;
 }
 
-int UtcDaliLongPressGestureInterruptedWhenTouchConsumed(void)
-{
-  TestApplication application;
-
-  Actor actor = Actor::New();
-  actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
-  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  application.GetScene().Add(actor);
-
-  bool                           consume = false;
-  TouchEventFunctorConsumeSetter touchFunctor(consume);
-  actor.TouchedSignal().Connect(&application, touchFunctor);
-
-  // Render and notify
-  application.SendNotification();
-  application.Render();
-
-  SignalData             data;
-  GestureReceivedFunctor functor(data);
-
-  LongPressGestureDetector detector = LongPressGestureDetector::New();
-  detector.Attach(actor);
-  detector.DetectedSignal().Connect(&application, functor);
-
-  // Start gesture within the actor's area, we should receive the gesture as the touch is NOT being consumed
-  TestGenerateLongPress(application, 50.0f, 50.0f);
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  data.Reset();
-  TestEndLongPress(application, 50.0f, 50.0f);
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  data.Reset();
-
-  // Another gesture in the same location, this time we will not receive it as touch is being consumed
-  consume = true;
-  TestGenerateLongPress(application, 50.0f, 50.0f);
-  DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
-  data.Reset();
-  TestEndLongPress(application, 50.0f, 50.0f);
-  DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
-
-  END_TEST;
-}
-
 int UtcDaliLongPressGestureDisableDetectionDuringLongPressN(void)
 {
   // Crash occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached
index 98019b2..713cffe 100644 (file)
@@ -2835,50 +2835,6 @@ int UtcDaliPanGestureNoTimeDiff(void)
   END_TEST;
 }
 
-int UtcDaliPanGestureInterruptedWhenTouchConsumed(void)
-{
-  TestApplication application;
-
-  Actor actor = Actor::New();
-  actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
-  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  application.GetScene().Add(actor);
-
-  bool                           consume = false;
-  TouchEventFunctorConsumeSetter touchFunctor(consume);
-  actor.TouchedSignal().Connect(&application, touchFunctor);
-
-  // Render and notify
-  application.SendNotification();
-  application.Render();
-
-  SignalData             data;
-  GestureReceivedFunctor functor(data);
-
-  PanGestureDetector detector = PanGestureDetector::New();
-  detector.Attach(actor);
-  detector.DetectedSignal().Connect(&application, functor);
-
-  // Start gesture within the actor's area, we should receive the pan as the touch is NOT being consumed
-  uint32_t time = 100;
-  TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
-
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
-  data.Reset();
-
-  // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
-  consume = true;
-
-  TestMovePan(application, Vector2(26.0f, 4.0f), time);
-  time += TestGetFrameInterval();
-
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
-
-  END_TEST;
-}
-
 int UtcDaliPanGestureDisableDetectionDuringPanN(void)
 {
   // Crash occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached
index e746f73..8547f00 100644 (file)
@@ -1056,53 +1056,6 @@ int UtcDaliPinchGestureLayerConsumesTouch(void)
   END_TEST;
 }
 
-int UtcDaliPinchGestureInterruptedWhenTouchConsumed(void)
-{
-  TestApplication application;
-
-  Actor actor = Actor::New();
-  actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
-  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  application.GetScene().Add(actor);
-
-  bool                           consume = false;
-  TouchEventFunctorConsumeSetter touchFunctor(consume);
-  actor.TouchedSignal().Connect(&application, touchFunctor);
-
-  // Render and notify
-  application.SendNotification();
-  application.Render();
-
-  SignalData             data;
-  GestureReceivedFunctor functor(data);
-
-  PinchGestureDetector detector = PinchGestureDetector::New();
-  detector.Attach(actor);
-  detector.DetectedSignal().Connect(&application, functor);
-
-  // Start gesture within the actor's area, we should receive the pinch as the touch is NOT being consumed
-  TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
-
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
-  data.Reset();
-
-  // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
-  consume = true;
-
-  TestContinuePinch(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200);
-
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
-  data.Reset();
-
-  // Start another pinch, we should not even get the callback this time
-  TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
-  DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
-
-  END_TEST;
-}
-
 int UtcDaliPinchGestureDisableDetectionDuringPinchN(void)
 {
   // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached
index 2fa5aec..65744de 100644 (file)
@@ -1045,52 +1045,6 @@ int UtcDaliRotationGestureLayerConsumesTouch(void)
   END_TEST;
 }
 
-int UtcDaliRotationGestureInterruptedWhenTouchConsumed(void)
-{
-  TestApplication application;
-
-  Actor actor = Actor::New();
-  actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
-  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  application.GetScene().Add(actor);
-
-  bool                           consume = false;
-  TouchEventFunctorConsumeSetter touchFunctor(consume);
-  actor.TouchedSignal().Connect(&application, touchFunctor);
-
-  // Render and notify
-  application.SendNotification();
-  application.Render();
-
-  SignalData             data;
-  GestureReceivedFunctor functor(data);
-
-  RotationGestureDetector detector = RotationGestureDetector::New();
-  detector.Attach(actor);
-  detector.DetectedSignal().Connect(&application, functor);
-
-  // Start gesture within the actor's area, we should receive the rotation as the touch is NOT being consumed
-  TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
-
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
-  data.Reset();
-
-  // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
-  consume = true;
-
-  TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
-  data.Reset();
-
-  // Start another rotation, we should not even get the callback this time
-  TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
-  DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
-
-  END_TEST;
-}
-
 int UtcDaliRotationGestureDisableDetectionDuringRotationN(void)
 {
   // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached
index 7f79a5c..a05941a 100644 (file)
@@ -927,44 +927,6 @@ int UtcDaliTapGestureLayerConsumesTouch(void)
   END_TEST;
 }
 
-int UtcDaliTapGestureInterruptedWhenTouchConsumed(void)
-{
-  TestApplication application;
-
-  Actor actor = Actor::New();
-  actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
-  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  application.GetScene().Add(actor);
-
-  bool                           consume = false;
-  TouchEventFunctorConsumeSetter touchFunctor(consume);
-  actor.TouchedSignal().Connect(&application, touchFunctor);
-
-  // Render and notify
-  application.SendNotification();
-  application.Render();
-
-  SignalData             data;
-  GestureReceivedFunctor functor(data);
-
-  TapGestureDetector detector = TapGestureDetector::New();
-  detector.Attach(actor);
-  detector.DetectedSignal().Connect(&application, functor);
-
-  // Start gesture within the actor's area, we should receive the gesture as the touch is NOT being consumed
-  TestGenerateTap(application, 50.0f, 50.0f);
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  data.Reset();
-
-  // Another gesture in the same location, this time we will not receive it as touch is being consumed
-  consume = true;
-  TestGenerateTap(application, 50.0f, 50.0f);
-  DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
-  data.Reset();
-
-  END_TEST;
-}
-
 int UtcDaliTapGestureDisableDetectionDuringTapN(void)
 {
   // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached
index 403b252..e39e244 100644 (file)
@@ -211,6 +211,7 @@ int UtcDaliTapGestureRecognizerMoveTooFar(void)
   TestApplication application;
 
   TapGestureDetector detector = TapGestureDetector::New();
+  detector.SetMaximumTapsRequired(2);
 
   Actor actor = Actor::New();
   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
@@ -233,6 +234,7 @@ int UtcDaliTapGestureRecognizerMoveTooFar(void)
 
   application.SendNotification();
 
+  application.GetPlatform().TriggerTimer();
   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
 
   END_TEST;
@@ -487,6 +489,7 @@ int UtcDaliTapGestureRecognizerMultipleDetectors(void)
 
   application.SendNotification();
 
+  application.GetPlatform().TriggerTimer();
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(true, actor == data.tappedActor, TEST_LOCATION);
   data.Reset();
@@ -506,6 +509,7 @@ int UtcDaliTapGestureRecognizerMultipleDetectors(void)
 
   application.SendNotification();
 
+  application.GetPlatform().TriggerTimer();
   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(true, data2.functorCalled, TEST_LOCATION);
 
index e2a07a8..b6e187b 100644 (file)
@@ -170,7 +170,7 @@ public:
    *
    * @return A vector of the sampler uniforms
    */
-  virtual std::vector<Dali::Graphics::UniformInfo> GetSamplers() const = 0;
+  virtual const std::vector<Dali::Graphics::UniformInfo>& GetSamplers() const = 0;
 
   // Language
 
index 34361e5..44d9eef 100644 (file)
@@ -150,15 +150,7 @@ void EventProcessor::ProcessEvents()
       case Event::Touch:
       {
         Integration::TouchEvent& touchEvent = static_cast<Integration::TouchEvent&>(*event);
-        const bool               consumed   = mTouchEventProcessor.ProcessTouchEvent(touchEvent);
-
-        // If touch is consumed, then gestures should be cancelled
-        // Do this by sending an interrupted event to the GestureEventProcessor
-        if(consumed)
-        {
-          Integration::Point& point = touchEvent.GetPoint(0);
-          point.SetState(PointState::INTERRUPTED);
-        }
+        mTouchEventProcessor.ProcessTouchEvent(touchEvent);
 
         mGestureEventProcessor.ProcessTouchEvent(mScene, touchEvent);
         break;
index 975c847..ab8c1a8 100644 (file)
 
 #include <dali/public-api/math/vector2.h>
 
-#include <dali/integration-api/events/touch-event-integ.h>
-
 // INTERNAL INCLUDES
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/platform-abstraction.h>
 #include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/common/thread-local-storage.h>
 #include <dali/internal/event/events/gesture-requests.h>
 
 namespace Dali
@@ -38,6 +39,7 @@ namespace
 // TODO: Set these according to DPI
 const float         MAXIMUM_MOTION_ALLOWED = 20.0f;
 const unsigned long MAXIMUM_TIME_ALLOWED   = 500u;
+const uint32_t      WAIT_TIME              = 330u;
 } // unnamed namespace
 
 TapGestureRecognizer::TapGestureRecognizer(Observer& observer, Vector2 screenSize, const TapGestureRequest& request)
@@ -50,11 +52,20 @@ TapGestureRecognizer::TapGestureRecognizer(Observer& observer, Vector2 screenSiz
   mTouchPosition(),
   mTouchTime(0u),
   mLastTapTime(0u),
-  mGestureSourceType(GestureSourceType::INVALID)
+  mEventTime(0u),
+  mGestureSourceType(GestureSourceType::INVALID),
+  mTimerId(0)
 {
 }
 
-TapGestureRecognizer::~TapGestureRecognizer() = default;
+TapGestureRecognizer::~TapGestureRecognizer()
+{
+  if(mTimerId != 0 && ThreadLocalStorage::Created())
+  {
+    Dali::Integration::PlatformAbstraction& platformAbstraction = ThreadLocalStorage::Get().GetPlatformAbstraction();
+    platformAbstraction.CancelTimer(mTimerId);
+  }
+}
 
 void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
 {
@@ -62,8 +73,9 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
 
   if(event.GetPointCount() == 1)
   {
-    const Integration::Point& point      = event.points[0];
-    PointState::Type          pointState = point.GetState();
+    const Integration::Point&               point               = event.points[0];
+    PointState::Type                        pointState          = point.GetState();
+    Dali::Integration::PlatformAbstraction& platformAbstraction = ThreadLocalStorage::Get().GetPlatformAbstraction();
 
     MouseButton::Type mouseButton = point.GetMouseButton();
     switch(mouseButton)
@@ -114,6 +126,12 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
         {
           if(deltaBetweenTouchDownTouchUp < MAXIMUM_TIME_ALLOWED)
           {
+            if(mMaximumTapsRequired > mMinimumTapsRequired)
+            {
+              mEventTime = event.time;
+              mTimerId   = platformAbstraction.StartTimer(WAIT_TIME, MakeCallback(this, &TapGestureRecognizer::TimerCallback));
+            }
+
             mLastTapTime = mTouchTime;
             EmitSingleTap(event.time, point);
             mState = REGISTERED;
@@ -145,7 +163,15 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
           else if(deltaBetweenTouchDownTouchUp < MAXIMUM_TIME_ALLOWED)
           {
             ++mTapsRegistered;
-            EmitGesture(GestureState::STARTED, event.time);
+            if(mMaximumTapsRequired > mMinimumTapsRequired)
+            {
+              mEventTime = event.time;
+              mTimerId   = platformAbstraction.StartTimer(WAIT_TIME, MakeCallback(this, &TapGestureRecognizer::TimerCallback));
+            }
+            else
+            {
+              EmitGesture(GestureState::STARTED, event.time);
+            }
           }
           else // Delta between touch down and touch up too long to be considered a TAP event
           {
@@ -170,6 +196,12 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
           {
             EmitPossibleState(event);
           }
+
+          if(mTimerId != 0)
+          {
+            platformAbstraction.CancelTimer(mTimerId);
+            mTimerId = 0;
+          }
         }
         break;
       }
@@ -191,6 +223,14 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
   }
 }
 
+bool TapGestureRecognizer::TimerCallback()
+{
+  EmitGesture(GestureState::STARTED, mEventTime);
+
+  mTimerId = 0;
+  return false;
+}
+
 void TapGestureRecognizer::SetupForTouchDown(const Integration::TouchEvent& event, const Integration::Point& point)
 {
   mTouchPosition  = point.GetScreenPosition();
@@ -238,13 +278,22 @@ void TapGestureRecognizer::EmitSingleTap(uint32_t time, const Integration::Point
   Vector2         distanceDelta(std::abs(mTouchPosition.x - screen.x),
                         std::abs(mTouchPosition.y - screen.y));
 
+  mTapsRegistered = 1u;
   if(distanceDelta.x > MAXIMUM_MOTION_ALLOWED ||
      distanceDelta.y > MAXIMUM_MOTION_ALLOWED)
   {
     event.state = GestureState::CANCELLED;
+    if(mTimerId != 0)
+    {
+      Dali::Integration::PlatformAbstraction& platformAbstraction = ThreadLocalStorage::Get().GetPlatformAbstraction();
+      platformAbstraction.CancelTimer(mTimerId);
+      mTimerId = 0;
+    }
+  }
+  if(mTimerId == 0)
+  {
+    EmitTap(time, event);
   }
-  mTapsRegistered = 1u;
-  EmitTap(time, event);
 }
 
 void TapGestureRecognizer::EmitTap(uint32_t time, TapGestureEvent& event)
index f87d2ec..5b01982 100644 (file)
@@ -117,6 +117,12 @@ private:
    */
   void ProcessEvent(TapGestureEvent& event);
 
+  /**
+   * Timer Callback
+   * @return will return false; one-shot timer.
+   */
+  bool TimerCallback();
+
 private:
   // Reference to the gesture processor for this recognizer
   Observer& mObserver;
@@ -141,8 +147,11 @@ private:
   Vector2  mTouchPosition; ///< The initial touch down position.
   uint32_t mTouchTime;     ///< The initial touch down time.
   uint32_t mLastTapTime;   ///< Time last tap gesture was registered
+  uint32_t mEventTime;     ///< The touch event time.
 
   GestureSourceType mGestureSourceType; /// < Gesture input source type value.
+
+  uint32_t mTimerId;
 };
 
 } // namespace Internal
index c44c328..4a309fd 100644 (file)
@@ -382,7 +382,15 @@ void RenderManager::AddGeometry(OwnerPointer<Render::Geometry>& geometry)
 
 void RenderManager::RemoveGeometry(Render::Geometry* geometry)
 {
-  mImpl->geometryContainer.EraseObject(geometry);
+  auto it = std::find_if( mImpl->geometryContainer.begin(), mImpl->geometryContainer.end(),[geometry]( auto& item )
+  {
+    return geometry == item;
+  });
+
+  if(it != mImpl->geometryContainer.end())
+  {
+    mImpl->geometryContainer.Erase(it);
+  }
 }
 
 void RenderManager::AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer)
@@ -459,43 +467,9 @@ void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear
     DALI_LOG_INFO(gLogFilter, Debug::General, "Render: Processing\n");
 
     // Upload the geometries
-    for(auto& i : mImpl->sceneContainer)
+    for(auto&& geom : mImpl->geometryContainer)
     {
-      RenderInstructionContainer& instructions = i->GetRenderInstructions();
-      for(uint32_t j = 0; j < instructions.Count(mImpl->renderBufferIndex); ++j)
-      {
-        RenderInstruction& instruction = instructions.At(mImpl->renderBufferIndex, j);
-
-        const Matrix* viewMatrix       = instruction.GetViewMatrix(mImpl->renderBufferIndex);
-        const Matrix* projectionMatrix = instruction.GetProjectionMatrix(mImpl->renderBufferIndex);
-
-        DALI_ASSERT_DEBUG(viewMatrix);
-        DALI_ASSERT_DEBUG(projectionMatrix);
-
-        if(viewMatrix && projectionMatrix)
-        {
-          const RenderListContainer::SizeType renderListCount = instruction.RenderListCount();
-
-          // Iterate through each render list.
-          for(RenderListContainer::SizeType index = 0; index < renderListCount; ++index)
-          {
-            const RenderList* renderList = instruction.GetRenderList(index);
-
-            if(renderList && !renderList->IsEmpty())
-            {
-              const std::size_t itemCount = renderList->Count();
-              for(uint32_t itemIndex = 0u; itemIndex < itemCount; ++itemIndex)
-              {
-                const RenderItem& item = renderList->GetItem(itemIndex);
-                if(DALI_LIKELY(item.mRenderer))
-                {
-                  item.mRenderer->Upload();
-                }
-              }
-            }
-          }
-        }
-      }
+      geom->Upload( mImpl->graphicsController );
     }
   }
 }
index 1de282f..54d9ee4 100644 (file)
@@ -86,7 +86,7 @@ public:
    * Check if the attributes for the geometry have changed
    * @return True if vertex buffers have been added or removed since last frame, false otherwise
    */
-  [[nodiscard]] bool AttributesChanged() const
+  [[maybe_unused]] [[nodiscard]] bool AttributesChanged() const
   {
     return mAttributesChanged;
   }
index 6d0f0b7..6681a54 100644 (file)
@@ -563,10 +563,6 @@ void Renderer::BuildUniformIndexMap(BufferIndex bufferIndex, const SceneGraph::N
 
     mUniformIndexMap.Resize(mapIndex);
   }
-
-  // @todo Temporary workaround to reduce workload each frame. Find a better way.
-  auto& sceneGraphRenderer = const_cast<SceneGraph::Renderer&>(static_cast<const SceneGraph::Renderer&>(uniformMapDataProvider));
-  sceneGraphRenderer.AgeUniformMap();
 }
 
 void Renderer::WriteUniformBuffer(
@@ -702,21 +698,43 @@ void Renderer::FillUniformBuffer(Program&                                      p
         iter != end;
         ++iter)
     {
-      // @todo This means parsing the uniform string every frame. Instead, store the array index if present.
-      int arrayIndex = (*iter).arrayIndex;
+      auto& uniform = *iter;
+      int arrayIndex = uniform.arrayIndex;
+
+      if(!uniform.uniformFunc)
+      {
+        auto uniformInfo  = Graphics::UniformInfo{};
+        auto uniformFound = program.GetUniform(uniform.uniformName.GetCString(),
+                                               uniform.uniformNameHashNoArray ? uniform.uniformNameHashNoArray
+                                                                              : uniform.uniformNameHash,
+                                               uniformInfo);
+
+        uniform.uniformOffset   = uniformInfo.offset;
+        uniform.uniformLocation = uniformInfo.location;
+
+        if (uniformFound)
+        {
+          auto       dst      = ubo.GetOffset() + uniformInfo.offset;
+          const auto typeSize = GetPropertyValueSizeForUniform((*iter).propertyValue->GetType());
+          const auto dest     = dst + static_cast<uint32_t>(typeSize) * arrayIndex;
+          const auto func     = GetPropertyValueGetter((*iter).propertyValue->GetType());
 
-      auto uniformInfo  = Graphics::UniformInfo{};
-      auto uniformFound = program.GetUniform((*iter).uniformName.GetCString(),
-                                             (*iter).uniformNameHashNoArray ? (*iter).uniformNameHashNoArray
-                                                                            : (*iter).uniformNameHash,
-                                             uniformInfo);
+          ubo.Write(&((*iter).propertyValue->*func)(updateBufferIndex),
+                    typeSize,
+                    dest);
 
-      if(uniformFound)
+          uniform.uniformSize = typeSize;
+          uniform.uniformFunc = func;
+        }
+      }
+      else
       {
-        auto dst = ubo.GetOffset() + uniformInfo.offset;
-        const auto typeSize = GetPropertyValueSizeForUniform( (*iter).propertyValue->GetType() );
-        const auto dest = dst + static_cast<uint32_t>(typeSize) * arrayIndex;
-        const auto func = GetPropertyValueGetter((*iter).propertyValue->GetType());
+        auto       dst      = ubo.GetOffset() + uniform.uniformOffset;
+        const auto typeSize = uniform.uniformSize;
+        const auto dest     = dst + static_cast<uint32_t>(typeSize) * arrayIndex;
+        const auto func     = uniform.uniformFunc;
+
+
         ubo.Write(&((*iter).propertyValue->*func)(updateBufferIndex),
                   typeSize,
                   dest);
index b57490f..5583fe0 100644 (file)
@@ -516,6 +516,9 @@ private:
   Render::PipelineCache* mPipelineCache{nullptr};
 
   using Hash = unsigned long;
+
+  typedef const float&(PropertyInputImpl::*FuncGetter )(BufferIndex) const;
+
   struct UniformIndexMap
   {
     ConstString              uniformName;            ///< The uniform name
@@ -523,6 +526,11 @@ private:
     Hash                     uniformNameHash{0u};
     Hash                     uniformNameHashNoArray{0u};
     int32_t                  arrayIndex{-1}; ///< The array index
+
+    int16_t                  uniformLocation{0u};
+    uint16_t                 uniformOffset{0u};
+    uint16_t                 uniformSize{0u};
+    FuncGetter               uniformFunc{0};
   };
 
   using UniformIndexMappings = Dali::Vector<UniformIndexMap>;
index ecae483..c944880 100644 (file)
@@ -181,7 +181,13 @@ void UniformBuffer::Write(const void* data, uint32_t size, uint32_t dstOffset)
     void* ptr = bufferDesc.memory->LockRegion(bufferOffset, size);
     if(ptr && bufferOffset + size < mSize)
     {
-      memcpy(ptr, data, size);
+      // size always divides by 4 (std140 alignment rules, so we can replace memcpy with unrolled assignments)
+      auto ptr32 = reinterpret_cast<uint32_t*>(ptr);
+      auto data32 = reinterpret_cast<const uint32_t*>(data);
+      for(auto i = 0u; i < size; i +=4 )
+      {
+        *ptr32++ = *data32++;;
+      }
     }
     bufferDesc.memory->Unlock(true);
   }
index fbba692..dd765b8 100644 (file)
@@ -177,14 +177,13 @@ void Renderer::operator delete(void* ptr)
 
 bool Renderer::PrepareRender(BufferIndex updateBufferIndex)
 {
-  switch(mRegenerateUniformMap)
+  if(mRegenerateUniformMap == UNIFORM_MAP_READY)
   {
-    case UNIFORM_MAP_READY: // Now, only set to zero on start and by render side
-    {
-      mUniformMapChanged[updateBufferIndex] = false;
-      break;
-    }
-    case REGENERATE_UNIFORM_MAP:
+    mUniformMapChanged[updateBufferIndex] = false;
+  }
+  else
+  {
+    if(mRegenerateUniformMap == REGENERATE_UNIFORM_MAP)
     {
       CollectedUniformMap& localMap = mCollectedUniformMap[updateBufferIndex];
       localMap.Clear();
@@ -205,10 +204,8 @@ bool Renderer::PrepareRender(BufferIndex updateBufferIndex)
       {
         AddMappings(localMap, mShader->GetUniformMap());
       }
-      mUniformMapChanged[updateBufferIndex] = true;
-      break;
     }
-    case COPY_UNIFORM_MAP:
+    else if(mRegenerateUniformMap == COPY_UNIFORM_MAP)
     {
       // Copy old map into current map
       CollectedUniformMap& localMap = mCollectedUniformMap[updateBufferIndex];
@@ -221,9 +218,10 @@ bool Renderer::PrepareRender(BufferIndex updateBufferIndex)
       {
         localMap[index] = *iter;
       }
-      mUniformMapChanged[updateBufferIndex] = true;
-      break;
     }
+
+    mUniformMapChanged[updateBufferIndex] = true;
+    mRegenerateUniformMap--;
   }
 
   bool rendererUpdated = mUniformMapChanged[updateBufferIndex] || mResendFlag || mRenderingBehavior == DevelRenderer::Rendering::CONTINUOUSLY;
@@ -376,14 +374,6 @@ bool Renderer::PrepareRender(BufferIndex updateBufferIndex)
   return rendererUpdated;
 }
 
-void Renderer::AgeUniformMap()
-{
-  if(mRegenerateUniformMap > 0)
-  {
-    mRegenerateUniformMap--;
-  }
-}
-
 void Renderer::SetTextures(TextureSet* textureSet)
 {
   DALI_ASSERT_DEBUG(textureSet != NULL && "Texture set pointer is NULL");
index 15d0924..335e125 100644 (file)
@@ -433,12 +433,6 @@ public: // From UniformMapDataProvider
 
   void SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size);
 
-  /**
-   * Temporary fix to age mRegenerateUniformMap from render side.
-   * (aging should only be done if renderer is visible, not when PrepareRender is called)
-   */
-  void AgeUniformMap();
-
 private:
   /**
    * Protected constructor; See also Renderer::New()
index 730d28b..f4d4b3e 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_ACTOR_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.
@@ -1166,7 +1166,6 @@ public: // Signals
    * @endcode
    * The return value of True, indicates that the touch event has been consumed.
    * Otherwise the signal will be emitted on the next sensitive parent of the actor.
-   * A true return will also cancel any ongoing gestures.
    * @SINCE_1_9.28
    * @return The signal to connect to
    * @pre The Actor has been initialized.
index c0780c2..4f1bb79 100644 (file)
@@ -27,7 +27,7 @@ namespace Dali
 {
 const uint32_t    CORE_MAJOR_VERSION = 2;
 const uint32_t    CORE_MINOR_VERSION = 0;
-const uint32_t    CORE_MICRO_VERSION = 32;
+const uint32_t    CORE_MICRO_VERSION = 35;
 const char* const CORE_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index c3664f6..9d3dad0 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2
 Summary:    DALi 3D Engine
-Version:    2.0.32
+Version:    2.0.35
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT