mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 20:28:26 +00:00
d3d9: Introduce a wined3d_usage_from_d3d() helper.
This commit is contained in:
parent
6db6df95dc
commit
a3c4410fea
|
@ -303,7 +303,7 @@ HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device *
|
|||
d3d9_resource_init(&buffer->resource);
|
||||
|
||||
desc.byte_width = size;
|
||||
desc.usage = usage & WINED3DUSAGE_MASK;
|
||||
desc.usage = wined3d_usage_from_d3d(pool, usage);
|
||||
desc.bind_flags = 0;
|
||||
desc.access = wined3daccess_from_d3dpool(pool, usage) | map_access_from_usage(usage);
|
||||
/* Buffers are always readable. */
|
||||
|
@ -611,7 +611,7 @@ HRESULT indexbuffer_init(struct d3d9_indexbuffer *buffer, struct d3d9_device *de
|
|||
return D3DERR_INVALIDCALL;
|
||||
|
||||
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.access = wined3daccess_from_d3dpool(pool, usage) | map_access_from_usage(usage);
|
||||
/* Buffers are always readable. */
|
||||
|
|
|
@ -373,6 +373,14 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int
|
|||
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_d3d9_usage(DWORD usage)
|
||||
{
|
||||
unsigned int bind_flags = 0;
|
||||
|
@ -385,11 +393,6 @@ static inline unsigned int wined3d_bind_flags_from_d3d9_usage(DWORD usage)
|
|||
return bind_flags;
|
||||
}
|
||||
|
||||
static inline DWORD wined3dusage_from_d3dusage(unsigned int usage)
|
||||
{
|
||||
return usage & WINED3DUSAGE_MASK;
|
||||
}
|
||||
|
||||
static inline enum wined3d_multisample_type wined3d_multisample_type_from_d3d(D3DMULTISAMPLE_TYPE type)
|
||||
{
|
||||
return (enum wined3d_multisample_type)type;
|
||||
|
|
|
@ -1976,10 +1976,8 @@ static HRESULT WINAPI d3d9_device_CreateOffscreenPlainSurface(IDirect3DDevice9Ex
|
|||
}
|
||||
}
|
||||
|
||||
usage = 0;
|
||||
if (pool == D3DPOOL_SCRATCH)
|
||||
usage |= WINED3DUSAGE_SCRATCH;
|
||||
access = wined3daccess_from_d3dpool(pool, usage)
|
||||
usage = wined3d_usage_from_d3d(pool, 0);
|
||||
access = wined3daccess_from_d3dpool(pool, 0)
|
||||
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
|
||||
|
||||
return d3d9_device_create_surface(device, 0, wined3dformat_from_d3dformat(format),
|
||||
|
|
|
@ -1317,9 +1317,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
|
|||
desc.format = wined3dformat_from_d3dformat(format);
|
||||
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
|
||||
desc.multisample_quality = 0;
|
||||
desc.usage = wined3dusage_from_d3dusage(usage);
|
||||
if (pool == D3DPOOL_SCRATCH)
|
||||
desc.usage |= WINED3DUSAGE_SCRATCH;
|
||||
desc.usage = wined3d_usage_from_d3d(pool, usage);
|
||||
desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE;
|
||||
desc.access = wined3daccess_from_d3dpool(pool, usage);
|
||||
desc.width = width;
|
||||
|
@ -1414,10 +1412,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
|
|||
desc.format = wined3dformat_from_d3dformat(format);
|
||||
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
|
||||
desc.multisample_quality = 0;
|
||||
desc.usage = wined3dusage_from_d3dusage(usage);
|
||||
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
|
||||
if (pool == D3DPOOL_SCRATCH)
|
||||
desc.usage |= WINED3DUSAGE_SCRATCH;
|
||||
desc.usage = wined3d_usage_from_d3d(pool, usage) | WINED3DUSAGE_LEGACY_CUBEMAP;
|
||||
desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE;
|
||||
desc.access = wined3daccess_from_d3dpool(pool, usage);
|
||||
desc.width = edge_length;
|
||||
|
@ -1500,9 +1495,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
|
|||
desc.format = wined3dformat_from_d3dformat(format);
|
||||
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
|
||||
desc.multisample_quality = 0;
|
||||
desc.usage = wined3dusage_from_d3dusage(usage);
|
||||
if (pool == D3DPOOL_SCRATCH)
|
||||
desc.usage |= WINED3DUSAGE_SCRATCH;
|
||||
desc.usage = wined3d_usage_from_d3d(pool, usage);
|
||||
desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE;
|
||||
desc.access = wined3daccess_from_d3dpool(pool, usage);
|
||||
desc.width = width;
|
||||
|
|
Loading…
Reference in a new issue