mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01: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
|
|
@ -66,6 +66,7 @@ RefPtr<SkiaBackendContext> SkiaBackendContext::create_vulkan_context(Gfx::Vulkan
|
||||||
backend_context.fInstance = vulkan_context.instance;
|
backend_context.fInstance = vulkan_context.instance;
|
||||||
backend_context.fDevice = vulkan_context.logical_device;
|
backend_context.fDevice = vulkan_context.logical_device;
|
||||||
backend_context.fQueue = vulkan_context.graphics_queue;
|
backend_context.fQueue = vulkan_context.graphics_queue;
|
||||||
|
backend_context.fGraphicsQueueIndex = vulkan_context.graphics_queue_family;
|
||||||
backend_context.fPhysicalDevice = vulkan_context.physical_device;
|
backend_context.fPhysicalDevice = vulkan_context.physical_device;
|
||||||
backend_context.fMaxAPIVersion = vulkan_context.api_version;
|
backend_context.fMaxAPIVersion = vulkan_context.api_version;
|
||||||
backend_context.fGetProc = [](char const* proc_name, VkInstance instance, VkDevice device) {
|
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();
|
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;
|
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");
|
return Error::from_string_literal("Graphics queue family not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*graphics_queue_family = graphics_queue_family_index;
|
||||||
|
|
||||||
VkDeviceQueueCreateInfo queue_create_info {};
|
VkDeviceQueueCreateInfo queue_create_info {};
|
||||||
queue_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
queue_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||||
queue_create_info.queueFamilyIndex = graphics_queue_family_index;
|
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;
|
uint32_t const api_version = VK_API_VERSION_1_0;
|
||||||
auto* instance = TRY(create_instance(api_version));
|
auto* instance = TRY(create_instance(api_version));
|
||||||
auto* physical_device = TRY(pick_physical_device(instance));
|
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;
|
VkQueue graphics_queue;
|
||||||
vkGetDeviceQueue(logical_device, 0, 0, &graphics_queue);
|
vkGetDeviceQueue(logical_device, graphics_queue_family, 0, &graphics_queue);
|
||||||
|
|
||||||
return VulkanContext {
|
return VulkanContext {
|
||||||
.api_version = api_version,
|
.api_version = api_version,
|
||||||
|
|
@ -127,6 +130,7 @@ ErrorOr<VulkanContext> create_vulkan_context()
|
||||||
.physical_device = physical_device,
|
.physical_device = physical_device,
|
||||||
.logical_device = logical_device,
|
.logical_device = logical_device,
|
||||||
.graphics_queue = graphics_queue,
|
.graphics_queue = graphics_queue,
|
||||||
|
.graphics_queue_family = graphics_queue_family,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ struct VulkanContext {
|
||||||
VkPhysicalDevice physical_device { VK_NULL_HANDLE };
|
VkPhysicalDevice physical_device { VK_NULL_HANDLE };
|
||||||
VkDevice logical_device { VK_NULL_HANDLE };
|
VkDevice logical_device { VK_NULL_HANDLE };
|
||||||
VkQueue graphics_queue { VK_NULL_HANDLE };
|
VkQueue graphics_queue { VK_NULL_HANDLE };
|
||||||
|
uint32_t graphics_queue_family { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
ErrorOr<VulkanContext> create_vulkan_context();
|
ErrorOr<VulkanContext> create_vulkan_context();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user