Skip to content

Add a check for VUID-VkImageCreateInfo-fragmentDensityMapOffset-06514 #10845

@iagoCL

Description

@iagoCL

Describe the situation in which you encountered the missing validation
When developing the Fragment Density Map (FDM) sample, I encountered a bug in my code that caused the attached FDM image to have incorrect dimensions. This resulted in the image being offset. The root cause was difficult to notice due to the lack of corresponding validation checks in the layers.

Valid Usage IDs requested
VUID-VkImageCreateInfo-fragmentDensityMapOffset-06514

If the fragmentDensityMapOffset feature is not enabled and usage includes VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT, extent.width must be less than or equal to ⌈minFragmentDensityTexelSizewidth​maxFramebufferWidth​⌉

Additional Context

The validation layers already include a check for the opposite case, so I currently receive this warning if the FDM attachment is too small.

The Vulkan spec states: If flags does not include VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, an element of pAttachments that is referenced by fragmentDensityMapAttachment must have a height at least as large as the ceiling of height/maxFragmentDensityTexelSize.height (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkFramebufferCreateInfo-pAttachments-02556)

I’m not very familiar with the validation layers’ codebase, but I assume adding a similar check for minFragmentDensityTexelSize should be relatively straightforward.

The easiest way to reproduce this issue is to use the new FDM Vulkan sample () and set the FDM texel size to an invalid value.

 void FragmentDensityMap::request_gpu_features(vkb::PhysicalDevice &gpu)                                                   physical_device_FRAGMENT_DENSITY_MAP_properties.minFragmentDensityTexelSize.height,                                                   physical_device_FRAGMENT_DENSITY_MAP_properties.maxFragmentDensityTexelSize.height);
        }
+  // This tiggers a validation error on Mali G715. The result is incorrect (circle is offset)
+  // fdm.texel_size = {55,55};
+  // This does not tiggers a validation error on Mali G715. The result is incorrect (semi-circle)
+  fdm.texel_size = {15,15};
        last_options = current_options;
 }  

Note:

Metadata

Metadata

Assignees

No one assigned

    Labels

    IncompleteMissing Validation VUs to be added

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions