wined3d: Do not enforce GL map access for resources with WINED3D_RESOURCE_ACCESS_CPU.

d3d maps of such resources will map the CPU copy, and uploads and downloads use
glBufferSubData() and glGetBufferSubData() respectively. There is no need to map
the BO.

This improves performance of Indivisible on NVidia GPUs. The game uses a d3d9
MANAGED buffer for streaming vertex data, which results in poor performance on
NVidia when using GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT. With this change we
use neither.

This change should only affect managed resources, i.e. those with both CPU and
GPU access. We never create a BO for CPU-only resources.
This commit is contained in:
Zebediah Figura 2022-09-19 13:21:32 -05:00 committed by Alexandre Julliard
parent 4172c04826
commit ebbcc10b05

View file

@ -379,10 +379,13 @@ GLbitfield wined3d_resource_gl_storage_flags(const struct wined3d_resource *reso
if (resource->usage & WINED3DUSAGE_DYNAMIC)
flags |= GL_CLIENT_STORAGE_BIT;
if (access & WINED3D_RESOURCE_ACCESS_MAP_W)
flags |= GL_MAP_WRITE_BIT;
if (access & WINED3D_RESOURCE_ACCESS_MAP_R)
flags |= GL_MAP_READ_BIT;
if (!(access & WINED3D_RESOURCE_ACCESS_CPU))
{
if (access & WINED3D_RESOURCE_ACCESS_MAP_W)
flags |= GL_MAP_WRITE_BIT;
if (access & WINED3D_RESOURCE_ACCESS_MAP_R)
flags |= GL_MAP_READ_BIT;
}
return flags;
}