fangcun010 / VulkanTutorialCN

Vulkan中文教程
MIT License
662 stars 91 forks source link

代码示例错误(In Chapter 21.3) #15

Open HuajiKojima opened 4 weeks ago

HuajiKojima commented 4 weeks ago

在第21章重建交换链的第21.3小节(page 163),判断交换链是否重建的代码段中第10至14行代码(文档中代码段行号)与第5到9行代码(文档中代码段行号)重复且易造成歧义。Vulkan tutorial原文中代码不存在第10至第14行。 文档中代码如下:

VkResult result = vkAcquireNextImageKHR(device, swapChain, std::numeric<uint64_t>::max(), imageAvailableSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex);

if (result == VK_ERROR_OUT_OF_DATE_KHR) {
    recreateSwapChain();
    return;
} else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) {
    throw std::runtime_error("failed to acquire swap chain image!");
}
recreateSwapChain();
return;
} else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) {
    throw std::runtime_error("failed to acquire swap chain image!");
}

Vulkan tutorial原文中代码如下:

VkResult result = vkAcquireNextImageKHR(device, swapChain, UINT64_MAX, imageAvailableSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex);

if (result == VK_ERROR_OUT_OF_DATE_KHR) {
    recreateSwapChain();
    return;
} else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) {
    throw std::runtime_error("failed to acquire swap chain image!");
}
fangcun010 commented 4 weeks ago

感谢反馈,欢迎提PR,我来合并。