Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d8/buffer.c | 4 ++-- dlls/d3d8/d3d8_private.h | 10 ++++++++-- dlls/d3d8/device.c | 2 +- dlls/d3d8/texture.c | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index 2f0d1679c22..87b24bccc60 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -291,7 +291,7 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_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; @@ -582,7 +582,7 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_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/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 7f6049df574..aab2eb97e6e 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -300,11 +300,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) { @@ -316,6 +318,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/d3d8/device.c b/dlls/d3d8/device.c index b60e00cce1f..67c4c7ed75d 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1168,7 +1168,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = wined3d_bind_flags_from_d3d8_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/d3d8/texture.c b/dlls/d3d8/texture.c index d9e68f87035..f53ae562336 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -1113,7 +1113,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = wined3d_bind_flags_from_d3d8_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; @@ -1164,7 +1164,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = wined3d_bind_flags_from_d3d8_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; @@ -1214,7 +1214,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev if (pool == D3DPOOL_MANAGED) desc.usage |= WINED3DUSAGE_MANAGED; desc.bind_flags = wined3d_bind_flags_from_d3d8_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;