wined3d: Ignore WINED3D_MAP_DISCARD when used together with WINED3D_MAP_NOOVERWRITE.

This fixes a performance issue exposed by commit
afb2aa2512.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-01-03 16:06:55 +01:00 committed by Alexandre Julliard
parent 4c8cb19708
commit 63ed42ac39
1 changed files with 12 additions and 10 deletions

View File

@ -335,17 +335,19 @@ static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *
return 0; return 0;
} }
} }
else if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)) else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
== (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
{ {
WARN("WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE used together, ignoring.\n"); if (!(resource->usage & WINED3DUSAGE_DYNAMIC))
return 0; {
} WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE) return 0;
&& !(resource->usage & WINED3DUSAGE_DYNAMIC)) }
{ if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n"); == (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
return 0; {
WARN("WINED3D_MAP_NOOVERWRITE used with WINED3D_MAP_DISCARD, ignoring WINED3D_MAP_DISCARD.\n");
flags &= ~WINED3D_MAP_DISCARD;
}
} }
return flags; return flags;