Commit 6db6df95 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3d8: Introduce a wined3d_usage_from_d3d() helper.

parent bc7b188f
...@@ -296,7 +296,7 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device * ...@@ -296,7 +296,7 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *
buffer->usage = usage; buffer->usage = usage;
desc.byte_width = size; desc.byte_width = size;
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = wined3d_usage_from_d3d(pool, usage);
desc.bind_flags = 0; desc.bind_flags = 0;
desc.access = wined3daccess_from_d3dpool(pool, usage) | map_access_from_usage(usage); desc.access = wined3daccess_from_d3dpool(pool, usage) | map_access_from_usage(usage);
/* Buffers are always readable. */ /* Buffers are always readable. */
...@@ -600,7 +600,7 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de ...@@ -600,7 +600,7 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
desc.byte_width = size; desc.byte_width = size;
desc.usage = (usage & WINED3DUSAGE_MASK) | WINED3DUSAGE_STATICDECL; desc.usage = wined3d_usage_from_d3d(pool, usage) | WINED3DUSAGE_STATICDECL;
desc.bind_flags = 0; desc.bind_flags = 0;
desc.access = wined3daccess_from_d3dpool(pool, usage) | map_access_from_usage(usage); desc.access = wined3daccess_from_d3dpool(pool, usage) | map_access_from_usage(usage);
/* Buffers are always readable. */ /* Buffers are always readable. */
......
...@@ -353,6 +353,14 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int ...@@ -353,6 +353,14 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int
return access; return access;
} }
static inline unsigned int wined3d_usage_from_d3d(D3DPOOL pool, DWORD usage)
{
usage &= WINED3DUSAGE_MASK;
if (pool == D3DPOOL_SCRATCH)
usage |= WINED3DUSAGE_SCRATCH;
return usage;
}
static inline unsigned int wined3d_bind_flags_from_d3d8_usage(DWORD usage) static inline unsigned int wined3d_bind_flags_from_d3d8_usage(DWORD usage)
{ {
unsigned int bind_flags = 0; unsigned int bind_flags = 0;
......
...@@ -1105,9 +1105,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, ...@@ -1105,9 +1105,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
desc.format = wined3dformat_from_d3dformat(format); desc.format = wined3dformat_from_d3dformat(format);
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = wined3d_usage_from_d3d(pool, usage);
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; 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);
desc.width = width; desc.width = width;
...@@ -1158,10 +1156,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic ...@@ -1158,10 +1156,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
desc.format = wined3dformat_from_d3dformat(format); desc.format = wined3dformat_from_d3dformat(format);
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = wined3d_usage_from_d3d(pool, usage) | WINED3DUSAGE_LEGACY_CUBEMAP;
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; 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);
desc.width = edge_length; desc.width = edge_length;
...@@ -1216,9 +1211,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev ...@@ -1216,9 +1211,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev
desc.format = wined3dformat_from_d3dformat(format); desc.format = wined3dformat_from_d3dformat(format);
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = wined3d_usage_from_d3d(pool, usage);
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; 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);
desc.width = width; desc.width = width;
......
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