From c26c9badc4a5c97cf877801f505af6d580d9994b Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 30 Jan 2018 15:54:36 +0330 Subject: [PATCH] wined3d: Use the resource access flags in buffer_init(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/buffer.c | 7 ++++--- dlls/wined3d/wined3d_private.h | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 49b189eb0c1..fd26611fb35 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1365,7 +1365,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer, buffer->resource.size, buffer->resource.usage, debug_d3dformat(buffer->resource.format->id), buffer->resource.heap_memory); - if (device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING || pool == WINED3D_POOL_MANAGED) + if (device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING + || wined3d_resource_access_is_managed(buffer->resource.access)) { /* SWvp and managed buffers always return the same pointer in buffer * maps and retain data in DISCARD maps. Keep a system memory copy of @@ -1383,9 +1384,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device { TRACE("Not creating a BO because GL_ARB_vertex_buffer is not supported.\n"); } - else if (buffer->resource.pool == WINED3D_POOL_SYSTEM_MEM) + else if (!(buffer->resource.access & WINED3D_RESOURCE_ACCESS_GPU)) { - TRACE("Not creating a BO because the buffer is in system memory.\n"); + TRACE("Not creating a BO because the buffer is not GPU accessible.\n"); } else if (!dynamic_buffer_ok && (buffer->resource.usage & WINED3DUSAGE_DYNAMIC)) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 082c1ecc4af..f95330f3f48 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2965,6 +2965,11 @@ static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD sta #define WINED3D_RESOURCE_ACCESS_CPU 0x2u #define WINED3D_RESOURCE_ACCESS_MAP 0x4u +static inline BOOL wined3d_resource_access_is_managed(unsigned int access) +{ + return !(~access & (WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU)); +} + struct wined3d_resource_ops { ULONG (*resource_incref)(struct wined3d_resource *resource);