@@ -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,9 @@ 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 );
170
+ }
161
171
return resize (ctx );
162
172
}
163
173
@@ -454,7 +464,7 @@ static int d3d11_control(struct ra_ctx *ctx, int *events, int request, void *arg
454
464
fullscreen_switch_needed = false;
455
465
}
456
466
457
- ret = vo_w32_control (ctx -> vo , events , request , arg );
467
+ ret = ctx -> opts . composition ? VO_TRUE : vo_w32_control (ctx -> vo , events , request , arg );
458
468
459
469
// if entering full screen, handle d3d11 after general windowing stuff
460
470
if (fullscreen_switch_needed && p -> vo_opts -> fullscreen ) {
@@ -481,7 +491,11 @@ static void d3d11_uninit(struct ra_ctx *ctx)
481
491
if (ctx -> ra )
482
492
ra_tex_free (ctx -> ra , & p -> backbuffer );
483
493
SAFE_RELEASE (p -> swapchain );
484
- vo_w32_uninit (ctx -> vo );
494
+ if (!ctx -> opts .composition ) {
495
+ vo_w32_uninit (ctx -> vo );
496
+ } else {
497
+ vo_w32_swapchain (ctx -> vo , NULL );
498
+ }
485
499
SAFE_RELEASE (p -> device );
486
500
487
501
// Destroy the RA last to prevent objects we hold from showing up in D3D's
@@ -534,10 +548,11 @@ static bool d3d11_init(struct ra_ctx *ctx)
534
548
if (!ctx -> ra )
535
549
goto error ;
536
550
537
- if (!vo_w32_init (ctx -> vo ))
551
+ ctx -> opts .composition = p -> opts -> output_mode == 1 ;
552
+ if (!ctx -> opts .composition && !vo_w32_init (ctx -> vo ))
538
553
goto error ;
539
554
540
- if (ctx -> opts .want_alpha )
555
+ if (! ctx -> opts . composition && ctx -> opts .want_alpha )
541
556
vo_w32_set_transparency (ctx -> vo , ctx -> opts .want_alpha );
542
557
543
558
UINT usage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT ;
@@ -548,7 +563,7 @@ static bool d3d11_init(struct ra_ctx *ctx)
548
563
}
549
564
550
565
struct d3d11_swapchain_opts scopts = {
551
- .window = vo_w32_hwnd (ctx -> vo ),
566
+ .window = ctx -> opts . composition ? NULL : vo_w32_hwnd (ctx -> vo ),
552
567
.width = ctx -> vo -> dwidth ,
553
568
.height = ctx -> vo -> dheight ,
554
569
.format = p -> opts -> output_format ,
@@ -563,6 +578,9 @@ static bool d3d11_init(struct ra_ctx *ctx)
563
578
if (!mp_d3d11_create_swapchain (p -> device , ctx -> log , & scopts , & p -> swapchain ))
564
579
goto error ;
565
580
581
+ if (ctx -> opts .composition ) {
582
+ vo_w32_swapchain (ctx -> vo , p -> swapchain );
583
+ }
566
584
return true;
567
585
568
586
error :
0 commit comments