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:
wm4 2014-11-18 16:30:24 +01:00
parent caf2fbf688
commit b8ac594af0
2 changed files with 34 additions and 15 deletions

View File

@ -233,18 +233,29 @@ Available video output drivers are:
Always force textures to power of 2, even if the device reports
non-power-of-2 texture sizes as supported.
``texture-memory=N``
``texture-memory=<mode>``
Only affects operation with shaders/texturing enabled, and (E)OSD.
Values for N:
Possible values:
0
default, will often use an additional shadow texture + copy
1
use ``D3DPOOL_MANAGED``
2
use ``D3DPOOL_DEFAULT``
3
use ``D3DPOOL_SYSTEMMEM``, but without shadow texture
``default`` (default)
Use ``D3DPOOL_DEFAULT``, with a ``D3DPOOL_SYSTEMMEM`` texture for
locking. If the driver supports ``D3DDEVCAPS_TEXTURESYSTEMMEMORY``,
``D3DPOOL_SYSTEMMEM`` is used directly.
``default-pool``
Use ``D3DPOOL_DEFAULT``. (Like ``default``, but never use a
shadow-texture.)
``default-pool-shadow``
Use ``D3DPOOL_DEFAULT``, with a ``D3DPOOL_SYSTEMMEM`` texture for
locking. (Like ``default``, but always force the shadow-texture.)
``managed``
Use ``D3DPOOL_MANAGED``.
``scratch``
Use ``D3DPOOL_SCRATCH``, with a ``D3DPOOL_SYSTEMMEM`` texture for
locking.
``swap-discard``
Use ``D3DSWAPEFFECT_DISCARD``, which might be faster.

View File

@ -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}