Skip to content

Commit 9844019

Browse files
author
devsh
committed
Note that StackAllocation::size returns what sizeof(T[N]) would have, fix bugs
Also add links to Vulkan spec about why we error out in `ILogicalDevice::writeAccelerationStructuresProperties`
1 parent a383f5a commit 9844019

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

include/nbl/video/ILogicalDevice.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,17 +567,19 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe
567567
return false;
568568
break;
569569
}
570+
// https://vulkan.lunarg.com/doc/view/1.3.290.0/windows/1.3-extensions/vkspec.html#VUID-vkWriteAccelerationStructuresPropertiesKHR-accelerationStructureHostCommands-03585
570571
if (!getEnabledFeatures().accelerationStructureHostCommands)
571572
{
572573
NBL_LOG_ERROR("Feature `acceleration structure` host commands is not enabled");
573574
return false;
574575
}
576+
// https://vulkan.lunarg.com/doc/view/1.3.290.0/windows/1.3-extensions/vkspec.html#VUID-vkWriteAccelerationStructuresPropertiesKHR-buffer-03733
575577
for (const auto& as : accelerationStructures)
576-
if (invalidAccelerationStructureForHostOperations(as))
577-
{
578-
NBL_LOG_ERROR("Invalid acceleration structure for host operations");
579-
return false;
580-
}
578+
if (invalidAccelerationStructureForHostOperations(as))
579+
{
580+
NBL_LOG_ERROR("Invalid acceleration structure for host operations");
581+
return false;
582+
}
581583
// unfortunately cannot validate if they're built and if they're built with the right flags
582584
return writeAccelerationStructuresProperties_impl(accelerationStructures,type,data,stride);
583585
}

src/nbl/video/CVulkanCommandBuffer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ bool CVulkanCommandBuffer::writeAccelerationStructureProperties_impl(const std::
583583
vk_accelerationStructures[i] = *reinterpret_cast<const VkAccelerationStructureKHR*>(static_cast<const IGPUAccelerationStructure*>(pAccelerationStructures[i])->getNativeHandle());
584584

585585
getFunctionTable().vkCmdWriteAccelerationStructuresPropertiesKHR(
586-
m_cmdbuf, vk_accelerationStructures.size(), vk_accelerationStructures.data(),
586+
m_cmdbuf, vk_accelerationStructures.size()/sizeof(VkAccelerationStructureKHR), vk_accelerationStructures.data(),
587587
CVulkanQueryPool::getVkQueryTypeFrom(queryType), static_cast<CVulkanQueryPool*>(queryPool)->getInternalObject(), firstQuery
588588
);
589589
return true;
@@ -643,7 +643,7 @@ bool CVulkanCommandBuffer::beginRenderPass_impl(const SRenderpassBeginInfo& info
643643
.renderArea = info.renderArea,
644644
// Implicitly but could be optimizedif needed
645645
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkRenderPassBeginInfo.html#VUID-VkRenderPassBeginInfo-clearValueCount-00902
646-
.clearValueCount = vk_clearValues.size(),
646+
.clearValueCount = vk_clearValues.size()/sizeof(VkClearValue),
647647
// Implicit
648648
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkRenderPassBeginInfo.html#VUID-VkRenderPassBeginInfo-clearValueCount-04962
649649
.pClearValues = vk_clearValues.data()

0 commit comments

Comments
 (0)