Skip to content

[Vulkan] AiksTests.CanRenderImageRect has InvalidImageLayout validation error #142024

@gaaclarke

Description

@gaaclarke

This error was seen while trying to turn on validation in the golden image tests. There are a lot of instances of InvalidImageLayout as reported in flutter/engine#49955 (comment), hopefully fixing this simplest case will fix them all.

Steps to reproduce:

apply the following patch

--- a/impeller/golden_tests/vulkan_screenshotter.mm
+++ b/impeller/golden_tests/vulkan_screenshotter.mm
@@ -66,8 +66,10 @@ std::unique_ptr<Screenshot> ReadTexture(
 
 VulkanScreenshotter::VulkanScreenshotter() {
   FML_CHECK(::glfwInit() == GLFW_TRUE);
+  PlaygroundSwitches playground_switches;
+  playground_switches.enable_vulkan_validation = true;
   playground_ =
-      PlaygroundImpl::Create(PlaygroundBackend::kVulkan, PlaygroundSwitches{});
+      PlaygroundImpl::Create(PlaygroundBackend::kVulkan, playground_switches);
 }
 
 std::unique_ptr<Screenshot> VulkanScreenshotter::MakeScreenshot(

run the following target

impeller_golden_tests --working_dir=<path> --gtest_filter="*CanRenderImageRect*Vulkan"

validation error

[ERROR:flutter/impeller/base/validation.cc(49)] Break on 'ImpellerValidationBreak' to inspect point of failure: 
--- Vulkan Debug Report  ----------------------------------------
|                Severity: Error
|                    Type: { Validation }
|                 ID Name: UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout
|               ID Number: 1303270965
|       Queue Breadcrumbs: [NONE]
|  CMD Buffer Breadcrumbs: Texture Fill, QueueSubmit
|         Related Objects: CommandBuffer [5593919120] [EntityPass Command Buffer: Depth=0 Count=0]
|                 Trigger: Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout ] Object 0: handle = 0x14d6c6e90, name = EntityPass Command Buffer: Depth=0 Count=0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x4dae5635 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer 0x14d6c6e90[EntityPass Command Buffer: Depth=0 Count=0] expects VkImage 0x51820000000007b[kalimba.jpg] (subresource: aspectMask 0x1 array layer 0, mip level 0) to be in layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL--instead, current layout is VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL.
-----------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    e: impellerImpeller rendering backend issues and features requeststeam-engineOwned by Engine team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions