Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d9/buffer.c | 4 ++-- dlls/d3d9/d3d9_private.h | 10 ++++++++-- dlls/d3d9/device.c | 2 +- dlls/d3d9/texture.c | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c index 0c4a1262ff1..e4c5895b0ce 100644 --- a/dlls/d3d9/buffer.c +++ b/dlls/d3d9/buffer.c @@ -292,7 +292,7 @@ HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device * if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER; - desc.access = wined3daccess_from_d3dpool(pool, usage) + desc.access = wined3daccess_from_d3dpool(pool, usage, D3DRTYPE_VERTEXBUFFER) | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; desc.misc_flags = 0; desc.structure_byte_stride = 0; @@ -581,7 +581,7 @@ HRESULT indexbuffer_init(struct d3d9_indexbuffer *buffer, struct d3d9_device *de if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = WINED3D_BIND_INDEX_BUFFER; - desc.access = wined3daccess_from_d3dpool(pool, usage) + desc.access = wined3daccess_from_d3dpool(pool, usage, D3DRTYPE_INDEXBUFFER) | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; desc.misc_flags = 0; desc.structure_byte_stride = 0; diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index d6155eba60b..1144c97b9ec 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -313,11 +313,13 @@ static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned i return D3DPOOL_SCRATCH; return D3DPOOL_SYSTEMMEM; case WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU: - return D3DPOOL_MANAGED; + if (usage & WINED3DUSAGE_MANAGED) + return D3DPOOL_MANAGED; + return D3DPOOL_SYSTEMMEM; } }
-static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage) +static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage, D3DRESOURCETYPE type) { switch (pool) { @@ -329,6 +331,10 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; case D3DPOOL_SYSTEMMEM: + if (type == D3DRTYPE_VERTEXBUFFER || type == D3DRTYPE_INDEXBUFFER) + return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU + | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; + /* Fall-through. */ case D3DPOOL_SCRATCH: return WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; default: diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index d641b94221e..dfb30e55fcd 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1395,7 +1395,7 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, UINT width if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage); - desc.access = wined3daccess_from_d3dpool(pool, usage) + desc.access = wined3daccess_from_d3dpool(pool, usage, D3DRTYPE_SURFACE) | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; desc.width = width; desc.height = height; diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index a4db0e9dec8..d76179eab04 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -1317,7 +1317,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device, if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; - desc.access = wined3daccess_from_d3dpool(pool, usage) + desc.access = wined3daccess_from_d3dpool(pool, usage, D3DRTYPE_TEXTURE) | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; desc.width = width; desc.height = height; @@ -1406,7 +1406,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; - desc.access = wined3daccess_from_d3dpool(pool, usage) + desc.access = wined3daccess_from_d3dpool(pool, usage, D3DRTYPE_CUBETEXTURE) | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; desc.width = edge_length; desc.height = edge_length; @@ -1480,7 +1480,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; - desc.access = wined3daccess_from_d3dpool(pool, usage); + desc.access = wined3daccess_from_d3dpool(pool, usage, D3DRTYPE_VOLUMETEXTURE); desc.width = width; desc.height = height; desc.depth = depth;