GithubHelp home page GithubHelp logo

image_t layout is inconsistent about auto-vk HOT 2 OPEN

cg-tuwien avatar cg-tuwien commented on May 23, 2024
image_t layout is inconsistent

from auto-vk.

Comments (2)

johannesugb avatar johannesugb commented on May 23, 2024

Could you post either example code or an overview of relevant steps that lead to bad layout handling (and where the layout must be set manually to fix it)?

from auto-vk.

JakobPer avatar JakobPer commented on May 23, 2024

Example

The problem already occurs when you try to perform an image barrier on a framebuffer image that is used in the current renderpass, as the layout of the attachment images is apparently not set when creating the attachment.

Perform the following patch to the framebuffer example and you'll get multiple validation errors, most are unrelated an can be ignored for now. The important validation error is the one talking about the image being in the wrong layout (cause the wrong layout got provided to the barrier call).

examples/framebuffer/source/framebuffer.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/examples/framebuffer/source/framebuffer.cpp b/examples/framebuffer/source/framebuffer.cpp
index 4653cc22..0dc32c4b 100644
--- a/examples/framebuffer/source/framebuffer.cpp
+++ b/examples/framebuffer/source/framebuffer.cpp
@@ -184,6 +184,10 @@ public: // v== xk::invokee overrides which will be invoked by the framework ==v
 		cmdBfr->begin_render_pass_for_framebuffer(mPipeline->get_renderpass(), mOneFramebuffer);
 		cmdBfr->handle().bindPipeline(vk::PipelineBindPoint::eGraphics, mPipeline->handle());
 		cmdBfr->draw_indexed(avk::const_referenced(mIndexBuffer), avk::const_referenced(mVertexBuffers[inFlightIndex]));
+
+		cmdBfr->establish_image_memory_barrier_rw(mOneFramebuffer->image_at(1).get(), avk::pipeline_stage::color_attachment_output, avk::pipeline_stage::fragment_shader,
+			avk::memory_access::color_attachment_write_access, avk::memory_access::color_attachment_read_access);
+
 		cmdBfr->end_render_pass();
 		cmdBfr->end_recording();
 

The validation error is the following:

ERR:  Debug utils callback with Id[947939354|VUID-VkImageMemoryBarrier-newLayout-01198] and Message[Validation Error: [ VUID-VkImageMemoryBarrier-newLayout-01198 ] Object 0: handle = 0x11b9b9af378, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x3880681a | vkCmdPipelineBarrier(): Image Layout cannot be transitioned to UNDEFINED or PREINITIALIZED. The Vulkan spec states: newLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED (https://vulkan.lunarg.com/doc/view/1.2.141.0/windows/1.2-extensions/vkspec.html#VUID-VkImageMemoryBarrier-newLayout-01198)]

Proposed tasks/changes:

  • Review Vulkan Spec to find out where the layouts are transitionen either implicitly or explicity. Some examples:
    • For example when starting a renderpass, Images should be in the specified layout (some attachment_optimal, or depth stencil layout), but it is currently undefined
    • Going to the next subpass transitions images according to the subpass dependencies similar to an image barrier
    • Perfoming image memory barriers with layout transitions
  • Track these transitions per thread (or per command buffer), as multiple threads could record a command buffer in parallel

from auto-vk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.