TextureCacheBase: Support dumping individual mipmaps.

This commit is contained in:
NeoBrainX committed 2012-05-13 17:41:04 +02:00
1 parent a8ad59ee3e
commit a5e68ab10e
9 files changed
+58 -25

No files matched your search

@@ -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,
@@ -52,7 +52,7 @@ private:
const float *colmat);
void Bind(unsigned int stage);
bool Save(const char filename[]);
bool Save(const char filename[], unsigned int level);
};
TCacheEntryBase* CreateTexture(unsigned int width, unsigned int height,