Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triangle example panics when using ImageLayout::Undefined #1894

Closed
jedel1043 opened this issue May 7, 2022 · 0 comments · Fixed by #1908
Closed

Triangle example panics when using ImageLayout::Undefined #1894

jedel1043 opened this issue May 7, 2022 · 0 comments · Fixed by #1908

Comments

@jedel1043
Copy link

Issue

Running the triangle example using the same render pass configuration from https://github.com/KhronosGroup/Vulkan-Samples/blob/master/samples/api/hello_triangle/hello_triangle.cpp panics with the message:

thread 'main' panicked at 'assertion failed: !matches!(new_layout, ImageLayout :: Undefined | ImageLayout ::\n        Preinitialized)'

Stacktrace points to:

debug_assert!(!matches!(
new_layout,
ImageLayout::Undefined | ImageLayout::Preinitialized
));

I've also tested version 0.29.0 and it works fine, so the regression was implemented after that release.

Render pass creation snippet

let render_pass = {
        use vulkano::image::{ImageLayout, SampleCount};
        use vulkano::render_pass::{
            AttachmentDescription, AttachmentReference, LoadOp, RenderPassCreateInfo, StoreOp,
            SubpassDependency, SubpassDescription,
        };
        use vulkano::sync::{AccessFlags, PipelineStages};
        let colour_attachment = AttachmentDescription {
            format: Some(swapchain.image_format()),
            samples: SampleCount::Sample1,
            load_op: LoadOp::Clear,
            store_op: StoreOp::Store,
            stencil_load_op: LoadOp::DontCare,
            stencil_store_op: StoreOp::DontCare,
            initial_layout: ImageLayout::Undefined,
            final_layout: ImageLayout::PresentSrc,
            ..Default::default()
        };

        let colour_attachment_ref = AttachmentReference {
            attachment: 0,
            layout: ImageLayout::ColorAttachmentOptimal,
            ..Default::default()
        };

        let subpass = SubpassDescription {
            color_attachments: vec![Some(colour_attachment_ref)],
            ..Default::default()
        };

        let dep = SubpassDependency {
            source_subpass: None,
            destination_subpass: Some(0),
            source_stages: PipelineStages {
                color_attachment_output: true,
                ..PipelineStages::none()
            },
            destination_stages: PipelineStages {
                color_attachment_output: true,
                ..PipelineStages::none()
            },
            source_access: AccessFlags::none(),
            destination_access: AccessFlags {
                color_attachment_read: true,
                color_attachment_write: true,
                ..AccessFlags::none()
            },
            ..Default::default()
        };

        RenderPass::new(
            device.clone(),
            RenderPassCreateInfo {
                attachments: vec![colour_attachment],
                subpasses: vec![subpass],
                dependencies: vec![dep],
                ..Default::default()
            },
        )
        .unwrap()
    };

System Info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant