Files
Velix-MPV-Core/video/out/vulkan/utils.c
T
Niklas Haas c96cee2940 vo_gpu_next: vulkan: libplacebo: unify log prefix
The new status quo is simple: all messages coming from libplacebo are
marked "vo/gpu{-next}/libplacebo", regardless of the backend API (vulkan
vs opengl/d3d11).

Messages coming from mpv's internal vulkan code will continue to come
from "vo/gpu{-next}/vulkan", and messages coming from the vo module
itself will be marked "vo/gpu{-next}".

This is significantly better than the old status quo of vulkan messages
coming from "vo/gpu{-next}/vulkan/libplacebo" whereas opengl/d3d11
messages simply came from "vo/gpu{-next}", even when those messages
originated from libplacebo.

(It's worth noting that the the destructor for the log is redundant
because it's attached to the ctx which is freed on uninit anyway)
2022-10-09 21:47:35 +02:00

43 lines
984 B
C

#include "video/out/placebo/utils.h"
#include "utils.h"
bool mpvk_init(struct mpvk_ctx *vk, struct ra_ctx *ctx, const char *surface_ext)
{
vk->pllog = mppl_log_create(ctx, ctx->vo->log);
if (!vk->pllog)
goto error;
const char *exts[] = {
VK_KHR_SURFACE_EXTENSION_NAME,
surface_ext,
};
mppl_log_set_probing(vk->pllog, true);
vk->vkinst = pl_vk_inst_create(vk->pllog, &(struct pl_vk_inst_params) {
.debug = ctx->opts.debug,
.extensions = exts,
.num_extensions = MP_ARRAY_SIZE(exts),
});
mppl_log_set_probing(vk->pllog, false);
if (!vk->vkinst)
goto error;
return true;
error:
mpvk_uninit(vk);
return false;
}
void mpvk_uninit(struct mpvk_ctx *vk)
{
if (vk->surface) {
assert(vk->vkinst);
vkDestroySurfaceKHR(vk->vkinst->instance, vk->surface, NULL);
vk->surface = NULL;
}
pl_vk_inst_destroy(&vk->vkinst);
pl_log_destroy(&vk->pllog);
}