Skip to content

Commit

Permalink
gui: use init_info.DescriptorPoolSize
Browse files Browse the repository at this point in the history
  • Loading branch information
scribam committed Jan 15, 2025
1 parent abc3f2b commit 6bec353
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 22 deletions.
1 change: 0 additions & 1 deletion vita3k/app/src/app_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ void destroy(EmuEnvState &emuenv, GuiState &gui) {
gui.manuals.clear();
gui.trophy_window_icon = {};
ImGui_ImplVulkan_Shutdown();
dynamic_cast<renderer::vulkan::VKState &>(*emuenv.renderer).device.destroy(imgui_descriptor_pool);
break;
default:
LOG_ERROR("Missing ImGui init for backend {}.", static_cast<int>(emuenv.renderer->current_backend));
Expand Down
2 changes: 0 additions & 2 deletions vita3k/gui/include/gui/imgui_impl_sdl_vulkan_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include <renderer/vulkan/state.h>
#include <vkutil/vkutil.h>

extern VkDescriptorPool imgui_descriptor_pool;

struct VKTextureData : ImguiTextureData
{
private:
Expand Down
18 changes: 1 addition & 17 deletions vita3k/gui/src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,22 +675,6 @@ void pre_init(GuiState &gui, EmuEnvState &emuenv) {
} else if (emuenv.renderer->current_backend == renderer::Backend::Vulkan) {
auto& vk_state = dynamic_cast<renderer::vulkan::VKState &>(*emuenv.renderer);

/**
* Create descriptor pool
*/
static constexpr uint32_t nb_descriptor_sets = 1024;

vk::DescriptorPoolSize pool_size{
.type = vk::DescriptorType::eCombinedImageSampler,
.descriptorCount = nb_descriptor_sets
};
vk::DescriptorPoolCreateInfo pool_info{
.maxSets = nb_descriptor_sets,
};
pool_info.setFlags(vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet);
pool_info.setPoolSizes(pool_size);
imgui_descriptor_pool = vk_state.device.createDescriptorPool(pool_info);

ImGui_ImplSDL2_InitForVulkan(emuenv.window.get());
ImGui_ImplVulkan_InitInfo init_info = {};
init_info.Instance = vk_state.instance;
Expand All @@ -699,7 +683,7 @@ void pre_init(GuiState &gui, EmuEnvState &emuenv) {
init_info.QueueFamily = vk_state.general_family_index;
init_info.Queue = vk_state.general_queue;
init_info.PipelineCache = VK_NULL_HANDLE;
init_info.DescriptorPool = imgui_descriptor_pool;
init_info.DescriptorPoolSize = 1024;
init_info.RenderPass = vk_state.screen_renderer.default_render_pass;
init_info.Subpass = 0;
init_info.MinImageCount = vk_state.screen_renderer.surface_capabilities.minImageCount;
Expand Down
2 changes: 0 additions & 2 deletions vita3k/gui/src/imgui_impl_sdl_vulkan_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

#include <imgui_impl_vulkan.h>

VkDescriptorPool imgui_descriptor_pool;

// Helper function to find Vulkan memory type bits. See ImGui_ImplVulkan_MemoryType() in imgui_impl_vulkan.cpp
uint32_t findMemoryType(vk::PhysicalDevice physicalDevice, uint32_t type_filter, vk::MemoryPropertyFlags properties) {
vk::PhysicalDeviceMemoryProperties mem_properties = physicalDevice.getMemoryProperties();
Expand Down

0 comments on commit 6bec353

Please sign in to comment.