|
|
|
@ -29,8 +29,7 @@ Application::Application() { |
|
|
|
|
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, |
|
|
|
|
VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, |
|
|
|
|
VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT); |
|
|
|
|
|
|
|
|
|
descriptorPool->bindBuffer(*cameraUniformBuffer, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, DescriptorSet::WORLD, 0); |
|
|
|
|
cameraUniformBuffer->setName("Camera"); |
|
|
|
|
camera = make_unique<Camera>(swapchain->extent); |
|
|
|
|
|
|
|
|
|
struct GrabInformation { |
|
|
|
@ -42,6 +41,7 @@ Application::Application() { |
|
|
|
|
initialGrabInformation.distanceToFace = 1e20; |
|
|
|
|
grabBuffer = make_unique<Buffer>(sizeof(GrabInformation), &initialGrabInformation, sizeof(GrabInformation), |
|
|
|
|
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, 0); |
|
|
|
|
grabBuffer->setName("Grab"); |
|
|
|
|
grabber = make_unique<Grabber>(); |
|
|
|
|
|
|
|
|
|
createMeshBuffers(); |
|
|
|
@ -54,6 +54,7 @@ Application::Application() { |
|
|
|
|
sizeof(SizeInformation), &sizeInformation, sizeof(sizeInformation), |
|
|
|
|
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, |
|
|
|
|
VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, 0); |
|
|
|
|
sizeInformationBuffer->setName("Sizes"); |
|
|
|
|
|
|
|
|
|
properties.gravity = {0, -9.81, 0}; |
|
|
|
|
properties.k = 10; |
|
|
|
@ -63,6 +64,10 @@ Application::Application() { |
|
|
|
|
sizeof(Properties), &properties, sizeof(properties), |
|
|
|
|
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, |
|
|
|
|
VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, 0); |
|
|
|
|
propertiesBuffer->setName("Simulation properties"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
descriptorPool->bindBuffer(*cameraUniformBuffer, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, DescriptorSet::WORLD, 0); |
|
|
|
|
|
|
|
|
|
descriptorPool->bindBuffer(*vertexBuffers[1 - currentDrawVertexBuffer], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, DescriptorSet::MESH, 0); |
|
|
|
|
descriptorPool->bindBuffer(*faceBuffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, DescriptorSet::MESH, 1); |
|
|
|
@ -76,10 +81,7 @@ Application::Application() { |
|
|
|
|
|
|
|
|
|
createComputePipelines(); |
|
|
|
|
|
|
|
|
|
char* stats; |
|
|
|
|
vmaBuildStatsString(Instance::GetAllocator(), &stats, VK_TRUE); |
|
|
|
|
// printf("%s", stats);
|
|
|
|
|
vmaFreeStatsString(Instance::GetAllocator(), stats); |
|
|
|
|
printVmaStats(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#include <future> |
|
|
|
@ -238,6 +240,13 @@ void Application::createMeshBuffers() { |
|
|
|
|
edgeBuffer = make_unique<SimulationBuffer>(constraintData.edges.data(), constraintData.edges.size() * sizeof(Edge)); |
|
|
|
|
triangleBuffer = make_unique<SimulationBuffer>(constraintData.triangles.data(), constraintData.triangles.size() * sizeof(Triangle)); |
|
|
|
|
tetrahedronBuffer = make_unique<SimulationBuffer>(constraintData.tetrahedra.data(), constraintData.tetrahedra.size() * sizeof(Tetrahedron)); |
|
|
|
|
|
|
|
|
|
vertexBuffers[0]->setName("Vertices 0"); |
|
|
|
|
vertexBuffers[1]->setName("Vertices 1"); |
|
|
|
|
faceBuffer->setName("Faces"); |
|
|
|
|
edgeBuffer->setName("Edges"); |
|
|
|
|
triangleBuffer->setName("Triangles"); |
|
|
|
|
tetrahedronBuffer->setName("Tetrahedra"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Application::createComputePipelines() { |
|
|
|
|