TextureCacheBase: Support dumping individual mipmaps.

This commit is contained in:
NeoBrainX
2012-05-12 13:50:03 +02:00
parent a8ad59ee3e
commit a5e68ab10e
9 changed files with 58 additions and 25 deletions

View File

@ -58,9 +58,17 @@ void TextureCache::TCacheEntry::Bind(unsigned int stage)
D3D::SetTexture(stage, texture);
}
bool TextureCache::TCacheEntry::Save(const char filename[])
bool TextureCache::TCacheEntry::Save(const char filename[], unsigned int level)
{
return SUCCEEDED(PD3DXSaveTextureToFileA(filename, D3DXIFF_PNG, texture, 0));
IDirect3DSurface9* surface;
HRESULT hr = texture->GetSurfaceLevel(level, &surface);
if (FAILED(hr))
return false;
hr = PD3DXSaveSurfaceToFileA(filename, D3DXIFF_PNG, surface, NULL, NULL);
surface->Release();
return SUCCEEDED(hr);
}
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,