From fc7884a9edc3d8255ff2b6d8b798c6d7b96c64cb Mon Sep 17 00:00:00 2001 From: Andreev Gregory Date: Thu, 28 Aug 2025 14:40:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=A3=D0=A3=D0=9F=D0=A1=20X)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/l2/tests/r0/r0.c | 2 +- src/l2/tests/r3/r3.c | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/l2/tests/r0/r0.c b/src/l2/tests/r0/r0.c index c4f2132..97936af 100644 --- a/src/l2/tests/r0/r0.c +++ b/src/l2/tests/r0/r0.c @@ -828,7 +828,7 @@ int main() { VkQueue graphics_queue; vkGetDeviceQueue(device, queue_fam.for_graphics, 0, &graphics_queue); VkQueue presentation_queue; - vkGetDeviceQueue(device, queue_fam.for_graphics, 0, &presentation_queue); + vkGetDeviceQueue(device, queue_fam.for_presentation, 0, &presentation_queue); ResultMargaretChosenSwapchainDetailsOrSpanU8 swapchain_details_res = margaret_choose_swapchain_details(physical_device, surface); if (swapchain_details_res.variant != Result_Ok) diff --git a/src/l2/tests/r3/r3.c b/src/l2/tests/r3/r3.c index 155be77..b0e3c1f 100644 --- a/src/l2/tests/r3/r3.c +++ b/src/l2/tests/r3/r3.c @@ -131,6 +131,14 @@ typedef struct { struct xdg_surface *xdg_surface; struct xdg_toplevel *xdg_toplevel; /* vulkan objects */ + MargaretInstanceAndItsDebug vk_instance_and_debug; + VkPhysicalDevice physical_device; + MargaretChosenQueueFamilies queue_fam; + VkDevice device; + VkSurfaceKHR vk_surface; + VkQueue graphics_queue; + VkQueue presentation_queue; + MargaretSwapchainBundle swfb; /* inputs */ struct wl_pointer* pointer; struct wl_keyboard* keyboard; @@ -459,19 +467,20 @@ int main() { // abortf("wl_surface_frame\n"); // wl_callback_add_listener(state.wl_callback, &main_h_wl_surface_frame_listener, &state); - MargaretInstanceAndItsDebug vk_instance_and_debug = MargaretInstanceAndItsDebug_new(true); - VkInstance vk_instance = vk_instance_and_debug.instance; - VkSurfaceKHR vk_surface = margaret_create_surface(vk_instance, state.wl_display, state.wl_surface); - VkPhysicalDevice physical_device = margaret_select_one_physical_device(vk_instance, vk_surface, cstr("nvidia"), cstr("NOT SPECIFIED")); - ResultMargaretChosenQueueFamiliesOrSpanU8 queue_fam_res = margaret_choose_good_queue_families(physical_device, vk_surface); + state.vk_instance_and_debug = MargaretInstanceAndItsDebug_new(true); + VkInstance vk_instance = state.vk_instance_and_debug.instance; + state.vk_surface = margaret_create_surface(vk_instance, state.wl_display, state.wl_surface); + state.physical_device = margaret_select_one_physical_device(vk_instance, state.vk_surface, + cstr("nvidia"), cstr("NOT SPECIFIED")); + ResultMargaretChosenQueueFamiliesOrSpanU8 queue_fam_res = margaret_choose_good_queue_families( + state.physical_device, state.vk_surface); if (queue_fam_res.variant != Result_Ok) abortf("queue_fam_res.variant != Result_Ok"); - MargaretChosenQueueFamilies queue_fam = queue_fam_res.ok; - VkDevice device = margaret_create_logical_device(physical_device, queue_fam); - VkQueue graphics_queue; - vkGetDeviceQueue(device, queue_fam.for_graphics, 0, &graphics_queue); + state.queue_fam = queue_fam_res.ok; + state.device = margaret_create_logical_device(state.physical_device, state.queue_fam); + vkGetDeviceQueue(state.device, state.queue_fam.for_graphics, 0, &state.graphics_queue); VkQueue presentation_queue; - vkGetDeviceQueue(device, queue_fam.for_graphics, 0, &presentation_queue); + vkGetDeviceQueue(state.device, state.queue_fam.for_presentation, 0, &presentation_queue); ResultMargaretChosenSwapchainDetailsOrSpanU8 swapchain_details_res = margaret_choose_swapchain_details(physical_device, vk_surface); if (swapchain_details_res.variant != Result_Ok) abortf("swapchain_details_res.variant != Result_Ok");