[PATCH 3/3] wined3d/resource: Performance improvements, try 2

Henri Verbeet hverbeet at gmail.com
Tue Jul 12 09:09:08 CDT 2016


This could do with a more descriptive subject line.

On 11 July 2016 at 18:13, Patrick Rudolph <siro at das-labor.org> wrote:
> Tests showed that D3DLOCK_NOOVERWRITE is prefered over D3DLOCK_DISCARD
> and that D3DLOCK_NOOVERWRITE doesn't depend on dynamic buffers.
"preferred", but you'll probably want to say "takes precedence over" instead.

> Unigine Heavon maps a lot of buffers with both flags, but run on about
> 85% GPU-load, as WINE removes both hints and the game has to wait for
> the buffer to be mapped.
"Unigine Heaven", "Wine"

> OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.1.0-devel (git-60c68c5)
It doesn't make much of a difference here, but note that unless you
set the "MaxVersionGL" registry key, wined3d doesn't use core
profiles.

> ---
>  dlls/d3d9/tests/visual.c | 10 +++++-----
>  dlls/wined3d/resource.c  | 33 ++++++++++++++++-----------------
>  2 files changed, 21 insertions(+), 22 deletions(-)
What about the d3d8 tests?

> @@ -359,29 +359,28 @@ DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resourc
>  {
>      /* Not all flags make sense together, but Windows never returns an error.
>       * Catch the cases that could cause issues. */
> -    if (flags & WINED3D_MAP_READONLY)
> +    if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)) ==
> +            (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
>      {
> -        if (flags & WINED3D_MAP_DISCARD)
> -        {
> -            WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_DISCARD, ignoring flags.\n");
> -            return 0;
> -        }
> -        if (flags & WINED3D_MAP_NOOVERWRITE)
> -        {
> -            WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.\n");
> -            return 0;
> -        }
> +        WARN("WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE used together, using WINED3D_MAP_NOOVERWRITE.\n");
> +        flags &= ~WINED3D_MAP_DISCARD;
> +    }
> +    if ((flags & (WINED3D_MAP_READONLY | WINED3D_MAP_NOOVERWRITE)) ==
> +            (WINED3D_MAP_READONLY | WINED3D_MAP_NOOVERWRITE))
> +    {
> +        WARN("WINED3D_MAP_READONLY and WINED3D_MAP_NOOVERWRITE used together, clearing WINED3D_MAP_READONLY.\n");
> +        flags &= ~WINED3D_MAP_READONLY;
>      }
> -    else if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
> -            == (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
> +
> +    if ((flags & (WINED3D_MAP_READONLY | WINED3D_MAP_DISCARD)) ==
> +            (WINED3D_MAP_READONLY | WINED3D_MAP_DISCARD))
>      {
> -        WARN("WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE used together, ignoring.\n");
> +        WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_DISCARD, ignoring flags.\n");
>          return 0;
>      }
> -    else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)
> -            && !(resource->usage & WINED3DUSAGE_DYNAMIC))
> +    else if ((flags & WINED3D_MAP_DISCARD) && !(resource->usage & WINED3DUSAGE_DYNAMIC))
>      {
> -        WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
> +        WARN("DISCARD on non dynamic buffer, ignoring.\n");
>          return 0;
>      }
This changes several things at once. One (logical) change per commit, please.



More information about the wine-devel mailing list