Skip to content

Potential false positive error when vertex buffer in BLAS is empty. #10721

@crud89

Description

@crud89

Environment:

  • OS: Windows
  • GPU and driver version: NVidia RTX 4080 Super, 560.94
  • SDK or header version if building from repo: 1.4.321.1
  • Options enabled (synchronization, best practices, etc.): VK_LAYER_KHRONOS_validation

Describe the Issue

In one of my hacky ray tracing examples, I use hit groups to decide upon geometry properties, i.e., if the geometry should be reflective or opaque. When building the BLAS for the reflective geometry, I use an empty dummy vertex buffer to have at least something in the opaque hit group. While it is certainly not the most elegant solution, it worked well so far on every hardware I've tested it with. After updating the Vulkan SDK to version 1.4 recently, however, the validation layers complain about an invalid build range in this case, as the calculation of the maximum vertex index overflows. Correct me if I'm wrong, but I did not find any note that using empty geometries is illegal (though the spec does not appear very explicit in this regard). Here is the error:

[error] VALIDATION: vkCmdBuildAccelerationStructuresKHR(): pInfos[0].pGeometries[0].geometry.triangles.maxVertex is 1 but for ppBuildRangeInfos[0], firstVertex ( 0 ) + primitiveCount ( 0 ) x 3 - 1 = 18446744073709551615.
The Vulkan spec states: For geometries of type VK_GEOMETRY_TYPE_TRIANGLES_KHR, if the geometry does not use indices, then VkAccelerationStructureGeometryTrianglesDataKHR::maxVertex must be greater than or equal to firstVertex + primitiveCount x 3 - 1 (https://vulkan.lunarg.com/doc/view/1.4.321.1/windows/antora/spec/latest/chapters/accelstructures.html#VUID-VkAccelerationStructureBuildRangeInfoKHR-None-10775)

Expected behavior

I believe that this is valid usage and that the overflow that is happening in the validation layer should be clamped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions