It works!
This commit is contained in:
1
external/imgui/CMakeLists.txt
vendored
1
external/imgui/CMakeLists.txt
vendored
@@ -7,3 +7,4 @@ list(APPEND SOURCES backends/imgui_impl_sdl3.cpp backends/imgui_impl_vulkan.cpp)
|
|||||||
|
|
||||||
add_library(imgui ${SOURCES} ${HEADERS})
|
add_library(imgui ${SOURCES} ${HEADERS})
|
||||||
target_include_directories(imgui PRIVATE . backends ../SDL/include)
|
target_include_directories(imgui PRIVATE . backends ../SDL/include)
|
||||||
|
target_compile_definitions(imgui PRIVATE IMGUI_IMPL_VULKAN_USE_VOLK)
|
||||||
4
external/imgui/backends/imgui_impl_sdl3.cpp
vendored
4
external/imgui/backends/imgui_impl_sdl3.cpp
vendored
@@ -626,7 +626,7 @@ static void ImGui_ImplSDL3_UpdateMouseData()
|
|||||||
// We forward mouse input when hovered or captured (via SDL_EVENT_MOUSE_MOTION) or when focused (below)
|
// We forward mouse input when hovered or captured (via SDL_EVENT_MOUSE_MOTION) or when focused (below)
|
||||||
#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE
|
#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE
|
||||||
// SDL_CaptureMouse() let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't e.g. trigger other operations outside
|
// SDL_CaptureMouse() let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't e.g. trigger other operations outside
|
||||||
SDL_CaptureMouse((bd->MouseButtonsDown != 0) ? SDL_TRUE : SDL_FALSE);
|
SDL_CaptureMouse(bd->MouseButtonsDown != 0);
|
||||||
SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
||||||
const bool is_app_focused = (focused_window && (bd->Window == focused_window || ImGui_ImplSDL3_GetViewportForWindowID(SDL_GetWindowID(focused_window)) != NULL));
|
const bool is_app_focused = (focused_window && (bd->Window == focused_window || ImGui_ImplSDL3_GetViewportForWindowID(SDL_GetWindowID(focused_window)) != NULL));
|
||||||
#else
|
#else
|
||||||
@@ -1101,7 +1101,7 @@ static int ImGui_ImplSDL3_CreateVkSurface(ImGuiViewport* viewport, ImU64 vk_inst
|
|||||||
{
|
{
|
||||||
ImGui_ImplSDL3_ViewportData* vd = (ImGui_ImplSDL3_ViewportData*)viewport->PlatformUserData;
|
ImGui_ImplSDL3_ViewportData* vd = (ImGui_ImplSDL3_ViewportData*)viewport->PlatformUserData;
|
||||||
(void)vk_allocator;
|
(void)vk_allocator;
|
||||||
SDL_bool ret = SDL_Vulkan_CreateSurface(vd->Window, (VkInstance)vk_instance, (VkAllocationCallbacks*)vk_allocator, (VkSurfaceKHR*)out_vk_surface);
|
bool ret = SDL_Vulkan_CreateSurface(vd->Window, (VkInstance)vk_instance, (VkAllocationCallbacks*)vk_allocator, (VkSurfaceKHR*)out_vk_surface);
|
||||||
return ret ? 0 : 1; // ret ? VK_SUCCESS : VK_NOT_READY
|
return ret ? 0 : 1; // ret ? VK_SUCCESS : VK_NOT_READY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
external/parallel-rdp/ParallelRDPWrapper.cpp
vendored
36
external/parallel-rdp/ParallelRDPWrapper.cpp
vendored
@@ -56,6 +56,11 @@ void ParallelRDP::LoadWSIPlatform(const std::shared_ptr<InstanceFactory> &instan
|
|||||||
#endif
|
#endif
|
||||||
SDLWindow = SDL_CreateWindowWithProperties(props);
|
SDLWindow = SDL_CreateWindowWithProperties(props);
|
||||||
|
|
||||||
|
auto instance = wsi->get_context().get_instance();
|
||||||
|
|
||||||
|
volkInitialize();
|
||||||
|
volkLoadInstance(instance);
|
||||||
|
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO &io = ImGui::GetIO();
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
@@ -64,10 +69,17 @@ void ParallelRDP::LoadWSIPlatform(const std::shared_ptr<InstanceFactory> &instan
|
|||||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||||
|
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
|
|
||||||
|
ImGui_ImplVulkan_LoadFunctions(
|
||||||
|
[](const char *function_name, void *instance) {
|
||||||
|
return vkGetInstanceProcAddr(static_cast<VkInstance>(instance), function_name);
|
||||||
|
},
|
||||||
|
instance);
|
||||||
|
|
||||||
ImGui_ImplSDL3_InitForVulkan(SDLWindow);
|
ImGui_ImplSDL3_InitForVulkan(SDLWindow);
|
||||||
|
|
||||||
ImGui_ImplVulkan_InitInfo init_info = {};
|
ImGui_ImplVulkan_InitInfo init_info = {};
|
||||||
init_info.Instance = wsi->get_context().get_instance();
|
init_info.Instance = instance;
|
||||||
init_info.PhysicalDevice = wsi->get_device().get_physical_device();
|
init_info.PhysicalDevice = wsi->get_device().get_physical_device();
|
||||||
init_info.Device = wsi->get_device().get_device();
|
init_info.Device = wsi->get_device().get_device();
|
||||||
init_info.QueueFamily = wsi->get_context().get_queue_info().family_indices[QUEUE_INDEX_GRAPHICS];
|
init_info.QueueFamily = wsi->get_context().get_queue_info().family_indices[QUEUE_INDEX_GRAPHICS];
|
||||||
@@ -101,8 +113,7 @@ void ParallelRDP::LoadWSIPlatform(const std::shared_ptr<InstanceFactory> &instan
|
|||||||
ImGui_ImplVulkan_Init(&init_info);
|
ImGui_ImplVulkan_Init(&init_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParallelRDP::Init(const std::shared_ptr<Vulkan::InstanceFactory> &factory,
|
void ParallelRDP::Init(const std::shared_ptr<InstanceFactory> &factory, const std::shared_ptr<WSIPlatform> &wsiPlatform,
|
||||||
const std::shared_ptr<Vulkan::WSIPlatform> &wsiPlatform,
|
|
||||||
const std::shared_ptr<WindowInfo> &newWindowInfo, const u8 *rdram, void *winPtr) {
|
const std::shared_ptr<WindowInfo> &newWindowInfo, const u8 *rdram, void *winPtr) {
|
||||||
LoadWSIPlatform(factory, wsiPlatform, newWindowInfo, winPtr);
|
LoadWSIPlatform(factory, wsiPlatform, newWindowInfo, winPtr);
|
||||||
|
|
||||||
@@ -151,7 +162,7 @@ void ParallelRDP::Init(const std::shared_ptr<Vulkan::InstanceFactory> &factory,
|
|||||||
|
|
||||||
void ParallelRDP::DrawFullscreenTexturedQuad(Util::IntrusivePtr<Image> image,
|
void ParallelRDP::DrawFullscreenTexturedQuad(Util::IntrusivePtr<Image> image,
|
||||||
Util::IntrusivePtr<CommandBuffer> cmd) const {
|
Util::IntrusivePtr<CommandBuffer> cmd) const {
|
||||||
cmd->set_texture(0, 0, image->get_view(), Vulkan::StockSampler::LinearClamp);
|
cmd->set_texture(0, 0, image->get_view(), StockSampler::LinearClamp);
|
||||||
cmd->set_program(fullscreen_quad_program);
|
cmd->set_program(fullscreen_quad_program);
|
||||||
cmd->set_quad_state();
|
cmd->set_quad_state();
|
||||||
auto data = static_cast<float *>(cmd->allocate_vertex_data(0, 6 * sizeof(float), 2 * sizeof(float)));
|
auto data = static_cast<float *>(cmd->allocate_vertex_data(0, 6 * sizeof(float), 2 * sizeof(float)));
|
||||||
@@ -188,7 +199,7 @@ void ParallelRDP::UpdateScreen(Util::IntrusivePtr<Image> image) const {
|
|||||||
wsi->begin_frame();
|
wsi->begin_frame();
|
||||||
|
|
||||||
if (!image) {
|
if (!image) {
|
||||||
auto info = Vulkan::ImageCreateInfo::immutable_2d_image(800, 600, VK_FORMAT_R8G8B8A8_UNORM);
|
auto info = ImageCreateInfo::immutable_2d_image(800, 600, VK_FORMAT_R8G8B8A8_UNORM);
|
||||||
info.usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
info.usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||||
info.misc = IMAGE_MISC_MUTABLE_SRGB_BIT;
|
info.misc = IMAGE_MISC_MUTABLE_SRGB_BIT;
|
||||||
info.initial_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
info.initial_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
@@ -210,9 +221,24 @@ void ParallelRDP::UpdateScreen(Util::IntrusivePtr<Image> image) const {
|
|||||||
|
|
||||||
cmd->begin_render_pass(wsi->get_device().get_swapchain_render_pass(SwapchainRenderPass::ColorOnly));
|
cmd->begin_render_pass(wsi->get_device().get_swapchain_render_pass(SwapchainRenderPass::ColorOnly));
|
||||||
DrawFullscreenTexturedQuad(image, cmd);
|
DrawFullscreenTexturedQuad(image, cmd);
|
||||||
|
|
||||||
|
SDL_Event event;
|
||||||
|
while (SDL_PollEvent(&event)) {
|
||||||
|
ImGui_ImplSDL3_ProcessEvent(&event);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui_ImplVulkan_NewFrame();
|
||||||
|
ImGui_ImplSDL3_NewFrame();
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
ImGui::ShowDemoWindow();
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), cmd->get_command_buffer());
|
ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), cmd->get_command_buffer());
|
||||||
|
|
||||||
|
ImGui::UpdatePlatformWindows();
|
||||||
|
ImGui::RenderPlatformWindowsDefault();
|
||||||
|
|
||||||
cmd->end_render_pass();
|
cmd->end_render_pass();
|
||||||
wsi->get_device().submit(cmd);
|
wsi->get_device().submit(cmd);
|
||||||
wsi->end_frame();
|
wsi->end_frame();
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ if (${CMAKE_BUILD_TYPE} MATCHES Debug)
|
|||||||
#target_link_options(kaizen-qt PUBLIC -fsanitize=address -fsanitize=undefined)
|
#target_link_options(kaizen-qt PUBLIC -fsanitize=address -fsanitize=undefined)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(kaizen-qt PUBLIC SDL3::SDL3 SDL3::SDL3-static Qt6::Core Qt6::Gui Qt6::Widgets discord-rpc fmt mio nlohmann_json imgui parallel-rdp backend)
|
target_link_libraries(kaizen-qt PUBLIC SDL3::SDL3 SDL3::SDL3-static Qt6::Core Qt6::Gui Qt6::Widgets discord-rpc fmt mio nlohmann_json parallel-rdp imgui backend)
|
||||||
target_compile_definitions(kaizen-qt PUBLIC SDL_MAIN_HANDLED)
|
target_compile_definitions(kaizen-qt PUBLIC SDL_MAIN_HANDLED)
|
||||||
|
|
||||||
file(COPY ../../resources/ DESTINATION ${PROJECT_BINARY_DIR}/resources/)
|
file(COPY ../../resources/ DESTINATION ${PROJECT_BINARY_DIR}/resources/)
|
||||||
|
|||||||
Reference in New Issue
Block a user