various: allow changing GPU API options at runtime

Set UPDATE_VO to GPU API options that are only set on init.

To change multiple options without multiple reinits, use
set vo null; set opengl-foo 1; set opengl-bar 1; set vo gpu
This commit is contained in:
Guido Cella 2024-07-04 22:58:00 +02:00 committed by Dudemanguy
parent a5937ac7e3
commit bde7cac447
4 changed files with 23 additions and 9 deletions

View File

@ -44,7 +44,9 @@ const struct m_sub_options d3d11_conf = {
{"d3d11-warp", OPT_CHOICE(warp,
{"auto", -1},
{"no", 0},
{"yes", 1})},
{"yes", 1}),
.flags = UPDATE_VO,
},
{"d3d11-feature-level", OPT_CHOICE(feature_level,
{"12_1", D3D_FEATURE_LEVEL_12_1},
{"12_0", D3D_FEATURE_LEVEL_12_0},
@ -54,23 +56,31 @@ const struct m_sub_options d3d11_conf = {
{"10_0", D3D_FEATURE_LEVEL_10_0},
{"9_3", D3D_FEATURE_LEVEL_9_3},
{"9_2", D3D_FEATURE_LEVEL_9_2},
{"9_1", D3D_FEATURE_LEVEL_9_1})},
{"d3d11-flip", OPT_BOOL(flip)},
{"9_1", D3D_FEATURE_LEVEL_9_1}),
.flags = UPDATE_VO,
},
{"d3d11-flip", OPT_BOOL(flip), .flags = UPDATE_VO},
{"d3d11-sync-interval", OPT_INT(sync_interval), M_RANGE(0, 4)},
{"d3d11-adapter", OPT_STRING_VALIDATE(adapter_name,
mp_dxgi_validate_adapter)},
{"d3d11-adapter",
OPT_STRING_VALIDATE(adapter_name, mp_dxgi_validate_adapter),
.flags = UPDATE_VO,
},
{"d3d11-output-format", OPT_CHOICE(output_format,
{"auto", DXGI_FORMAT_UNKNOWN},
{"rgba8", DXGI_FORMAT_R8G8B8A8_UNORM},
{"bgra8", DXGI_FORMAT_B8G8R8A8_UNORM},
{"rgb10_a2", DXGI_FORMAT_R10G10B10A2_UNORM},
{"rgba16f", DXGI_FORMAT_R16G16B16A16_FLOAT})},
{"rgba16f", DXGI_FORMAT_R16G16B16A16_FLOAT}),
.flags = UPDATE_VO,
},
{"d3d11-output-csp", OPT_CHOICE(color_space,
{"auto", -1},
{"srgb", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709},
{"linear", DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709},
{"pq", DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020},
{"bt.2020", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020})},
{"bt.2020", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020}),
.flags = UPDATE_VO,
},
{"d3d11-exclusive-fs", OPT_BOOL(exclusive_fs)},
{0}
},

View File

@ -57,11 +57,13 @@ const struct m_sub_options opengl_conf = {
.opts = (const struct m_option[]) {
{"opengl-glfinish", OPT_BOOL(use_glfinish)},
{"opengl-waitvsync", OPT_BOOL(waitvsync)},
{"opengl-swapinterval", OPT_INT(swapinterval)},
{"opengl-swapinterval", OPT_INT(swapinterval), .flags = UPDATE_VO},
{"opengl-check-pattern-a", OPT_INT(vsync_pattern[0])},
{"opengl-check-pattern-b", OPT_INT(vsync_pattern[1])},
{"opengl-es", OPT_CHOICE(gles_mode,
{"auto", GLES_AUTO}, {"yes", GLES_YES}, {"no", GLES_NO})},
{"auto", GLES_AUTO}, {"yes", GLES_YES}, {"no", GLES_NO}),
.flags = UPDATE_VO,
},
{"opengl-early-flush", OPT_CHOICE(early_flush,
{"no", FLUSH_NO}, {"yes", FLUSH_YES}, {"auto", FLUSH_AUTO})},
{0},

View File

@ -128,6 +128,7 @@ const struct m_sub_options vulkan_conf = {
.async_transfer = true,
.async_compute = true,
},
.change_flags = UPDATE_VO,
};
struct priv {

View File

@ -279,6 +279,7 @@ const struct m_sub_options vulkan_display_conf = {
},
.size = sizeof(struct vulkan_display_opts),
.defaults = &(struct vulkan_display_opts) {0},
.change_flags = UPDATE_VO,
};
struct priv {