wined3d: Enforce texturing capability format restrictions on resource creation.

This commit is contained in:
Stefan Dösinger 2013-09-06 00:11:11 +02:00 committed by Alexandre Julliard
parent b464067313
commit 80638b6d2f
5 changed files with 23 additions and 2 deletions

View File

@ -1197,6 +1197,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_TEXTURE;
desc.pool = pool;
desc.width = width;
desc.height = height;
@ -1237,6 +1238,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_TEXTURE;
desc.pool = pool;
desc.width = edge_length;
desc.height = edge_length;
@ -1276,6 +1278,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_TEXTURE;
desc.pool = pool;
desc.width = width;
desc.height = height;

View File

@ -1321,6 +1321,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_TEXTURE;
desc.pool = pool;
desc.width = width;
desc.height = height;
@ -1361,6 +1362,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_TEXTURE;
desc.pool = pool;
desc.width = edge_length;
desc.height = edge_length;
@ -1400,6 +1402,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_TEXTURE;
desc.pool = pool;
desc.width = width;
desc.height = height;

View File

@ -5608,16 +5608,27 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
layers = 1;
if (desc->ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)
{
wined3d_desc.usage = WINED3DUSAGE_TEXTURE;
pool = WINED3D_POOL_MANAGED;
}
else if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
{
/* ddraw does not enforce format support restrictions on system memory
* textures. Don't set the texture flag, the texture can't be used for
* texturing anyway. */
wined3d_desc.usage = 0;
pool = WINED3D_POOL_SYSTEM_MEM;
}
else
{
wined3d_desc.usage = WINED3DUSAGE_TEXTURE;
pool = WINED3D_POOL_DEFAULT;
}
wined3d_desc.format = wined3dformat_from_ddrawformat(&surface->surface_desc.u4.ddpfPixelFormat);
wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
wined3d_desc.multisample_quality = 0;
wined3d_desc.usage = 0;
wined3d_desc.pool = pool;
wined3d_desc.width = desc->dwWidth;
wined3d_desc.height = desc->dwHeight;

View File

@ -70,7 +70,8 @@ static void resource_check_usage(DWORD usage)
| WINED3DUSAGE_DYNAMIC
| WINED3DUSAGE_AUTOGENMIPMAP
| WINED3DUSAGE_STATICDECL
| WINED3DUSAGE_OVERLAY;
| WINED3DUSAGE_OVERLAY
| WINED3DUSAGE_TEXTURE;
if (usage & ~handled)
FIXME("Unhandled usage flags %#x.\n", usage & ~handled);
@ -92,6 +93,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
return WINED3DERR_INVALIDCALL;
if ((usage & WINED3DUSAGE_DEPTHSTENCIL) && !(format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
return WINED3DERR_INVALIDCALL;
if ((usage & WINED3DUSAGE_TEXTURE) && !(format->flags & WINED3DFMT_FLAG_TEXTURE))
return WINED3DERR_INVALIDCALL;
}
resource->ref = 1;

View File

@ -824,6 +824,7 @@ enum wined3d_display_rotation
#define WINED3DUSAGE_AUTOGENMIPMAP 0x00000400
#define WINED3DUSAGE_DMAP 0x00004000
#define WINED3DUSAGE_MASK 0x00004fff
#define WINED3DUSAGE_TEXTURE 0x10000000
#define WINED3DUSAGE_OWNDC 0x20000000
#define WINED3DUSAGE_STATICDECL 0x40000000
#define WINED3DUSAGE_OVERLAY 0x80000000