Skip to content

Commit

Permalink
fix image layout transition not changing the layout of the class inst…
Browse files Browse the repository at this point in the history
…ance
  • Loading branch information
WinteryFox committed Jan 30, 2024
1 parent 063d719 commit 5efdfa1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/engine/vk/VkCommandBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ namespace Vixen::Vk {
&region);
}

void VkCommandBuffer::transitionImage(const VkImage& image, const VkImageLayout layout) const {
void VkCommandBuffer::transitionImage(VkImage& image, const VkImageLayout layout) const {
VkImageMemoryBarrier barrier{
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr,
Expand Down Expand Up @@ -355,6 +355,9 @@ namespace Vixen::Vk {
1,
&barrier
);

// TODO: I hate this, but I'm not sure how else to solve this.
image.layout = layout;
}

void VkCommandBuffer::copyImage(const VkImage& source, const VkImage& destination) const {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/vk/VkCommandBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ namespace Vixen::Vk {

void copyBufferToImage(const VkBuffer& source, const VkImage& destination) const;

void transitionImage(const VkImage& image, VkImageLayout layout) const;
void transitionImage(VkImage& image, VkImageLayout layout) const;
};
}
2 changes: 1 addition & 1 deletion src/engine/vk/VkRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace Vixen::Vk {
device->getGraphicsQueue(),
{imageAvailableSemaphore.getSemaphore()},
{VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT},
{renderFinishedSemaphores[currentFrame].getSemaphore()}
signalSemaphores
);

swapchain->present(imageIndex, signalSemaphores);
Expand Down

0 comments on commit 5efdfa1

Please sign in to comment.