Port UI icon textures from OpenGL to Vulkan, fix loading screen clear values

Replace all glGenTextures/glTexImage2D calls in UI code with Vulkan texture
uploads via new VkContext::uploadImGuiTexture() helper. This fixes segfaults
from calling OpenGL functions without a GL context (null GLEW function pointers).

- Add uploadImGuiTexture() to VkContext with staging buffer upload pattern
- Convert game_screen, inventory_screen, spellbook_screen, talent_screen
  from GLuint/GL calls to VkDescriptorSet/Vulkan uploads
- Fix loading_screen clearValueCount (was 1, needs 2 or 3 for MSAA)
This commit is contained in:
Kelsi 2026-02-22 03:32:08 -08:00
parent b1a9d231c7
commit 325254dfcb
11 changed files with 314 additions and 136 deletions

View file

@ -8,7 +8,7 @@
#include "ui/quest_log_screen.hpp"
#include "ui/spellbook_screen.hpp"
#include "ui/talent_screen.hpp"
#include <GL/glew.h>
#include <vulkan/vulkan.h>
#include <imgui.h>
#include <string>
#include <unordered_map>
@ -217,21 +217,21 @@ private:
// WorldMap is now owned by Renderer (accessed via renderer->getWorldMap())
// Spell icon cache: spellId -> GL texture ID
std::unordered_map<uint32_t, GLuint> spellIconCache_;
std::unordered_map<uint32_t, VkDescriptorSet> spellIconCache_;
// SpellIconID -> icon path (from SpellIcon.dbc)
std::unordered_map<uint32_t, std::string> spellIconPaths_;
// SpellID -> SpellIconID (from Spell.dbc field 133)
std::unordered_map<uint32_t, uint32_t> spellIconIds_;
bool spellIconDbLoaded_ = false;
GLuint getSpellIcon(uint32_t spellId, pipeline::AssetManager* am);
VkDescriptorSet getSpellIcon(uint32_t spellId, pipeline::AssetManager* am);
// Action bar drag state (-1 = not dragging)
int actionBarDragSlot_ = -1;
GLuint actionBarDragIcon_ = 0;
VkDescriptorSet actionBarDragIcon_ = VK_NULL_HANDLE;
// Bag bar state
GLuint backpackIconTexture_ = 0;
GLuint emptyBagSlotTexture_ = 0;
VkDescriptorSet backpackIconTexture_ = VK_NULL_HANDLE;
VkDescriptorSet emptyBagSlotTexture_ = VK_NULL_HANDLE;
int bagBarPickedSlot_ = -1; // Visual drag in progress (-1 = none)
int bagBarDragSource_ = -1; // Mouse pressed on this slot, waiting for drag or click (-1 = none)