[PATCH 3/5] wined3d: Simplify buffer_is_fully_dirty().
Józef Kucia
jkucia at codeweavers.com
Fri May 27 04:03:53 CDT 2016
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 at codeweavers.com>
---
dlls/wined3d/buffer.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 5ddf67d..c82bfdb 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -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;
--
2.7.3
More information about the wine-patches
mailing list