Skip to content

Commit

Permalink
Fix: Vulkan warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
brenocq committed Dec 27, 2023
1 parent a66d7e0 commit 84083ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/atta/graphics/apis/vulkan/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <atta/graphics/apis/vulkan/image.h>

#include <atta/graphics/apis/vulkan/commandPool.h>
#include <atta/graphics/apis/vulkan/common.h>
#include <atta/graphics/apis/vulkan/stagingBuffer.h>

// TODO should not have UI code here
Expand Down Expand Up @@ -328,8 +329,11 @@ void Image::allocMemory() {
}

void Image::destroy() {
if (_imGuiDescriptorSet != VK_NULL_HANDLE)
if (_imGuiDescriptorSet != VK_NULL_HANDLE) {
// Make sure ImGui is not using image before removing it
vkDeviceWaitIdle(common::getDevice()->getHandle());
ImGui_ImplVulkan_RemoveTexture(_imGuiDescriptorSet);
}
if (_imageView != VK_NULL_HANDLE)
vkDestroyImageView(_device->getHandle(), _imageView, nullptr);
if (_sampler != VK_NULL_HANDLE)
Expand Down
3 changes: 2 additions & 1 deletion src/atta/graphics/windows/glfwWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ GlfwWindow::GlfwWindow(const CreateInfo& info) : Window(info) {

glfwSetErrorCallback([](int error, const char* description) { LOG_ERROR("gfx::Window", "GLFW error($0): $1", error, std::string(description)); });

glfwMakeContextCurrent(_window);
if (info.useOpenGL)
glfwMakeContextCurrent(_window);

#ifdef ATTA_OS_WEB
int w = canvas_get_width();
Expand Down
3 changes: 3 additions & 0 deletions src/atta/ui/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ void Manager::startUpImpl() {
}

void Manager::shutDownImpl() {
// Make sure all rendering operations are done
gfx::getGraphicsAPI()->waitDevice();

switch (gfx::getGraphicsAPI()->getType()) {
case gfx::GraphicsAPI::OPENGL:
ImGui_ImplOpenGL3_Shutdown();
Expand Down

0 comments on commit 84083ba

Please sign in to comment.