From e39a41e104ca5eb2fa856899220b714f847f1b72 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Wed, 16 Jul 2025 17:13:44 +0200 Subject: [PATCH] gfxstream: move variables into the #ifdef that uses them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp:7585:14: warning: unused variable ‘actualFormat’ [-Wunused-variable] 7585 | VkFormat actualFormat = imageInfo.createInfo.format; | ^~~~~~~~~~~~ Part-of: --- src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp b/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp index 67d8941be48..ac188141ff9 100644 --- a/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp +++ b/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp @@ -7581,8 +7581,6 @@ void ResourceTracker::on_vkCmdClearColorImage(void* context, VkCommandBuffer com return; } - auto& imageInfo = imageInfoIt->second; - VkFormat actualFormat = imageInfo.createInfo.format; VkClearColorValue convertedColor = *pColor; #ifdef VK_USE_PLATFORM_ANDROID_KHR @@ -7590,6 +7588,8 @@ void ResourceTracker::on_vkCmdClearColorImage(void* context, VkCommandBuffer com // it'll have the identical parameters, so we need to convert the linearized // clear color back to sRGB at this point. // TODO(b/420857458): revise the allocation logic to support mutable formats better + auto& imageInfo = imageInfoIt->second; + VkFormat actualFormat = imageInfo.createInfo.format; if (imageInfo.hasAnb && srgbFormatNeedsConversionForClearColor(actualFormat)) { // Perform linear to srgb conversion // Backing image is UNORM for vkCmdClearColorImage so we convert pColor