Skip to content

Cannot create texture view with different format than the texture #283

@EriKWDev

Description

@EriKWDev

If you want to create a view into depth only out of Depth32FloatStencil8Uint, just use the Depth32Float format when creating the view. Similarly, use Stencil8Uint format if you need the stencil aspect.

Originally posted by @kvark in #278

Hmm, If I create a texture with format Depth32FloatStencil8Uint and create a view with format Depth32Float, I get the following validation error:

VUID-VkImageViewCreateInfo-image-01762(ERROR / SPEC): msgNum: 1695986743 - Validation Error: [ VUID-VkImageViewCreateInfo-image-01762 ] Object 0: handle = 0x176083000000005f, name = refraction depth, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x6516b437 | vkCreateImageView(): pCreateInfo->format VK_FORMAT_D32_SFLOAT is different from VkImage 0x176083000000005f[refraction depth] format (VK_FORMAT_D32_SFLOAT_S8_UINT). Formats MUST be IDENTICAL unless VK_IMAGE_CREATE_MUTABLE_FORMAT BIT was set on image creation.
The Vulkan spec states: If image was not created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, or if the format of the image is a multi-planar format and if subresourceRange.aspectMask is VK_IMAGE_ASPECT_COLOR_BIT, format must be identical to the format used to create image (https://vulkan.lunarg.com/doc/view/1.3.296.0/linux/1.3-extensions/vkspec.html#VUID-VkImageViewCreateInfo-image-01762)
    Objects: 1
        [0] 0x176083000000005f, type: 10, name: refraction depth

Seems it is not currently allowed in blade since the MUTABLE_FORMAT flag is not set on image creation

In my fork I added ability to explicitly state the aspect on the texture view so I can have a view of the same format but only the DEPTH aspect. But I suppose a view of format Depth32Float would also suffice if we can get that to work :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions