Przeglądaj źródła

Fix StreamingImageController OnSetTargetMip (#19092)

* Fix StreamingImageController OnSetTargetMip

Signed-off-by: Martin Sattlecker <[email protected]>

* PythonGlobalTests: Add maybe_unused

Signed-off-by: Martin Sattlecker <[email protected]>

* AssetProcessorMessagesTests: Added maybe_unused

Signed-off-by: Martin Sattlecker <[email protected]>

---------

Signed-off-by: Martin Sattlecker <[email protected]>
Martin Sattlecker 3 tygodni temu
rodzic
commit
65bc1e40e5

+ 4 - 1
Code/Tools/AssetProcessor/native/tests/AssetProcessorMessagesTests.cpp

@@ -164,7 +164,10 @@ namespace AssetProcessorMessagesTests
             m_batchApplicationManager->InitAssetRequestHandler(m_assetRequestHandler);
             m_batchApplicationManager->ConnectAssetCatalog();
 
-            QObject::connect(m_batchApplicationManager->m_connectionManager, &ConnectionManager::ConnectionError, [](unsigned /*connId*/, QString error)
+            QObject::connect(
+                m_batchApplicationManager->m_connectionManager,
+                &ConnectionManager::ConnectionError,
+                [](unsigned /*connId*/, [[maybe_unused]] QString error)
                 {
                     AZ_Error("ConnectionManager", false, "%s", error.toUtf8().constData());
                 });

+ 1 - 1
Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Image/StreamingImageController.h

@@ -103,7 +103,7 @@ namespace AZ
             size_t GetPoolMemoryUsage();
 
             // Insert image to expandable and evictable lists
-            void ReinsertImageToLists(StreamingImage* image);
+            void ReinsertImageToLists(StreamingImage* image, AZStd::optional<size_t> updatedTimestamp = {});
 
             // Called when the expanding of an image is finished or canceled
             void EndExpandImage(StreamingImage* image);

+ 8 - 3
Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImageController.cpp

@@ -88,12 +88,18 @@ namespace AZ
             image->m_streamingContext = nullptr;
         }
 
-        void StreamingImageController::ReinsertImageToLists(StreamingImage* image)
+        void StreamingImageController::ReinsertImageToLists(StreamingImage* image, AZStd::optional<size_t> updatedTimestamp)
         {
             AZStd::lock_guard<AZStd::recursive_mutex> lock(m_imageListAccessMutex);
             m_expandableImages.erase(image);
             m_evictableImages.erase(image);
 
+            if (updatedTimestamp)
+            {
+                StreamingImageContext* context = image->m_streamingContext.get();
+                context->m_lastAccessTimestamp = updatedTimestamp.value();
+            }
+
             if (!image->IsExpanding())
             {
                 image->m_streamingContext->UpdateMipStats();
@@ -218,7 +224,6 @@ namespace AZ
             StreamingImageContext* context = image->m_streamingContext.get();
 
             context->m_mipLevelTarget = mipLevelTarget;
-            context->m_lastAccessTimestamp = m_timestamp;
 
             // update image priority and re-insert the image
             if (!context->m_queuedForMipExpand)
@@ -227,7 +232,7 @@ namespace AZ
             }
 
             // reinsert the image since the priority might be changed after mip target changed
-            ReinsertImageToLists(image);
+            ReinsertImageToLists(image, m_timestamp);
         }
 
         bool StreamingImageController::ExpandPriorityComparator::operator()(const StreamingImage* lhs, const StreamingImage* rhs) const

+ 1 - 1
Gems/EditorPythonBindings/Code/Tests/PythonGlobalsTests.cpp

@@ -20,7 +20,7 @@
 
 namespace UnitTest
 {
-    void AcceptTwoStrings(AZStd::string stringValue1, AZStd::string stringValue2)
+    void AcceptTwoStrings([[maybe_unused]] AZStd::string stringValue1, [[maybe_unused]] AZStd::string stringValue2)
     {
         AZ_TracePrintf("python", stringValue1.empty() ? "stringValue1_is_empty" : "stringValue1_has_data");
         AZ_TracePrintf("python", stringValue2.empty() ? "stringValue2_is_empty" : "stringValue2_has_data");