Adjust samples to recent swap chain class changes

This commit is contained in:
Sascha Willems 2024-12-19 21:40:42 +01:00
parent dcec337fa9
commit e9270580b8
4 changed files with 6 additions and 6 deletions

View file

@ -180,7 +180,7 @@ public:
} }
// SRS - Recreate attachments and descriptors in case number of swapchain images has changed on resize // SRS - Recreate attachments and descriptors in case number of swapchain images has changed on resize
attachments.resize(swapChain.imageCount); attachments.resize(swapChain.images.size());
for (auto i = 0; i < attachments.size(); i++) { for (auto i = 0; i < attachments.size(); i++) {
createAttachment(colorFormat, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &attachments[i].color); createAttachment(colorFormat, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &attachments[i].color);
createAttachment(depthFormat, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, &attachments[i].depth); createAttachment(depthFormat, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, &attachments[i].depth);
@ -207,7 +207,7 @@ public:
frameBufferCI.height = height; frameBufferCI.height = height;
frameBufferCI.layers = 1; frameBufferCI.layers = 1;
frameBuffers.resize(swapChain.imageCount); frameBuffers.resize(swapChain.images.size());
for (uint32_t i = 0; i < frameBuffers.size(); i++) for (uint32_t i = 0; i < frameBuffers.size(); i++)
{ {
views[0] = swapChain.imageViews[i]; views[0] = swapChain.imageViews[i];
@ -222,7 +222,7 @@ public:
{ {
attachmentSize = { width, height }; attachmentSize = { width, height };
attachments.resize(swapChain.imageCount); attachments.resize(swapChain.images.size());
for (auto i = 0; i < attachments.size(); i++) { for (auto i = 0; i < attachments.size(); i++) {
createAttachment(colorFormat, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &attachments[i].color); createAttachment(colorFormat, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &attachments[i].color);
createAttachment(depthFormat, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, &attachments[i].depth); createAttachment(depthFormat, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, &attachments[i].depth);

View file

@ -330,7 +330,7 @@ public:
frameBufferCreateInfo.layers = 1; frameBufferCreateInfo.layers = 1;
// Create frame buffers for every swap chain image // Create frame buffers for every swap chain image
frameBuffers.resize(swapChain.imageCount); frameBuffers.resize(swapChain.images.size());
for (uint32_t i = 0; i < frameBuffers.size(); i++) for (uint32_t i = 0; i < frameBuffers.size(); i++)
{ {
attachments[1] = swapChain.imageViews[i]; attachments[1] = swapChain.imageViews[i];

View file

@ -248,7 +248,7 @@ public:
frameBufferCreateInfo.layers = 1; frameBufferCreateInfo.layers = 1;
// Create frame buffers for every swap chain image // Create frame buffers for every swap chain image
frameBuffers.resize(swapChain.imageCount); frameBuffers.resize(swapChain.images.size());
for (uint32_t i = 0; i < frameBuffers.size(); i++) for (uint32_t i = 0; i < frameBuffers.size(); i++)
{ {
attachments[0] = swapChain.imageViews[i]; attachments[0] = swapChain.imageViews[i];

View file

@ -505,7 +505,7 @@ public:
void setupFrameBuffer() void setupFrameBuffer()
{ {
// Create a frame buffer for every image in the swapchain // Create a frame buffer for every image in the swapchain
frameBuffers.resize(swapChain.imageCount); frameBuffers.resize(swapChain.images.size());
for (size_t i = 0; i < frameBuffers.size(); i++) for (size_t i = 0; i < frameBuffers.size(); i++)
{ {
std::array<VkImageView, 2> attachments{}; std::array<VkImageView, 2> attachments{};