vulkano
vulkano copied to clipboard
Validation error trying to copy buffer data to StorageImage
I'm trying to copy over some pixel data to an image for usage later on in my pipeline. The problem is that I receive following validation error:
19:33:35 [ERROR] "Object: 0x7ffff67c6108 (Type = 6) | Cannot submit cmd buffer using image (0x7) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_GENERAL."
I'm using the following code:
let tex = vulkano::image::StorageImage::with_usage(
device.clone(),
Dim2d{width: handle.width,height: handle.height},
Format::R8G8B8A8Unorm,
ImageUsage{
storage:true,
transfer_destination:true,
..ImageUsage::none()
},
Some(gfx_queue.family())
).unwrap();
let buffer = CpuAccessibleBuffer::from_iter(device.clone(), BufferUsage::all(), handle.pixels.iter().cloned()).unwrap();
let command_buffer = AutoCommandBufferBuilder::new(device.clone(),gfx_queue.family()).unwrap()
.copy_buffer_to_image(buffer.clone(), tex.clone()).unwrap()
.build().unwrap();
let finished = command_buffer.execute(gfx_queue.clone()).unwrap();
finished.then_signal_fence_and_flush().unwrap().wait(None).unwrap();
#974 seems like the same issue