mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 20:26:53 +00:00
LibGfx: Save graphics queue family index in VulkanContext
This will be needed for image allocation, and anyway I think we're supposed to be passing this to Skia during context creation.
This commit is contained in:
parent
dc3cb2122d
commit
1a6a114667
Notes:
github-actions[bot]
2025-08-18 22:32:19 +00:00
Author: https://github.com/erik-kz
Commit: 1a6a114667
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5864
Reviewed-by: https://github.com/kalenikaliaksandr ✅
3 changed files with 9 additions and 3 deletions
|
@ -66,6 +66,7 @@ RefPtr<SkiaBackendContext> SkiaBackendContext::create_vulkan_context(Gfx::Vulkan
|
|||
backend_context.fInstance = vulkan_context.instance;
|
||||
backend_context.fDevice = vulkan_context.logical_device;
|
||||
backend_context.fQueue = vulkan_context.graphics_queue;
|
||||
backend_context.fGraphicsQueueIndex = vulkan_context.graphics_queue_family;
|
||||
backend_context.fPhysicalDevice = vulkan_context.physical_device;
|
||||
backend_context.fMaxAPIVersion = vulkan_context.api_version;
|
||||
backend_context.fGetProc = [](char const* proc_name, VkInstance instance, VkDevice device) {
|
||||
|
|
|
@ -65,7 +65,7 @@ static ErrorOr<VkPhysicalDevice> pick_physical_device(VkInstance instance)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static ErrorOr<VkDevice> create_logical_device(VkPhysicalDevice physical_device)
|
||||
static ErrorOr<VkDevice> create_logical_device(VkPhysicalDevice physical_device, uint32_t* graphics_queue_family)
|
||||
{
|
||||
VkDevice device;
|
||||
|
||||
|
@ -88,6 +88,8 @@ static ErrorOr<VkDevice> create_logical_device(VkPhysicalDevice physical_device)
|
|||
return Error::from_string_literal("Graphics queue family not found");
|
||||
}
|
||||
|
||||
*graphics_queue_family = graphics_queue_family_index;
|
||||
|
||||
VkDeviceQueueCreateInfo queue_create_info {};
|
||||
queue_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
queue_create_info.queueFamilyIndex = graphics_queue_family_index;
|
||||
|
@ -116,10 +118,11 @@ ErrorOr<VulkanContext> create_vulkan_context()
|
|||
uint32_t const api_version = VK_API_VERSION_1_0;
|
||||
auto* instance = TRY(create_instance(api_version));
|
||||
auto* physical_device = TRY(pick_physical_device(instance));
|
||||
auto* logical_device = TRY(create_logical_device(physical_device));
|
||||
|
||||
uint32_t graphics_queue_family = 0;
|
||||
auto* logical_device = TRY(create_logical_device(physical_device, &graphics_queue_family));
|
||||
VkQueue graphics_queue;
|
||||
vkGetDeviceQueue(logical_device, 0, 0, &graphics_queue);
|
||||
vkGetDeviceQueue(logical_device, graphics_queue_family, 0, &graphics_queue);
|
||||
|
||||
return VulkanContext {
|
||||
.api_version = api_version,
|
||||
|
@ -127,6 +130,7 @@ ErrorOr<VulkanContext> create_vulkan_context()
|
|||
.physical_device = physical_device,
|
||||
.logical_device = logical_device,
|
||||
.graphics_queue = graphics_queue,
|
||||
.graphics_queue_family = graphics_queue_family,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ struct VulkanContext {
|
|||
VkPhysicalDevice physical_device { VK_NULL_HANDLE };
|
||||
VkDevice logical_device { VK_NULL_HANDLE };
|
||||
VkQueue graphics_queue { VK_NULL_HANDLE };
|
||||
uint32_t graphics_queue_family { 0 };
|
||||
};
|
||||
|
||||
ErrorOr<VulkanContext> create_vulkan_context();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue