Commit 7d07f1f2 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3dx9: Correctly handle D3DUSAGE_AUTOGENMIPMAP in D3DXCheckVolumeTextureRequirements.

parent dfc085b6
......@@ -517,6 +517,26 @@ static void test_D3DXCheckVolumeTextureRequirements(IDirect3DDevice9 *device)
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(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)
......
......@@ -436,6 +436,11 @@ HRESULT WINAPI D3DXCheckVolumeTextureRequirements(LPDIRECT3DDEVICE9 device,
{
if (!(caps.TextureCaps & D3DPTEXTURECAPS_MIPVOLUMEMAP))
*miplevels = 1;
else if ((usage & D3DUSAGE_AUTOGENMIPMAP))
{
if (*miplevels > 1)
*miplevels = 0;
}
else
{
UINT max_mipmaps = 1;
......
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