0
votes

I know how to use input attachments and multisampling separately. But I don't understand how these 2 features can be used together.

I have render pass with 2 subpasses and 4 attachments:

  1. an image, which is presented;
  2. a multisampled image with samples=N, which is rendered and resolved (into image #1) in the second subpass;
  3. a multisampled depth image with samples=N, which is rendered in the both subpasses;
  4. a multisampled image with samples=N, which is used as color attachment in the first subpass and input attachment in the second subpass.

If N equals to VK_SAMPLE_COUNT_1_BIT, everything works fine. But if N equals to VK_SAMPLE_COUNT_4_BIT, I have a lot of errors:

  • vkCreateRenderPass returns error code on Mi A1;
  • vkCreateRenderPass returns success on Mi A2 lite, but I get a lot of warnings from validation layers:

    Descriptor set 0x28107 encountered the following validation error at vkCmdDraw() time: Descriptor in binding #0 at global descriptor index 0 requires bound image to have VK_SAMPLE_COUNT_1_BIT but got VK_SAMPLE_COUNT_4_BIT.

Questions:

  • Is it prohibited to use multisampled input attachments? I can't find anything about this in spec.
  • I can resolve my image #4 in the first subpass into some other image (#5) which will be used as input attachment in the second subpass. Is it the only way to fix this problem?
1
What is "Mi A1" and "Mi A2"? Also, how do you change your shaders between the multisample and non-multisample versions? - Nicol Bolas
@NicolBolas "Mi A1" and "Mi A2 lite" are Android phones. I don't change shaders. I change only rasterizationSamples in VkPipelineMultisampleStateCreateInfo - Filipp Slavnejshev

1 Answers

3
votes

I don't change shaders.

Then that's your problem. The multisampling status of a texture is part of its GLSL type. You cannot fetch from a multisample input texture through a subpassInput; you have to use a subpassInputMS.