Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d8/buffer.c | 6 ++---- dlls/d3d8/d3d8_private.h | 22 ++++++++++++++-------- dlls/d3d8/texture.c | 6 +++--- 3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index 5454d5712a1..328fcad85d4 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -303,8 +303,7 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device * desc.byte_width = size; desc.usage = usage & WINED3DUSAGE_MASK; desc.bind_flags = 0; - desc.access = wined3daccess_from_d3dpool(pool, usage) - | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; + desc.access = wined3daccess_from_d3dpool(pool, usage, D3DRTYPE_VERTEXBUFFER); desc.misc_flags = 0; desc.structure_byte_stride = 0;
@@ -618,8 +617,7 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de desc.byte_width = size; desc.usage = (usage & WINED3DUSAGE_MASK) | WINED3DUSAGE_STATICDECL; desc.bind_flags = 0; - desc.access = wined3daccess_from_d3dpool(pool, usage) - | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; + desc.access = wined3daccess_from_d3dpool(pool, usage, D3DRTYPE_INDEXBUFFER); desc.misc_flags = 0; desc.structure_byte_stride = 0;
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 955de86b80d..d436ed87270 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -313,23 +313,29 @@ static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned i } }
-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) { + unsigned int access; + switch (pool) { case D3DPOOL_DEFAULT: - if (usage & D3DUSAGE_DYNAMIC) - return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; - return WINED3D_RESOURCE_ACCESS_GPU; + access = WINED3D_RESOURCE_ACCESS_GPU; + break; case D3DPOOL_MANAGED: - return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU - | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; + access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU; + break; case D3DPOOL_SYSTEMMEM: case D3DPOOL_SCRATCH: - return WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; + access = WINED3D_RESOURCE_ACCESS_CPU; + break; default: - return 0; + access = 0; } + if (type == D3DRTYPE_VERTEXBUFFER || type == D3DRTYPE_INDEXBUFFER + || pool != D3DPOOL_DEFAULT || usage & D3DUSAGE_DYNAMIC) + access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; + return access; }
static inline unsigned int wined3d_bind_flags_from_d3d8_usage(DWORD usage) diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index 6f17e9da5fd..6a7e6b4203c 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -1111,7 +1111,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; 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); desc.width = width; desc.height = height; desc.depth = 1; @@ -1156,7 +1156,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; 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); 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 if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; 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;