Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/d3d8/buffer.c | 4 ++-- dlls/d3d8/d3d8_private.h | 4 +++- dlls/d3d8/device.c | 6 +++--- dlls/d3d8/texture.c | 6 +++--- dlls/d3d9/buffer.c | 4 ++-- dlls/d3d9/d3d9_private.h | 4 +++- dlls/d3d9/device.c | 6 +++--- dlls/d3d9/texture.c | 6 +++--- dlls/ddraw/device.c | 4 ++-- dlls/ddraw/executebuffer.c | 2 +- dlls/wined3d/resource.c | 2 -- 11 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index 71b9dac..772a233 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -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;
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 129cffb..5e59065 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -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; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 613cb1e..615f8c7 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -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;
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index 6d212a5..d81c3bc 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -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; diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c index b6897d0..b7277fe 100644 --- a/dlls/d3d9/buffer.c +++ b/dlls/d3d9/buffer.c @@ -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;
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 24b793e..08dd9c5 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -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; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index c955764..e08d737 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -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;
diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 5abf2d0..f3b4b5a 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -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; diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 0254364..d31d598 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -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;
diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c index 09d21c6..b47606a 100644 --- a/dlls/ddraw/executebuffer.c +++ b/dlls/ddraw/executebuffer.c @@ -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;
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 3b07e0c..76f877cb 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -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;