d3dx9: Correctly handle D3DUSAGE_AUTOGENMIPMAP in D3DXCheckVolumeTextureRequirements.
This commit is contained in:
parent
dfc085b684
commit
7d07f1f2f6
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue