Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5c95985
Enable ImGui docking + multi-viewport so panels can be dragged into t…
Sajeeth-Wimalasuriyan Apr 21, 2026
f74dafd
Tidy up comments from docking/multi-viewport change
Sajeeth-Wimalasuriyan Apr 21, 2026
c6ee01d
Fix secondary viewport/OS position mismatch during drag
tomk-amd Apr 28, 2026
24e0d51
Moved linux specific window positioning work arounds to newly created…
tomk-amd Apr 28, 2026
dad6411
Fix cursor click fallthrough bug after window drag on linux wayland.
tomk-amd Apr 28, 2026
d4395b9
Fix build on various linux platforms
tomk-amd Apr 28, 2026
17e3738
Remove X11 build dependency.
tomk-amd Apr 29, 2026
5a9e5ee
Add drag-repair option for Linux Wayland users
tomk-amd Apr 30, 2026
17583d5
Refine drag-repair option for Linux Wayland users
tomk-amd Apr 30, 2026
8d80404
Disable ImGui window docking
Sajeeth-Wimalasuriyan May 25, 2026
b260e56
Merge remote-tracking branch 'origin/dev' into sw-window-docking
Sajeeth-Wimalasuriyan May 25, 2026
fed2545
Remove custom DPI handling, switch to ImGui auto-DPI font sizing
Sajeeth-Wimalasuriyan May 26, 2026
a86aa7b
Fix internal build banner positioning under multi-viewports and DPI s…
Sajeeth-Wimalasuriyan May 28, 2026
b034b95
Fix status bar scrollbar sliver under auto-DPI font scaling
Sajeeth-Wimalasuriyan May 28, 2026
0194b40
Size status bar slot to content + border, drop NoScrollbar workaround
Sajeeth-Wimalasuriyan Jun 9, 2026
22f2cc3
Restore GLFW_SCALE_TO_MONITOR window hint
Sajeeth-Wimalasuriyan Jun 10, 2026
b492e8a
Merge branch 'dev' into sw-window-docking
tomk-amd Jun 10, 2026
217d678
Merge sw-dpi-removal into sw-window-docking
Sajeeth-Wimalasuriyan Jun 10, 2026
18c8e5e
merge fix
tomk-amd Jun 10, 2026
b1b9278
changed order of log init (make first)
tomk-amd Jun 10, 2026
744b196
Merge origin/sw-window-docking (new push) into local DPI-removal work
Sajeeth-Wimalasuriyan Jun 10, 2026
056f1be
Code cleanup:
tomk-amd Jun 10, 2026
0128522
Merge origin/main into sw-window-docking
Sajeeth-Wimalasuriyan Aug 12, 2026
c79e239
Fix runaway detached-window geometry under DPI changes
Sajeeth-Wimalasuriyan Aug 12, 2026
a9c444d
Bump ImGui to v1.92.9b-docking and adapt Vulkan descriptor pool
Sajeeth-Wimalasuriyan Aug 13, 2026
b1b27b3
Potential fix for pull request finding 'CodeQL / Catching by value'
Sajeeth-Wimalasuriyan Aug 13, 2026
eec6200
Fix CodeQL format specifier and nullness findings
Sajeeth-Wimalasuriyan Aug 13, 2026
8b4893e
Fix fullscreen behaviour with dragged-out panels on Linux
tomk-amd Aug 18, 2026
28db2dc
Gate multi-viewport behind ROCPROFVIS_MULTI_WINDOW
Sajeeth-Wimalasuriyan Sep 2, 2026
ac3edec
Gate Linux drag-repair behind ROCPROFVIS_MULTI_WINDOW
Sajeeth-Wimalasuriyan Sep 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ set(APP_FILES
src/app/src/rocprofvis_imgui_vulkan.cpp
src/app/src/rocprofvis_imgui_opengl.cpp
src/app/src/glfw_util.cpp
src/app/src/rocprofvis_cli_parser.cpp)
src/app/src/rocprofvis_cli_parser.cpp
src/app/src/rocprofvis_platform_helpers.cpp)
if(APPLE)
list(APPEND APP_FILES src/app/src/rocprofvis_platform_helpers_macos.mm)
endif()
Expand Down
109 changes: 99 additions & 10 deletions src/app/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
#include "rocprofvis_version.h"
#include "rocprofvis_view_module.h"
#include "widgets/rocprofvis_image_helpers.h"
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__linux__)
#include "rocprofvis_platform_helpers.h"
#endif
#include <GLFW/glfw3.h>
#include <filesystem>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#ifdef __linux__
# include <unordered_map>
#endif

const char* APP_NAME = "ROCm(TM) Optiq";

Expand All @@ -30,6 +33,15 @@ static bool g_file_was_dropped = false;
static rocprofvis_view_render_options_t g_render_options =
rocprofvis_view_render_options_t::kRocProfVisViewRenderOption_None;

#ifdef __linux__
// Per-frame snapshot of the "intended" (drag-target) position that
// UpdateMouseMovingWindowNewFrame() wrote into viewport->Pos before we
// snap it to the actual OS position. Populated in the post-NewFrame
// hook, consumed in the pre-UpdatePlatformWindows hook so the requested
// move is still transmitted to the OS. Key: viewport ID.
static std::unordered_map<ImGuiID, ImVec2> g_viewport_intended_pos;
#endif

// Fullscreen state (initialized after window creation)
static RocProfVis::View::FullscreenState g_fullscreen_state = {};

Expand Down Expand Up @@ -194,6 +206,14 @@ parse_command_line_args(int argc, char** argv, RocProfVis::View::CLIParser& cli_
"Set file dialog backend: 'auto' (default), 'native' (system file "
"dialog), or 'imgui' (built-in). Use 'imgui' when running over SSH",
true);
#ifdef __linux__
result &= cli_parser.AddOption(
"r", "drag-repair",
"Linux post-drag click-through fix for floating windows "
"(Ubuntu Wayland bug; trade-off: brief flicker per drag-release): "
"'on'|'off' (env: ROCPROFVIS_DRAG_REPAIR; default: off)",
true);
#endif
result &= cli_parser.AddOption("h", "help",
"Show this help message and exit", false);
ROCPROFVIS_ASSERT(result);
Expand All @@ -216,6 +236,27 @@ parse_command_line_args(int argc, char** argv, RocProfVis::View::CLIParser& cli_
}
}

#ifdef __linux__
// Apply --drag-repair before any frame runs so the platform helper
// policy is in place from the very first viewport interaction.
// 'auto' (or unrecognised values) leaves the override unset, so
// the helper falls back through env var to auto-detection.
if(!exit_app && cli_parser.WasOptionFound("drag-repair"))
{
const std::string v = cli_parser.GetOptionValue("drag-repair");
if(v == "on" || v == "1" || v == "true" || v == "yes")
{
RocProfVis::Platform::set_drag_repair_override(true);
}
else if(v == "off" || v == "0" || v == "false" || v == "no")
{
RocProfVis::Platform::set_drag_repair_override(false);
}
// else: "auto" or anything else -> do nothing, defer to env /
// auto-detect tiers in should_apply_drag_repair().
}
#endif

if(exit_app)
{
std::cout.flush();
Expand All @@ -231,15 +272,8 @@ main(int argc, char** argv)
{
int app_result_code = 0;

RocProfVis::View::CLIParser::AttachToConsole();
RocProfVis::View::CLIParser cli_parser;
bool exit_app = false;
parse_command_line_args(argc, argv, cli_parser, exit_app);
if(exit_app)
{
return app_result_code;
}

// Enable logging before parsing arguments so diagnostics emitted while
// handling CLI options (e.g. the drag-repair override) reach the log file.
std::string log_dir = rocprofvis_get_application_log_path();
#ifndef NDEBUG
std::filesystem::path log_path =
Expand All @@ -251,6 +285,15 @@ main(int argc, char** argv)
rocprofvis_core_enable_log(log_path.string().c_str(), spdlog::level::info);
#endif

RocProfVis::View::CLIParser::AttachToConsole();
RocProfVis::View::CLIParser cli_parser;
bool exit_app = false;
parse_command_line_args(argc, argv, cli_parser, exit_app);
if(exit_app)
{
return app_result_code;
}

// Parse backend preference from command line
rocprofvis_imgui_backend_preference_t backend_pref = kRPVBackendAuto;
if(cli_parser.WasOptionFound("backend"))
Expand Down Expand Up @@ -348,6 +391,14 @@ main(int argc, char** argv)
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
// Multi-viewport lets panels be dragged out into their own OS
// window. Docking is intentionally left disabled.
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
// ConfigDpiScaleViewports is deliberately left off. It rescales a
// window every time its viewport reports a new DPI, which upstream
// documents as a resizing feedback loop for a window straddling a
// DPI boundary, and the runaway size then persists to imgui.ini.
// Fonts still scale per monitor through ConfigDpiScaleFonts.
io.ConfigDpiScaleFonts = true;
io.ConfigWindowsMoveFromTitleBarOnly = true;

Expand Down Expand Up @@ -384,6 +435,7 @@ main(int argc, char** argv)
icon.GetPixels() };
glfwSetWindowIcon(window, 1, &glfw_icon);
}
// EmbeddedImage already logs a decode failure, so no warning here.

while(!glfwWindowShouldClose(window))
{
Expand Down Expand Up @@ -436,6 +488,22 @@ main(int argc, char** argv)
backend.m_new_frame(&backend);
ImGui::NewFrame();

#ifdef __linux__
// Hook A: snap secondary viewport Pos to the actual
// OS window position before user code runs, so
// hit-testing and rendering agree with reality when
// the window manager clamps our requested drag pos.
// Call raise_dragged_viewport_after_release(), this is a fix
// for the post-drag click-fall-through bug under
// Xwayland/Mutter.
if(io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
{
RocProfVis::Platform::snap_secondary_viewports_to_os_pos(
g_viewport_intended_pos);
RocProfVis::Platform::raise_dragged_viewport_after_release();
}
#endif

rocprofvis_view_render(g_render_options);
g_render_options = rocprofvis_view_render_options_t::
kRocProfVisViewRenderOption_None;
Expand All @@ -447,6 +515,27 @@ main(int argc, char** argv)
if(!is_minimized)
{
backend.m_render(&backend, draw_data, &clear_color);
}

// Render windows that have been dragged out of the main viewport.
if(io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
{
GLFWwindow* backup_current_context = glfwGetCurrentContext();
#ifdef __linux__
// Hook B: restore the drag-target Pos we
// temporarily replaced with the OS pos in Hook A
// so UpdatePlatformWindows() still transmits the
// requested move.
RocProfVis::Platform::restore_secondary_viewport_intended_pos(
g_viewport_intended_pos);
#endif
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
glfwMakeContextCurrent(backup_current_context);
}

if(!is_minimized)
{
backend.m_present(&backend);
}

Expand Down
21 changes: 16 additions & 5 deletions src/app/src/rocprofvis_imgui_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ typedef struct rocprofvis_imgui_vk_data_t
} rocprofvis_imgui_vk_data_t;

static constexpr uint32_t kRPVGuiTextureDescriptorPoolSize = 1024;
// ImGui 1.92.7+ allocates user textures as VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE and reserves
// IMGUI_IMPL_VULKAN_MINIMUM_SAMPLED_IMAGE_POOL_SIZE of them for its own font atlas, so
// subtract that reserve to get the app's usable texture budget.
static constexpr uint32_t kRPVMaxGuiTextures =
kRPVGuiTextureDescriptorPoolSize - IMGUI_IMPL_VULKAN_MINIMUM_IMAGE_SAMPLER_POOL_SIZE;
kRPVGuiTextureDescriptorPoolSize - IMGUI_IMPL_VULKAN_MINIMUM_SAMPLED_IMAGE_POOL_SIZE;

static void
rocprofvis_imgui_backend_vk_check_result(VkResult err)
Expand Down Expand Up @@ -384,19 +387,27 @@ rocprofvis_imgui_backend_vk_setup_vulkan(rocprofvis_imgui_vk_data_t* backend_dat
&backend_data->m_queue);

// Create Descriptor Pool
// ImGui 1.92+'s dynamic texture system creates many more
// textures, so we need a larger descriptor pool.
// ImGui 1.92.7+ allocates user textures as separate
// SAMPLED_IMAGE + SAMPLER descriptors (previously a single
// COMBINED_IMAGE_SAMPLER), so the pool must supply both
// types or ImGui_ImplVulkan_AddTexture() fails at runtime
// with VK_ERROR_OUT_OF_POOL_MEMORY. This mirrors the layout
// the backend builds for its own auto-created pool.
{
VkDescriptorPoolSize pool_sizes[] = {
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
{ VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
kRPVGuiTextureDescriptorPoolSize },
{ VK_DESCRIPTOR_TYPE_SAMPLER,
IMGUI_IMPL_VULKAN_MINIMUM_SAMPLER_POOL_SIZE },
};
VkDescriptorPoolCreateInfo pool_info = {};
pool_info.sType =
VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
pool_info.flags =
VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
pool_info.maxSets = kRPVGuiTextureDescriptorPoolSize;
pool_info.maxSets =
kRPVGuiTextureDescriptorPoolSize +
IMGUI_IMPL_VULKAN_MINIMUM_SAMPLER_POOL_SIZE;
pool_info.poolSizeCount =
(uint32_t) IM_ARRAYSIZE(pool_sizes);
pool_info.pPoolSizes = pool_sizes;
Expand Down
Loading
Loading