History

context_angle: simplify some swapchain stuff

The external swapchain API is weird and not really needed here.

Dudemanguy committed 1 year ago

Commit 9b0336c1 parent 8ddc5631 file · +9 −23Browse files

Unified · Split

video/out/opengl/context_angle.c+9−23
@@ -511,33 +511,24 @@ static void egl_swap_buffers(struct ra_ctx *ctx) · 510 unmodified lines
511511 static void angle_swap_buffers(struct ra_ctx *ctx)
512512 {
513513 struct priv *p = ctx->priv;
514− if (p->dxgi_swapchain)
514+ if (p->dxgi_swapchain) {
515+ // DXGI Present doesn't flush the immediate context, which can make
516+ // timers inaccurate, since the end queries might not be sent until the
517+ // next frame. Fix this by flushing the context now.
518+ ID3D11DeviceContext_Flush(p->d3d11_context);
515519 d3d11_swap_buffers(ctx);
516− else
520+ } else {
517521 egl_swap_buffers(ctx);
522+ }
518523 }
519524
520525
521−static int angle_color_depth(struct ra_swapchain *sw)
526+static int angle_color_depth(struct ra_ctx *ctx)
522527 {
523528 // Only 8-bit output is supported at the moment
524529 return 8;
525530 }
526531
527−static bool angle_submit_frame(struct ra_swapchain *sw,
528− const struct vo_frame *frame)
529−{
530− struct priv *p = sw->ctx->priv;
531− bool ret = ra_gl_ctx_submit_frame(sw, frame);
532− if (p->d3d11_context) {
533− // DXGI Present doesn't flush the immediate context, which can make
534− // timers inaccurate, since the end queries might not be sent until the
535− // next frame. Fix this by flushing the context now.
536− ID3D11DeviceContext_Flush(p->d3d11_context);
537− }
538− return ret;
539−}
540−
541532 static bool angle_init(struct ra_ctx *ctx)
542533 {
543534 struct priv *p = ctx->priv = talloc_zero(ctx, struct priv);
@@ -596,14 +587,9 @@ static bool angle_init(struct ra_ctx *ctx) · 52 unmodified lines
596587 current_ctx = ctx;
597588 gl->SwapInterval = angle_swap_interval;
598589
599− // Custom swapchain impl for the D3D11 swapchain-based surface
600− static const struct ra_swapchain_fns dxgi_swapchain_fns = {
601− .color_depth = angle_color_depth,
602− .submit_frame = angle_submit_frame,
603− };
604590 struct ra_ctx_params params = {
591+ .color_depth = p->dxgi_swapchain ? angle_color_depth : NULL,
605592 .swap_buffers = angle_swap_buffers,
606− .external_swapchain = p->dxgi_swapchain ? &dxgi_swapchain_fns : NULL,
607593 };
608594
609595 gl->flipped = p->flipped;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t