mirror of
https://github.com/mpv-player/mpv
synced 2025-03-31 15:59:34 +00:00
Instead of being submitted immediately, commands are appended into an internal submission queue, and the actual submission is done once per frame (at the same time as queue cycling). Again, the benefits are not immediately obvious because nothing benefits from this yet, but it will make more sense for an upcoming vk_signal mechanism. This also cleans up the way the ra_vk submission interacts with the synchronization/callbacks from the ra_vk_ctx. Although currently, the way the dependency is signalled is a bit hacky: normally it would be associated with the ra_tex itself and waited on in the appropriate stage implicitly. But that code is just temporary, so I'm keeping it in there for a better commit order.
28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include "video/out/gpu/ra.h"
|
|
|
|
#include "common.h"
|
|
#include "utils.h"
|
|
|
|
struct ra *ra_create_vk(struct mpvk_ctx *vk, struct mp_log *log);
|
|
|
|
// Access to the VkDevice is needed for swapchain creation
|
|
VkDevice ra_vk_get_dev(struct ra *ra);
|
|
|
|
// Allocates a ra_tex that wraps a swapchain image. The contents of the image
|
|
// will be invalidated, and access to it will only be internally synchronized.
|
|
// So the calling could should not do anything else with the VkImage.
|
|
struct ra_tex *ra_vk_wrap_swapchain_img(struct ra *ra, VkImage vkimg,
|
|
VkSwapchainCreateInfoKHR info);
|
|
|
|
// This function finalizes rendering, transitions `tex` (which must be a
|
|
// wrapped swapchain image) into a format suitable for presentation, and returns
|
|
// the resulting command buffer (or NULL on error). The caller may add their
|
|
// own semaphores to this command buffer, and must submit it afterwards.
|
|
struct vk_cmd *ra_vk_submit(struct ra *ra, struct ra_tex *tex);
|
|
|
|
// May be called on a struct ra of any type. Returns NULL if the ra is not
|
|
// a vulkan ra.
|
|
struct mpvk_ctx *ra_vk_get(struct ra *ra);
|