wined3d: Simplify buffer_is_fully_dirty().

The buffer_invalidate_bo_range() ensures that if the whole buffer was
invalidated the dirty areas array contains exactly one element.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-05-27 11:03:53 +02:00 committed by Alexandre Julliard
parent eb75b09b56
commit d39560f33f
1 changed files with 4 additions and 11 deletions

View File

@ -89,14 +89,8 @@ static BOOL buffer_is_dirty(const struct wined3d_buffer *buffer)
static BOOL buffer_is_fully_dirty(const struct wined3d_buffer *buffer)
{
unsigned int i;
for (i = 0; i < buffer->modified_areas; ++i)
{
if (!buffer->maps[i].offset && buffer->maps[i].size == buffer->resource.size)
return TRUE;
}
return FALSE;
return buffer->modified_areas == 1
&& !buffer->maps->offset && buffer->maps->size == buffer->resource.size;
}
/* Context activation is done by the caller. */
@ -1348,10 +1342,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
}
}
buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps));
if (!buffer->maps)
if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps))))
{
ERR("Out of memory\n");
ERR("Out of memory.\n");
buffer_unload(&buffer->resource);
resource_cleanup(&buffer->resource);
return E_OUTOFMEMORY;