@@ -36,6 +36,7 @@ struct d3d11_opts {
36
36
int output_format ;
37
37
int color_space ;
38
38
bool exclusive_fs ;
39
+ int output_mode ;
39
40
};
40
41
41
42
#define OPT_BASE_STRUCT struct d3d11_opts
@@ -82,6 +83,12 @@ const struct m_sub_options d3d11_conf = {
82
83
.flags = UPDATE_VO ,
83
84
},
84
85
{"d3d11-exclusive-fs" , OPT_BOOL (exclusive_fs )},
86
+ {"d3d11-output-mode" , OPT_CHOICE (output_mode ,
87
+ {"auto" , -1 },
88
+ {"window" , 0 },
89
+ {"composition" , 1 }),
90
+ .flags = UPDATE_VO ,
91
+ },
85
92
{0 }
86
93
},
87
94
.defaults = & (const struct d3d11_opts ) {
@@ -92,6 +99,7 @@ const struct m_sub_options d3d11_conf = {
92
99
.adapter_name = NULL ,
93
100
.output_format = DXGI_FORMAT_UNKNOWN ,
94
101
.color_space = -1 ,
102
+ .output_mode = -1 ,
95
103
},
96
104
.size = sizeof (struct d3d11_opts )
97
105
};
@@ -157,7 +165,8 @@ static bool resize(struct ra_ctx *ctx)
157
165
158
166
static bool d3d11_reconfig (struct ra_ctx * ctx )
159
167
{
160
- vo_w32_config (ctx -> vo );
168
+ if (!ctx -> opts .composition )
169
+ vo_w32_config (ctx -> vo );
161
170
return resize (ctx );
162
171
}
163
172
@@ -454,7 +463,7 @@ static int d3d11_control(struct ra_ctx *ctx, int *events, int request, void *arg
454
463
fullscreen_switch_needed = false;
455
464
}
456
465
457
- ret = vo_w32_control (ctx -> vo , events , request , arg );
466
+ ret = ctx -> opts . composition ? VO_TRUE : vo_w32_control (ctx -> vo , events , request , arg );
458
467
459
468
// if entering full screen, handle d3d11 after general windowing stuff
460
469
if (fullscreen_switch_needed && p -> vo_opts -> fullscreen ) {
@@ -481,7 +490,11 @@ static void d3d11_uninit(struct ra_ctx *ctx)
481
490
if (ctx -> ra )
482
491
ra_tex_free (ctx -> ra , & p -> backbuffer );
483
492
SAFE_RELEASE (p -> swapchain );
484
- vo_w32_uninit (ctx -> vo );
493
+ if (!ctx -> opts .composition ) {
494
+ vo_w32_uninit (ctx -> vo );
495
+ } else {
496
+ vo_w32_swapchain (ctx -> vo , NULL );
497
+ }
485
498
SAFE_RELEASE (p -> device );
486
499
487
500
// Destroy the RA last to prevent objects we hold from showing up in D3D's
@@ -534,10 +547,11 @@ static bool d3d11_init(struct ra_ctx *ctx)
534
547
if (!ctx -> ra )
535
548
goto error ;
536
549
537
- if (!vo_w32_init (ctx -> vo ))
550
+ ctx -> opts .composition = p -> opts -> output_mode == 1 ;
551
+ if (!ctx -> opts .composition && !vo_w32_init (ctx -> vo ))
538
552
goto error ;
539
553
540
- if (ctx -> opts .want_alpha )
554
+ if (! ctx -> opts . composition && ctx -> opts .want_alpha )
541
555
vo_w32_set_transparency (ctx -> vo , ctx -> opts .want_alpha );
542
556
543
557
UINT usage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT ;
@@ -548,7 +562,7 @@ static bool d3d11_init(struct ra_ctx *ctx)
548
562
}
549
563
550
564
struct d3d11_swapchain_opts scopts = {
551
- .window = vo_w32_hwnd (ctx -> vo ),
565
+ .window = ctx -> opts . composition ? NULL : vo_w32_hwnd (ctx -> vo ),
552
566
.width = ctx -> vo -> dwidth ,
553
567
.height = ctx -> vo -> dheight ,
554
568
.format = p -> opts -> output_format ,
@@ -563,6 +577,9 @@ static bool d3d11_init(struct ra_ctx *ctx)
563
577
if (!mp_d3d11_create_swapchain (p -> device , ctx -> log , & scopts , & p -> swapchain ))
564
578
goto error ;
565
579
580
+ if (ctx -> opts .composition ) {
581
+ vo_w32_swapchain (ctx -> vo , p -> swapchain );
582
+ }
566
583
return true;
567
584
568
585
error :
@@ -572,6 +589,9 @@ static bool d3d11_init(struct ra_ctx *ctx)
572
589
573
590
static void d3d11_update_render_opts (struct ra_ctx * ctx )
574
591
{
592
+ if (ctx -> opts .composition ) {
593
+ return ;
594
+ }
575
595
vo_w32_set_transparency (ctx -> vo , ctx -> opts .want_alpha );
576
596
}
577
597
0 commit comments