Fix pipeline hash 81/292481/3
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 9 May 2023 01:03:33 +0000 (10:03 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Fri, 12 May 2023 09:25:06 +0000 (18:25 +0900)
The hash of L0 cache needs to check information that L0 cache has

Change-Id: I17f3cb44b35965e547a3bfc09435afec705e543b

automated-tests/src/dali-internal/utc-Dali-Internal-PipelineCache.cpp
dali/internal/render/renderers/pipeline-cache.cpp
dali/internal/render/renderers/pipeline-cache.h

index 0d3e9f6..8f186e2 100644 (file)
@@ -148,20 +148,9 @@ int UtcDaliCorePipelineCacheTest(void)
   application.Render();
 
   // Test whether noBlend pipeline is set in cache
-  uint32_t noBlendFoundCount = 0u;
-  for(auto& iterLevel0 : gPipelineCache->level0nodes)
-  {
-    for(auto& iterLevel1 : iterLevel0.level1nodes)
-    {
-      if(!iterLevel1.noBlends.empty() && iterLevel1.noBlends.begin()->pipeline != nullptr)
-      {
-        noBlendFoundCount++;
-      }
-    }
-  }
-
-  DALI_TEST_EQUALS(gPipelineCache->level0nodes.size(), 3, TEST_LOCATION);
-  DALI_TEST_EQUALS(noBlendFoundCount, 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS((gPipelineCache->level0nodes.size() == 2), true, TEST_LOCATION);
+  DALI_TEST_CHECK(!gPipelineCache->level0nodes.front().level1nodes.front().noBlends.empty());
+  DALI_TEST_EQUALS(gPipelineCache->level0nodes.front().level1nodes.front().noBlends.front().pipeline != nullptr, true, TEST_LOCATION);
 
   // Remove renderer to test whether old pipeline is removed
   application.GetScene().Remove(actor1);
@@ -174,7 +163,7 @@ int UtcDaliCorePipelineCacheTest(void)
   application.SendNotification();
   application.Render();
 
-  DALI_TEST_EQUALS(gPipelineCache->level0nodes.size(), 2, TEST_LOCATION);
+  DALI_TEST_EQUALS(gPipelineCache->level0nodes.size(), 1, TEST_LOCATION);
 
   END_TEST;
 }
index 9839d95..c2545c0 100644 (file)
@@ -192,9 +192,11 @@ constexpr Graphics::BlendOp ConvertBlendEquation(DevelBlendEquation::Type blendE
 }
 } // namespace
 
-PipelineCacheL0Ptr PipelineCache::GetPipelineCacheL0(std::size_t hash, Program* program, Render::Geometry* geometry)
+PipelineCacheL0Ptr PipelineCache::GetPipelineCacheL0(Program* program, Render::Geometry* geometry)
 {
-  auto it = std::find_if(level0nodes.begin(), level0nodes.end(), [hash, program, geometry](PipelineCacheL0& item) { return ((item.hash == hash && item.program == program && item.geometry == geometry)); });
+  auto it = std::find_if(level0nodes.begin(), level0nodes.end(), [program, geometry](PipelineCacheL0& item) {
+    return ((item.program == program && item.geometry == geometry));
+  });
 
   // Add new node to cache
   if(it == level0nodes.end())
@@ -243,7 +245,6 @@ PipelineCacheL0Ptr PipelineCache::GetPipelineCacheL0(std::size_t hash, Program*
       ++bindingIndex;
     }
     PipelineCacheL0 level0;
-    level0.hash       = hash;
     level0.program    = program;
     level0.geometry   = geometry;
     level0.inputState = vertexInputState;
@@ -498,7 +499,7 @@ PipelineResult PipelineCache::GetPipeline(const PipelineCacheQueryInfo& queryInf
     return mLatestResult[latestUsedCacheIndex];
   }
 
-  auto level0 = GetPipelineCacheL0(queryInfo.hash, queryInfo.program, queryInfo.geometry);
+  auto level0 = GetPipelineCacheL0(queryInfo.program, queryInfo.geometry);
   auto level1 = level0->GetPipelineCacheL1(queryInfo.renderer, queryInfo.cameraUsingReflection);
 
   PipelineCachePtr level2 = level1->GetPipelineCacheL2(queryInfo.blendingEnabled, queryInfo.alphaPremultiplied, *queryInfo.blendingOptions);
index c153716..6d5caf4 100644 (file)
@@ -87,7 +87,6 @@ struct PipelineCacheL0 // L0 cache
    */
   void ClearUnusedCache();
 
-  std::size_t                hash{};
   Geometry*                  geometry{};
   Program*                   program{};
   Graphics::VertexInputState inputState;
@@ -143,7 +142,7 @@ public:
   /**
    * Retrieves next cache level
    */
-  PipelineCacheL0Ptr GetPipelineCacheL0(std::size_t hash, Program* program, Render::Geometry* geometry);
+  PipelineCacheL0Ptr GetPipelineCacheL0(Program* program, Render::Geometry* geometry);
 
   /**
    * Retrieves pipeline matching queryInfo struct