Create a texture, multi-sampled, with initial memory

Vulkan validation entry:

VUID-vkCmdCopyBufferToImage-dstImage-00179
`dstImage` **must** have a sample count equal to `VK_SAMPLE_COUNT_1_BIT`

I am just trying to construct some images for test pattern, and I’ve got an N_BIT ms image.
The only way I know of to transfer bits to an image is through buffer to image. Is there a way to actually do this simply?

I’m curious as to how you managed to create this image data.

However, it doesn’t ultimately matter. The only ways to manipulate the data in a multisampled image are:

  • clear operations
  • rendering operations
  • writes to storage images

So if you have some “mutlisampled” image data, and you want to copy it into a multisample image, you’ll have to do it via some kind of compute shader.

By N_BIT I meant a sampled bit image of whatever the system reports. This is just an initial pattern state so I could verify. When you say ‘writes to store images’, what APIs are involved there?

I know how multisampled images work. I was wondering how you got the multisampled data, since there are no image formats for storing such data and there is no mechanism (in Vulkan or OpenGL) to directly read data from a multisampled image.

Multisampled images mean something more than just having multiple samples per texel. Those samples are expected to correspond to particular locations within each pixel. This is information the multisample resolve can use as part of its resolve process. So dumping data into a multisample image like you’re trying to do could cause problems.

I said “storage images”. As in the Vulkan descriptor type. In OpenGL, it would be called using image load/store.

Also, be advised that implementations don’t have to allow you to create multisampled storage images. You have to check to see if the implementation offers that as a feature (shaderStorageImageMultisample).