Merge pull request #812 from tangmi/remove-host-commands
Remove acceleration structure host commands usage
This commit is contained in:
commit
2735ea213e
5 changed files with 90 additions and 212 deletions
|
|
@ -125,27 +125,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
deleteScratchBuffer(scratchBuffer);
|
||||
}
|
||||
|
|
@ -225,27 +213,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
deleteScratchBuffer(scratchBuffer);
|
||||
instancesBuffer.destroy();
|
||||
|
|
|
|||
|
|
@ -373,27 +373,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
VkAccelerationStructureDeviceAddressInfoKHR accelerationDeviceAddressInfo{};
|
||||
accelerationDeviceAddressInfo.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_DEVICE_ADDRESS_INFO_KHR;
|
||||
|
|
@ -492,27 +480,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
VkAccelerationStructureDeviceAddressInfoKHR accelerationDeviceAddressInfo{};
|
||||
accelerationDeviceAddressInfo.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_DEVICE_ADDRESS_INFO_KHR;
|
||||
|
|
|
|||
|
|
@ -199,27 +199,15 @@ public:
|
|||
}
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfos[0], &accelerationStructureBuildRangeInfos[1], &accelerationStructureBuildRangeInfos[2] };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
deleteScratchBuffer(scratchBuffer);
|
||||
}
|
||||
|
|
@ -299,27 +287,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
deleteScratchBuffer(scratchBuffer);
|
||||
instancesBuffer.destroy();
|
||||
|
|
|
|||
|
|
@ -137,27 +137,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
deleteScratchBuffer(scratchBuffer);
|
||||
}
|
||||
|
|
@ -237,27 +225,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
deleteScratchBuffer(scratchBuffer);
|
||||
instancesBuffer.destroy();
|
||||
|
|
|
|||
|
|
@ -136,28 +136,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
deleteScratchBuffer(scratchBuffer);
|
||||
}
|
||||
|
|
@ -238,28 +225,15 @@ public:
|
|||
accelerationStructureBuildRangeInfo.transformOffset = 0;
|
||||
std::vector<VkAccelerationStructureBuildRangeInfoKHR*> accelerationBuildStructureRangeInfos = { &accelerationStructureBuildRangeInfo };
|
||||
|
||||
if (accelerationStructureFeatures.accelerationStructureHostCommands)
|
||||
{
|
||||
// Implementation supports building acceleration structure building on host
|
||||
// Implementation supports building acceleration structure building on host
|
||||
vkBuildAccelerationStructuresKHR(
|
||||
device,
|
||||
VK_NULL_HANDLE,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acceleration structure needs to be build on the device
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
}
|
||||
// Build the acceleration structure on the device via a one-time command buffer submission
|
||||
// Some implementations may support acceleration structure building on the host (VkPhysicalDeviceAccelerationStructureFeaturesKHR->accelerationStructureHostCommands), but we prefer device builds
|
||||
VkCommandBuffer commandBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||
vkCmdBuildAccelerationStructuresKHR(
|
||||
commandBuffer,
|
||||
1,
|
||||
&accelerationBuildGeometryInfo,
|
||||
accelerationBuildStructureRangeInfos.data());
|
||||
vulkanDevice->flushCommandBuffer(commandBuffer, queue);
|
||||
|
||||
deleteScratchBuffer(scratchBuffer);
|
||||
instancesBuffer.destroy();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue