From 8bbec3c8e10178d571d8b7f77545160ae2eff930 Mon Sep 17 00:00:00 2001 From: Alexander Gauggel <agauggel@uni-koblenz.de> Date: Fri, 4 Jun 2021 18:27:16 +0200 Subject: [PATCH] [#66] Fix compile error --- projects/first_mesh/src/main.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/projects/first_mesh/src/main.cpp b/projects/first_mesh/src/main.cpp index 01d8b74f..44cb9c74 100644 --- a/projects/first_mesh/src/main.cpp +++ b/projects/first_mesh/src/main.cpp @@ -8,10 +8,13 @@ int main(int argc, const char** argv) { const char* applicationName = "First Mesh"; + const int windowWidth = 800; + const int windowHeight = 600; + vkcv::Window window = vkcv::Window::create( applicationName, - 800, - 600, + windowWidth, + windowHeight, true ); @@ -115,7 +118,8 @@ int main(int argc, const char** argv) { UINT32_MAX, trianglePass, mesh.vertexGroups[0].vertexBuffer.attributes, - { core.getDescriptorSetLayout(set, 0) }); + { core.getDescriptorSetLayout(set, 0) }, + true); vkcv::PipelineHandle trianglePipeline = core.createGraphicsPipeline(trianglePipelineDefinition); if (!trianglePipeline) { @@ -144,6 +148,14 @@ int main(int argc, const char** argv) { setWrites.samplerWrites = { vkcv::SamplerDescriptorWrite(1, sampler) }; core.writeResourceDescription(set, 0, setWrites); + vkcv::ImageHandle depthBuffer = core.createImage(vk::Format::eD32Sfloat, windowWidth, windowHeight).getHandle(); + + window.e_resize.add([&](int width, int height) { + depthBuffer = core.createImage(vk::Format::eD32Sfloat, width, height).getHandle(); + }); + + const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle(); + auto start = std::chrono::system_clock::now(); while (window.isWindowOpen()) { vkcv::Window::pollEvents(); @@ -167,8 +179,8 @@ int main(int argc, const char** argv) { indexBuffer.getHandle(), mesh.vertexGroups[0].numIndices, set, - 0 - ); + 0, + { swapchainInput, depthBuffer }); core.endFrame(); } -- GitLab