mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
vo_direct3d: fix texture-memory sub-option, extend it
This sub-option was turned into a flag when the sub-option parser was changed to the generic one (probably accidentally). Turn it into a proper choice-option. Also, adjust what the options do. Though none of this probably makes much sense; the default should work, and if it doesn't, the GPU/driver is probably beyond help.
This commit is contained in:
@@ -83,7 +83,7 @@ struct d3dtex {
|
||||
// D3DPOOL_DEFAULT texture:
|
||||
// - can't be locked (Probably.)
|
||||
// - must be used for rendering
|
||||
// This will be NULL on systems with device_texture_sys != 0.
|
||||
// This can be NULL if the system one can be both locked and mapped.
|
||||
IDirect3DTexture9 *device;
|
||||
};
|
||||
|
||||
@@ -352,10 +352,13 @@ static bool d3dtex_allocate(d3d_priv *priv, struct d3dtex *tex, D3DFORMAT fmt,
|
||||
int tw = w, th = h;
|
||||
d3d_fix_texture_size(priv, &tw, &th);
|
||||
|
||||
bool use_sh = !priv->device_texture_sys;
|
||||
int memtype = D3DPOOL_SYSTEMMEM;
|
||||
switch (priv->opt_texture_memory) {
|
||||
case 1: memtype = D3DPOOL_MANAGED; break;
|
||||
case 2: memtype = D3DPOOL_DEFAULT; break;
|
||||
case 1: memtype = D3DPOOL_MANAGED; use_sh = false; break;
|
||||
case 2: memtype = D3DPOOL_DEFAULT; use_sh = false; break;
|
||||
case 3: memtype = D3DPOOL_DEFAULT; use_sh = true; break;
|
||||
case 4: memtype = D3DPOOL_SCRATCH; use_sh = true; break;
|
||||
}
|
||||
|
||||
if (FAILED(IDirect3DDevice9_CreateTexture(priv->d3d_device, tw, th, 1,
|
||||
@@ -365,7 +368,7 @@ static bool d3dtex_allocate(d3d_priv *priv, struct d3dtex *tex, D3DFORMAT fmt,
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
if (!priv->device_texture_sys && !priv->opt_texture_memory) {
|
||||
if (use_sh) {
|
||||
if (FAILED(IDirect3DDevice9_CreateTexture(priv->d3d_device, tw, th, 1,
|
||||
D3DUSAGE_DYNAMIC, fmt, D3DPOOL_DEFAULT, &tex->device, NULL)))
|
||||
{
|
||||
@@ -1728,7 +1731,12 @@ static const struct m_option opts[] = {
|
||||
OPT_FLAG("only-8bit", opt_only_8bit, 0),
|
||||
OPT_FLAG("force-power-of-2", opt_force_power_of_2, 0),
|
||||
OPT_FLAG("disable-texture-align", opt_disable_texture_align, 0),
|
||||
OPT_FLAG("texture-memory", opt_texture_memory, 0),
|
||||
OPT_CHOICE("texture-memory", opt_texture_memory, 0,
|
||||
({"default", 0},
|
||||
{"managed", 1},
|
||||
{"default-pool", 2},
|
||||
{"default-pool-shadow", 3},
|
||||
{"scratch", 4})),
|
||||
OPT_FLAG("swap-discard", opt_swap_discard, 0),
|
||||
OPT_FLAG("exact-backbuffer", opt_exact_backbuffer, 0),
|
||||
{0}
|
||||
|
||||
Reference in New Issue
Block a user