Move pipeline barrier to a more logical location

This commit is contained in:
Magnus Norddahl 2022-07-03 03:10:39 +02:00
parent 6e8757649c
commit b67f265c75

View file

@ -148,10 +148,6 @@ void GPURaytracer2::CreateVulkanObjects()
CreatePipeline(); CreatePipeline();
CreateDescriptorSet(); CreateDescriptorSet();
PipelineBarrier()
.AddMemory(VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR, VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR)
.Execute(cmdbuffer.get(), VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
FinishCommands(); FinishCommands();
} }
@ -398,6 +394,10 @@ void GPURaytracer2::CreateTopLevelAccelerationStructure()
rangeInfo.primitiveCount = maxInstanceCount; rangeInfo.primitiveCount = maxInstanceCount;
cmdbuffer->buildAccelerationStructures(1, &buildInfo, rangeInfos); cmdbuffer->buildAccelerationStructures(1, &buildInfo, rangeInfos);
PipelineBarrier()
.AddMemory(VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR, VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR)
.Execute(cmdbuffer.get(), VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
} }
void GPURaytracer2::CreateShaders() void GPURaytracer2::CreateShaders()