From: Patrick Rudolph Subject: [PATCH] wined3d/resource: Performance improvement Message-Id: <1467307201-29663-1-git-send-email-siro@das-labor.org> Date: Thu, 30 Jun 2016 19:20:01 +0200 Tests on Windows showed that mapping a buffer with flags WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE is valid combination. Writing reliable tests is difficult as the driver is free to choose when using discard. 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. Pass both flags to the driver. Unigine Heavon's score increased from 580 to 700, which is an increase of 20%. Tested on: OpenGL renderer string: Gallium 0.4 on AMD BARTS (DRM 2.43.0 / 4.5.7-300.fc24.x86_64, LLVM 3.8.0) OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.1.0-devel (git-60c68c5) This patch hasn't been tested on other GPUs and drivers. Signed-off-by: Patrick Rudolph --- dlls/wined3d/resource.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index be7dfb4..ea26a9f 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -363,12 +363,8 @@ DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resourc return 0; } } - 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"); - return 0; - } + /* Unigine Heavon uses DISCARD and NOOVERWRITE at the same time. + * Tests showed that it's a valid combination. */ else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE) && !(resource->usage & WINED3DUSAGE_DYNAMIC)) { -- 2.7.4