Release resources, fixes validation

Scene setup
This commit is contained in:
Sascha Willems 2020-12-12 08:40:28 +01:00
parent 3cf8fb81e3
commit 846413cc4b
2 changed files with 11 additions and 11 deletions

View file

@ -40,12 +40,12 @@ public:
VulkanExample() : VulkanRaytracingSample()
{
title = "Ray query";
title = "Ray queries for ray traced shadows";
camera.type = Camera::CameraType::lookat;
camera.setPosition(glm::vec3(0.0f, -0.0f, -20.0f));
camera.setRotation(glm::vec3(-15.0f, -390.0f, 0.0f));
camera.setPerspective(60.0f, (float)width / (float)height, 1.0f, 256.0f);
timerSpeed *= 0.5f;
timerSpeed *= 0.25f;
camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 512.0f);
camera.setRotation(glm::vec3(0.0f, 0.0f, 0.0f));
camera.setTranslation(glm::vec3(0.0f, 3.0f, -10.0f));
settings.overlay = true;
enableExtensions();
enabledDeviceExtensions.push_back(VK_KHR_RAY_QUERY_EXTENSION_NAME);
@ -57,6 +57,8 @@ public:
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
ubo.destroy();
deleteAccelerationStructure(bottomLevelAS);
deleteAccelerationStructure(topLevelAS);
}
/*
@ -269,7 +271,7 @@ public:
Second pass: Scene rendering with applied shadow map
*/
clearValues[0].color = defaultClearColor;
clearValues[0].color = { { 0.0f, 0.0f, 0.2f, 1.0f } };;
clearValues[1].depthStencil = { 1.0f, 0 };
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
@ -306,11 +308,6 @@ public:
vkglTF::memoryPropertyFlags = VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
const uint32_t glTFLoadingFlags = vkglTF::FileLoadingFlags::PreTransformVertices | vkglTF::FileLoadingFlags::PreMultiplyVertexColors | vkglTF::FileLoadingFlags::FlipY;
scene.loadFromFile(getAssetPath() + "models/vulkanscene_shadow.gltf", vulkanDevice, queue, glTFLoadingFlags);
//const uint32_t glTFLoadingFlags = vkglTF::FileLoadingFlags::PreTransformVertices | vkglTF::FileLoadingFlags::PreMultiplyVertexColors | vkglTF::FileLoadingFlags::FlipY;
//scenes.resize(2);
//scenes[0].loadFromFile(getAssetPath() + "models/vulkanscene_shadow.gltf", vulkanDevice, queue, glTFLoadingFlags);
//scenes[1].loadFromFile(getAssetPath() + "models/samplescene.gltf", vulkanDevice, queue, glTFLoadingFlags);
//sceneNames = {"Vulkan scene", "Teapots and pillars" };
}
void setupDescriptorPool()

View file

@ -66,6 +66,9 @@ public:
shaderBindingTables.miss.destroy();
shaderBindingTables.hit.destroy();
shaderBindingTables.callable.destroy();
vertexBuffer.destroy();
indexBuffer.destroy();
transformBuffer.destroy();
ubo.destroy();
}