Commit 734190a7 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Ignore DISCARD and NOOVERWRITE on buffers which are not GPU-accessible.

This fixes a regression introduced by ebbcc10b. Prior to that commit, buffers which were not CPU-accessible would not have the WINED3D_BUFFER_USE_BO flag set, and accordingly buffer_resource_sub_resource_map() would simply return the SYSMEM location, ignoring the DISCARD and NOOVERWRITE flags. However, the "accelerated" path in wined3d_cs_map_upload_bo() only checks for the DISCARD flag, assuming that it is only set for dynamic GPU-accessible buffers, and would subsequently try to allocate non-mappable memory and then map it. This commit avoids the accelerated path for such buffers, once again matching our old behaviour. According to [1], this also matches Windows: DISCARD on SYSTEMMEM buffers is ignored on both AMD and NVidia, and NOOVERWRITE is ignored on NVidia (but not AMD). [1] https://www.winehq.org/mailman3/hyperkitty/list/wine-devel@winehq.org/message/XACSAVAGYTJUZDFLX4JWO665VTB6M7LX/ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53863
parent d9c369c7
......@@ -5167,9 +5167,9 @@ static unsigned int sanitise_map_flags(const struct wined3d_resource *resource,
}
else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
{
if (!(resource->usage & WINED3DUSAGE_DYNAMIC))
if (!(resource->access & WINED3D_RESOURCE_ACCESS_GPU) || !(resource->usage & WINED3DUSAGE_DYNAMIC))
{
WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
WARN("DISCARD or NOOVERWRITE map not on dynamic GPU-accessible buffer, ignoring.\n");
return flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE);
}
if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment