Commit 02dc04bc authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Do not implicitly set WINED3D_RESOURCE_ACCESS_MAP for dynamic resources.

parent 7772c4fd
......@@ -289,7 +289,7 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *
desc.byte_width = size;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......@@ -577,7 +577,7 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......
......@@ -297,11 +297,13 @@ static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned i
}
}
static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool)
static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
{
switch (pool)
{
case D3DPOOL_DEFAULT:
if (usage & D3DUSAGE_DYNAMIC)
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
return WINED3D_RESOURCE_ACCESS_GPU;
case D3DPOOL_MANAGED:
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
......
......@@ -1018,7 +1018,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width
desc.usage = usage & WINED3DUSAGE_MASK;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.width = width;
desc.height = height;
desc.depth = 1;
......@@ -2111,7 +2111,7 @@ static HRESULT d3d8_device_prepare_vertex_buffer(struct d3d8_device *device, UIN
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......@@ -2206,7 +2206,7 @@ static HRESULT d3d8_device_prepare_index_buffer(struct d3d8_device *device, UINT
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......
......@@ -1110,7 +1110,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.width = width;
desc.height = height;
desc.depth = 1;
......@@ -1157,7 +1157,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.width = edge_length;
desc.height = edge_length;
desc.depth = 1;
......@@ -1203,7 +1203,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool);
desc.access = wined3daccess_from_d3dpool(pool, usage);
desc.width = width;
desc.height = height;
desc.depth = depth;
......
......@@ -290,7 +290,7 @@ HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device *
desc.byte_width = size;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......@@ -576,7 +576,7 @@ HRESULT indexbuffer_init(struct d3d9_indexbuffer *buffer, struct d3d9_device *de
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......
......@@ -300,11 +300,13 @@ static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned i
}
}
static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool)
static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
{
switch (pool)
{
case D3DPOOL_DEFAULT:
if (usage & D3DUSAGE_DYNAMIC)
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
return WINED3D_RESOURCE_ACCESS_GPU;
case D3DPOOL_MANAGED:
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
......
......@@ -1273,7 +1273,7 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, UINT width
desc.usage = usage & WINED3DUSAGE_MASK;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.width = width;
desc.height = height;
desc.depth = 1;
......@@ -2551,7 +2551,7 @@ static HRESULT d3d9_device_prepare_vertex_buffer(struct d3d9_device *device, UIN
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......@@ -2653,7 +2653,7 @@ static HRESULT d3d9_device_prepare_index_buffer(struct d3d9_device *device, UINT
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......
......@@ -1222,7 +1222,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.width = width;
desc.height = height;
desc.depth = 1;
......@@ -1277,7 +1277,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.width = edge_length;
desc.height = edge_length;
desc.depth = 1;
......@@ -1331,7 +1331,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool);
desc.access = wined3daccess_from_d3dpool(pool, usage);
desc.width = width;
desc.height = height;
desc.depth = depth;
......
......@@ -3471,7 +3471,7 @@ static HRESULT d3d_device_prepare_vertex_buffer(struct d3d_device *device, UINT
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......@@ -3663,7 +3663,7 @@ static HRESULT d3d_device_prepare_index_buffer(struct d3d_device *device, UINT m
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......
......@@ -131,7 +131,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
desc.byte_width = new_size * sizeof(*indices);
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
......
......@@ -178,8 +178,6 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource->multisample_type = multisample_type;
resource->multisample_quality = multisample_quality;
resource->usage = usage;
if (usage & WINED3DUSAGE_DYNAMIC)
access |= WINED3D_RESOURCE_ACCESS_MAP;
resource->access = access;
resource->width = width;
resource->height = height;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment