Workaround AMD driver bug

* This may be present on other drivers - the vulkan spec allows a NULL pointer
  (or really garbage)
This commit is contained in:
baldurk
2025-01-14 15:22:10 +00:00
parent 2dee289ff5
commit 6feafaf74e
@@ -742,6 +742,10 @@ void VulkanAccelerationStructureManager::Apply(ResourceId id, VkInitialContents
for(VkAccelerationStructureBuildRangeInfoKHR numPrims : buildRangeInfos)
counts.push_back(numPrims.primitiveCount);
// ensure counts is non-empty even if there are no geometries, to work around AMD (at least)
// driver bug reading from NULL otherwise
counts.resize_for_index(0);
ObjDisp(d)->GetAccelerationStructureBuildSizesKHR(
Unwrap(d), VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR, &sizeInfo, counts.data(),
&sizeResult);