wined3d: Use the resource access flags in buffer_init().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-01-30 15:54:36 +03:30 committed by Alexandre Julliard
parent e29678dae6
commit c26c9badc4
2 changed files with 9 additions and 3 deletions

View File

@ -1365,7 +1365,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
buffer, buffer->resource.size, buffer->resource.usage, buffer, buffer->resource.size, buffer->resource.usage,
debug_d3dformat(buffer->resource.format->id), buffer->resource.heap_memory); 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 /* SWvp and managed buffers always return the same pointer in buffer
* maps and retain data in DISCARD maps. Keep a system memory copy of * 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"); 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)) else if (!dynamic_buffer_ok && (buffer->resource.usage & WINED3DUSAGE_DYNAMIC))
{ {

View File

@ -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_CPU 0x2u
#define WINED3D_RESOURCE_ACCESS_MAP 0x4u #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 struct wined3d_resource_ops
{ {
ULONG (*resource_incref)(struct wined3d_resource *resource); ULONG (*resource_incref)(struct wined3d_resource *resource);