Code cleanup

Fixes some C++2X deprecation warnings
This commit is contained in:
Sascha Willems 2025-07-05 16:15:43 +02:00
parent 878dbc2987
commit f735a89518
2 changed files with 5 additions and 6 deletions

View file

@ -334,8 +334,7 @@ void VulkanExampleBase::renderLoop()
if (wl_display_dispatch_pending(display) == -1)
return;
#endif
benchmark.run([=] { render(); }, vulkanDevice->properties);
benchmark.run([=, this] { render(); }, vulkanDevice->properties);
vkDeviceWaitIdle(device);
if (!benchmark.filename.empty()) {
benchmark.saveResults();

View file

@ -1,7 +1,7 @@
/*
* Vulkan Example - Multi threaded command buffer generation and rendering
*
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
@ -329,7 +329,7 @@ public:
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
VkClearValue clearValues[2];
VkClearValue clearValues[2]{};
clearValues[0].color = defaultClearColor;
clearValues[1].depthStencil = { 1.0f, 0 };
@ -369,7 +369,7 @@ public:
{
for (uint32_t i = 0; i < numObjectsPerThread; i++)
{
threadPool.threads[t]->addJob([=] { threadRenderCode(t, i, inheritanceInfo); });
threadPool.threads[t]->addJob([=, this] { threadRenderCode(t, i, inheritanceInfo); });
}
}
@ -428,7 +428,7 @@ public:
VkPipelineMultisampleStateCreateInfo multisampleState = vks::initializers::pipelineMultisampleStateCreateInfo(VK_SAMPLE_COUNT_1_BIT, 0);
std::vector<VkDynamicState> dynamicStateEnables = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR};
VkPipelineDynamicStateCreateInfo dynamicState = vks::initializers::pipelineDynamicStateCreateInfo(dynamicStateEnables);
std::array<VkPipelineShaderStageCreateInfo, 2> shaderStages;
std::array<VkPipelineShaderStageCreateInfo, 2> shaderStages{};
VkGraphicsPipelineCreateInfo pipelineCI = vks::initializers::pipelineCreateInfo(pipelineLayout, renderPass, 0);
pipelineCI.pInputAssemblyState = &inputAssemblyState;