vo_gpu_next: fix -Wembedded-directive warning

warning: embedding a directive within macro arguments has undefined behavior
This commit is contained in:
nanahi 2024-03-08 02:34:23 -05:00 committed by Kacper Michajłow
parent 59f23f5c29
commit a6f8d1d961
2 changed files with 21 additions and 20 deletions

View File

@ -143,18 +143,17 @@ struct gpu_ctx *gpu_ctx_create(struct vo *vo, struct ra_ctx_opts *ctx_opts)
#if HAVE_GL && defined(PL_HAVE_OPENGL)
if (ra_is_gl(ctx->ra_ctx->ra)) {
struct GL *gl = ra_gl_get(ctx->ra_ctx->ra);
pl_opengl opengl = pl_opengl_create(ctx->pllog,
pl_opengl_params(
.debug = ctx_opts->debug,
.allow_software = ctx_opts->allow_sw,
.get_proc_addr_ex = (void *) gl->get_fn,
.proc_ctx = gl->fn_ctx,
# if HAVE_EGL
.egl_display = eglGetCurrentDisplay(),
.egl_context = eglGetCurrentContext(),
# endif
)
struct pl_opengl_params params = *pl_opengl_params(
.debug = ctx_opts->debug,
.allow_software = ctx_opts->allow_sw,
.get_proc_addr_ex = (void *) gl->get_fn,
.proc_ctx = gl->fn_ctx,
);
# if HAVE_EGL
params.egl_display = eglGetCurrentDisplay();
params.egl_context = eglGetCurrentContext();
# endif
pl_opengl opengl = pl_opengl_create(ctx->pllog, &params);
if (!opengl)
goto err_out;
ctx->gpu = opengl->gpu;

View File

@ -1002,14 +1002,15 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
if (!should_draw || !pl_swapchain_start_frame(p->sw, &swframe)) {
if (frame->current) {
// Advance the queue state to the current PTS to discard unused frames
pl_queue_update(p->queue, NULL, pl_queue_params(
struct pl_queue_params qparams = *pl_queue_params(
.pts = frame->current->pts + pts_offset,
.radius = pl_frame_mix_radius(&params),
.vsync_duration = can_interpolate ? frame->ideal_frame_vsync_duration : 0,
);
#if PL_API_VER >= 340
.drift_compensation = 0,
qparams.drift_compensation = 0;
#endif
));
pl_queue_update(p->queue, NULL, &qparams);
}
return;
}
@ -1035,10 +1036,10 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
.radius = pl_frame_mix_radius(&params),
.vsync_duration = can_interpolate ? frame->ideal_frame_vsync_duration : 0,
.interpolation_threshold = opts->interpolation_threshold,
#if PL_API_VER >= 340
.drift_compensation = 0,
#endif
);
#if PL_API_VER >= 340
qparams.drift_compensation = 0;
#endif
// Depending on the vsync ratio, we may be up to half of the vsync
// duration before the current frame time. This works fine because
@ -1295,12 +1296,13 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args)
// Retrieve the current frame from the frame queue
struct pl_frame_mix mix;
enum pl_queue_status status;
status = pl_queue_update(p->queue, &mix, pl_queue_params(
struct pl_queue_params qparams = *pl_queue_params(
.pts = p->last_pts,
);
#if PL_API_VER >= 340
.drift_compensation = 0,
qparams.drift_compensation = 0;
#endif
));
status = pl_queue_update(p->queue, &mix, &qparams);
assert(status != PL_QUEUE_EOF);
if (status == PL_QUEUE_ERR) {
MP_ERR(vo, "Unknown error occurred while trying to take screenshot!\n");