Skip to content

Vulkan: no render to texture attachment[1] for renderTarget #3054

@solan-solan

Description

@solan-solan
  • axmol version: dev
  • devices test on: windows laptop
  • developing environments
    • NDK version: r23c
    • Xcode version: 14.2+
    • Visual Studio:
      • VS version: 2022 (17.9+)
      • MSVC version: 19.39+
      • Windows SDK version: 10.0.22621.0+
    • cmake version:
      Steps to Reproduce:

@halx99
In my case the whole scene is rendered to renderTarget with color attachment 1, color attachment 2 and depth attachment. But the texture from color attachment 2 remains black when I put it to screen. The following validation error is caught:

[vulkan] vkCreateGraphicsPipelines(): pCreateInfos[0].pColorBlendState->attachmentCount (1) is different than VkRenderPass 0x1590000000159 pSubpasses[0].colorAttachmentCount (2).
The Vulkan spec states: If renderPass is not VK_NULL_HANDLE, the pipeline is being created with fragment output interface state, the pColorBlendState pointer is not NULL, the attachmentCount member of pColorBlendState is not ignored, and the subpass uses color attachments, the attachmentCount member of pColorBlendState must be equal to the colorAttachmentCount used to create subpass (https://docs.vulkan.org/spec/latest/chapters/pipelines.html#VUID-VkGraphicsPipelineCreateInfo-renderPass-07609)

Can it be the reason?

And some about depth attachment.
Check please this patch with little change to allow just depth attachment without color. There were some inconsistent in the code about this.
only_depth.zip

Really I can use it for depth sampling as expected without issues, but the following validation error exists:

 [vulkan] vkUpdateDescriptorSets(): pDescriptorWrites[3].pImageInfo[0].imageView was created with an image format VK_FORMAT_D24_UNORM_S8_UINT, but the image aspectMask (VK_IMAGE_ASPECT_DEPTH_BIT|VK_IMAGE_ASPECT_STENCIL_BIT) has both STENCIL and DEPTH aspects set .
The Vulkan spec states: If imageView is created from a depth/stencil image, the aspectMask used to create the imageView must include either VK_IMAGE_ASPECT_DEPTH_BIT or VK_IMAGE_ASPECT_STENCIL_BIT but not both (https://docs.vulkan.org/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorImageInfo-imageView-01976)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions