d3dx9: Correctly handle D3DUSAGE_AUTOGENMIPMAP in D3DXCheckVolumeTextureRequirements.

This commit is contained in:
Józef Kucia 2012-05-18 15:50:09 +02:00 committed by Alexandre Julliard
parent dfc085b684
commit 7d07f1f2f6
2 changed files with 25 additions and 0 deletions

View File

@ -517,6 +517,26 @@ static void test_D3DXCheckVolumeTextureRequirements(IDirect3DDevice9 *device)
hr = D3DXCheckVolumeTextureRequirements(device, NULL, NULL, NULL, &mipmaps, 0, NULL, D3DPOOL_DEFAULT); hr = D3DXCheckVolumeTextureRequirements(device, NULL, NULL, NULL, &mipmaps, 0, NULL, D3DPOOL_DEFAULT);
ok(hr == D3D_OK, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK); ok(hr == D3D_OK, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK);
ok(mipmaps == 9, "Returned mipmaps %d, expected %d\n", mipmaps, 9); ok(mipmaps == 9, "Returned mipmaps %d, expected %d\n", mipmaps, 9);
if (!is_autogenmipmap_supported(device, D3DRTYPE_VOLUMETEXTURE))
{
skip("No D3DUSAGE_AUTOGENMIPMAP support for volume textures\n");
return;
}
/* mipmaps when D3DUSAGE_AUTOGENMIPMAP is set */
mipmaps = 0;
hr = D3DXCheckVolumeTextureRequirements(device, NULL, NULL,NULL, &mipmaps, D3DUSAGE_AUTOGENMIPMAP, NULL, D3DPOOL_DEFAULT);
ok(hr == D3D_OK, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK);
ok(mipmaps == 0, "Returned mipmaps %d, expected %d\n", mipmaps, 0);
mipmaps = 1;
hr = D3DXCheckVolumeTextureRequirements(device, NULL, NULL,NULL, &mipmaps, D3DUSAGE_AUTOGENMIPMAP, NULL, D3DPOOL_DEFAULT);
ok(hr == D3D_OK, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK);
ok(mipmaps == 1, "Returned mipmaps %d, expected %d\n", mipmaps, 1);
mipmaps = 3;
hr = D3DXCheckVolumeTextureRequirements(device, NULL, NULL,NULL, &mipmaps, D3DUSAGE_AUTOGENMIPMAP, NULL, D3DPOOL_DEFAULT);
ok(hr == D3D_OK, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK);
ok(mipmaps == 0, "Returned mipmaps %d, expected %d\n", mipmaps, 0);
} }
static void test_D3DXCreateTexture(IDirect3DDevice9 *device) static void test_D3DXCreateTexture(IDirect3DDevice9 *device)

View File

@ -436,6 +436,11 @@ HRESULT WINAPI D3DXCheckVolumeTextureRequirements(LPDIRECT3DDEVICE9 device,
{ {
if (!(caps.TextureCaps & D3DPTEXTURECAPS_MIPVOLUMEMAP)) if (!(caps.TextureCaps & D3DPTEXTURECAPS_MIPVOLUMEMAP))
*miplevels = 1; *miplevels = 1;
else if ((usage & D3DUSAGE_AUTOGENMIPMAP))
{
if (*miplevels > 1)
*miplevels = 0;
}
else else
{ {
UINT max_mipmaps = 1; UINT max_mipmaps = 1;