Fixes in examples: support swapchain image count change on resize, fix multiple validation layer errors on resize and quit, multiview now supports resize/fullscreen, computecloth deltaT now based on frame time, multisampling recreates attachments on resize, P key now pauses computeparticles, descriptorsets, and pushdescriptors

This commit is contained in:
Stephen Saunders 2022-06-01 13:02:33 -04:00
parent cb343c329a
commit 121612857c
10 changed files with 148 additions and 65 deletions

View file

@ -101,6 +101,7 @@ public:
~VulkanExample()
{
// Graphics
graphics.indices.destroy();
graphics.uniformBuffer.destroy();
vkDestroyPipeline(device, graphics.pipelines.cloth, nullptr);
vkDestroyPipeline(device, graphics.pipelines.sphere, nullptr);
@ -670,13 +671,13 @@ public:
void updateComputeUBO()
{
if (!paused) {
compute.ubo.deltaT = 0.000005f;
//compute.ubo.deltaT = 0.000005f;
// todo: base on frametime
//compute.ubo.deltaT = frameTimer * 0.0075f;
compute.ubo.deltaT = frameTimer * 0.0015f;
if (simulateWind) {
std::default_random_engine rndEngine(benchmark.active ? 0 : (unsigned)time(nullptr));
std::uniform_real_distribution<float> rd(1.0f, 6.0f);
std::uniform_real_distribution<float> rd(1.0f, 30.0f);
compute.ubo.gravity.x = cos(glm::radians(-timer * 360.0f)) * (rd(rndEngine) - rd(rndEngine));
compute.ubo.gravity.z = sin(glm::radians(timer * 360.0f)) * (rd(rndEngine) - rd(rndEngine));
}