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
511static void angle_swap_buffers(struct ra_ctx *ctx)511static void angle_swap_buffers(struct ra_ctx *ctx)
512{512{
513 struct priv *p = ctx->priv;513 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);
515 d3d11_swap_buffers(ctx);519 d3d11_swap_buffers(ctx);
516 else520 } else {
517 egl_swap_buffers(ctx);521 egl_swap_buffers(ctx);
522 }
518}523}
519 524
520 525
521static int angle_color_depth(struct ra_swapchain *sw)526static int angle_color_depth(struct ra_ctx *ctx)
522{527{
523 // Only 8-bit output is supported at the moment528 // Only 8-bit output is supported at the moment
524 return 8;529 return 8;
525}530}
526 531
527static 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
541static bool angle_init(struct ra_ctx *ctx)532static bool angle_init(struct ra_ctx *ctx)
542{533{
543 struct priv *p = ctx->priv = talloc_zero(ctx, struct priv);534 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
596 current_ctx = ctx;587 current_ctx = ctx;
597 gl->SwapInterval = angle_swap_interval;588 gl->SwapInterval = angle_swap_interval;
598 589
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 };
604 struct ra_ctx_params params = {590 struct ra_ctx_params params = {
591 .color_depth = p->dxgi_swapchain ? angle_color_depth : NULL,
605 .swap_buffers = angle_swap_buffers,592 .swap_buffers = angle_swap_buffers,
606 .external_swapchain = p->dxgi_swapchain ? &dxgi_swapchain_fns : NULL,
607 };593 };
608 594
609 gl->flipped = p->flipped;595 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