Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation error in shadow mapping sample #69

Open
BinaryCat17 opened this issue Aug 2, 2019 · 1 comment
Open

Validation error in shadow mapping sample #69

BinaryCat17 opened this issue Aug 2, 2019 · 1 comment

Comments

@BinaryCat17
Copy link

image
I ran into this problem when I created shadow maps in my project. My command buffers are rebuilt every frame, so this error constantly appears. I decided to run examples and found that there is the same problem.

Error :
VUID-VkWriteDescriptorSet-descriptorType-01403(ERROR / SPEC): msgNum: 0 - vkUpdateDescriptorSets() failed write update validation for Descriptor Set 0x27 with error: Write update to VkDescriptorSet 0x27 allocated with VkDescriptorSetLayout 0x17 binding #2 failed with error message: Attempted write update to combined image sampler descriptor failed due to: Descriptor update with descriptorType VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER is being updated with invalid imageLayout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL. Allowed layouts are: VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_GENERAL. The Vulkan spec states: If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, the imageLayout member of each element of pImageInfo must be a member of the list given in Sampled Image or Combined Image Sampler, corresponding to its type (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkWriteDescriptorSet-descriptorType-01403)

@JSandusky
Copy link

@ComradeStalin17 I ran into the same thing, I cludged around it by mashing the VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT into a marker to make Device::CreateImage in Device.cpp construct the depth image differently:

// Determine a "default" image layout based on the usage.  This default image layout will be assumed during command buffer recording.
        // Ordering of conditional statements below determine image layout precedence.
        // Example: When usage is SAMPLED_BIT, that takes precendence over the image being used as a color attachment or for transfer operations.
        auto usage = pCreateInfo->usage;
        VkImageLayout defaultLayout = imageCreateInfo.initialLayout;
        if (usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) defaultLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
        else if (usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
            if (usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) // use input-attachment bit as a flag
                defaultLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
            else
                defaultLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
        }

Same deal for color attachments. Though I initially used the sampled bit instead of input_attachment bit, that messed with most of my other render-targets so I had to use the sketchier bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants