Fix libplacebo renderer build on Windows

This commit is contained in:
Cameron Gutman 2023-12-21 18:12:19 -06:00
parent 770872238d
commit 2d15382e31
3 changed files with 18 additions and 3 deletions

View file

@ -31,7 +31,7 @@ static const char *k_OptionalDeviceExtensions[] = {
VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME,
VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME,
VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME,
#ifdef _WIN32
#ifdef Q_OS_WIN32
VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME,
VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME,
#endif
@ -350,7 +350,7 @@ bool PlVkRenderer::initialize(PDECODER_PARAMETERS params)
}
vkInstParams.get_proc_addr = (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr();
vkInstParams.extensions = instanceExtensions.data();
vkInstParams.num_extensions = instanceExtensions.size();
vkInstParams.num_extensions = (int)instanceExtensions.size();
m_PlVkInstance = pl_vk_inst_create(m_Log, &vkInstParams);
if (m_PlVkInstance == nullptr) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
@ -735,7 +735,7 @@ void PlVkRenderer::renderFrame(AVFrame *frame)
targetFrame.crop.y1 = dst.y + dst.h;
// Render the video image and overlays into the swapchain buffer
targetFrame.num_overlays = overlays.size();
targetFrame.num_overlays = (int)overlays.size();
targetFrame.overlays = overlays.data();
if (!pl_render_image(m_Renderer, &mappedFrame, &targetFrame, &pl_render_fast_params)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,

View file

@ -2,6 +2,10 @@
#include "renderer.h"
#ifdef Q_OS_WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#endif
#include <libplacebo/log.h>
#include <libplacebo/renderer.h>
#include <libplacebo/vulkan.h>

View file

@ -1,9 +1,20 @@
// This compilation unit contains the implementations of libplacebo header-only libraries.
// These must be compiled as C code, so they cannot be placed inside plvk.cpp.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4068) // unknown pragma
#pragma warning(disable: 4244) // double -> float truncation warning
#pragma warning(disable: 4267) // size_t -> int truncation warning
#endif
#define PL_LIBAV_IMPLEMENTATION 1
#include <libplacebo/utils/libav.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
// Provide a dummy implementation of av_stream_get_side_data() to avoid having to link with libavformat
uint8_t *av_stream_get_side_data(const AVStream *stream, enum AVPacketSideDataType type, size_t *size)
{