wined3d: Simplify DISCARD / READONLY handling in wined3d_buffer_map() a bit.

This commit is contained in:
Henri Verbeet 2013-04-16 08:13:42 +02:00 committed by Alexandre Julliard
parent e5147a5161
commit 00cc81dc69
1 changed files with 12 additions and 15 deletions

View File

@ -986,22 +986,19 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags);
flags = buffer_sanitize_flags(buffer, flags);
if (!(flags & WINED3D_MAP_READONLY))
if (flags & WINED3D_MAP_DISCARD)
{
if (flags & WINED3D_MAP_DISCARD)
{
/* DISCARD invalidates the entire buffer, regardless of the
* specified offset and size. Some applications also depend on the
* entire buffer being uploaded in that case. Two such
* applications are Port Royale and Darkstar One. */
if (!buffer_add_dirty_area(buffer, 0, 0))
return E_OUTOFMEMORY;
}
else
{
if (!buffer_add_dirty_area(buffer, offset, size))
return E_OUTOFMEMORY;
}
/* DISCARD invalidates the entire buffer, regardless of the specified
* offset and size. Some applications also depend on the entire buffer
* being uploaded in that case. Two such applications are Port Royale
* and Darkstar One. */
if (!buffer_add_dirty_area(buffer, 0, 0))
return E_OUTOFMEMORY;
}
else if (!(flags & WINED3D_MAP_READONLY))
{
if (!buffer_add_dirty_area(buffer, offset, size))
return E_OUTOFMEMORY;
}
count = ++buffer->resource.map_count;