Skip to content

Commit

Permalink
Remove old node header node from upload code
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Oct 21, 2024
1 parent 9bf6e60 commit e7c2716
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/common/rendering/vulkan/vk_levelmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,20 +782,15 @@ static FVector3 SwapYZ(const FVector3& v)

void VkLevelMeshUploader::UploadNodes()
{
if (Mesh->useRayQuery)
if (Mesh->useRayQuery || Mesh->Mesh->UploadRanges.Node.Size() == 0)
return;

// Always update the header struct of the collision storage buffer block if something changed
if (Mesh->Mesh->UploadRanges.Node.Size() > 0)
{
CollisionNodeBufferHeader nodesHeader;
nodesHeader.root = Mesh->Mesh->Mesh.RootNode;

*((CollisionNodeBufferHeader*)(data + datapos)) = nodesHeader;
copyCommands.emplace_back(transferBuffer.get(), Mesh->NodeBuffer.get(), datapos, 0, sizeof(CollisionNodeBufferHeader));

datapos += sizeof(CollisionNodeBufferHeader) + sizeof(CollisionNode);
}
CollisionNodeBufferHeader nodesHeader;
nodesHeader.root = Mesh->Mesh->Mesh.RootNode;
*((CollisionNodeBufferHeader*)(data + datapos)) = nodesHeader;
copyCommands.emplace_back(transferBuffer.get(), Mesh->NodeBuffer.get(), datapos, 0, sizeof(CollisionNodeBufferHeader));
datapos += sizeof(CollisionNodeBufferHeader);

// Copy collision nodes
for (const MeshBufferRange& range : Mesh->Mesh->UploadRanges.Node)
Expand Down Expand Up @@ -942,7 +937,7 @@ size_t VkLevelMeshUploader::GetTransferSize()
size_t transferBufferSize = 0;
if (!Mesh->useRayQuery)
{
if (Mesh->Mesh->UploadRanges.Node.Size() > 0) transferBufferSize += sizeof(CollisionNodeBufferHeader) + sizeof(CollisionNode);
if (Mesh->Mesh->UploadRanges.Node.Size() > 0) transferBufferSize += sizeof(CollisionNodeBufferHeader);
for (const MeshBufferRange& range : Mesh->Mesh->UploadRanges.Node) transferBufferSize += range.Count() * sizeof(CollisionNode);
}
for (const MeshBufferRange& range : Mesh->Mesh->UploadRanges.Vertex) transferBufferSize += range.Count() * sizeof(FFlatVertex);
Expand Down

0 comments on commit e7c2716

Please sign in to comment.