flycast/core/rend/dx9/d3d_texture.h

53 lines
1.5 KiB
C
Raw Normal View History

2021-04-12 20:49:04 +00:00
/*
Copyright 2021 flyinghead
This file is part of Flycast.
Flycast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "rend/TexCache.h"
#include <d3d9.h>
#include "dxcontext.h"
class D3DTexture final : public BaseTextureCacheData
{
public:
ComPtr<IDirect3DTexture9> texture;
std::string GetId() override { return std::to_string((uintptr_t)texture.get()); }
void UploadToGPU(int width, int height, u8* temp_tex_buffer, bool mipmapped,
bool mipmapsIncluded = false) override;
bool Delete() override;
void loadCustomTexture();
2021-04-12 20:49:04 +00:00
};
class D3DTextureCache final : public BaseTextureCache<D3DTexture>
{
public:
D3DTextureCache() {
D3DTexture::SetDirectXColorOrder(true);
2021-04-12 20:49:04 +00:00
}
~D3DTextureCache() {
Clear();
}
void Cleanup()
{
texturesToDelete.clear();
CollectCleanup();
}
void DeleteLater(ComPtr<IDirect3DTexture9> tex) { texturesToDelete.push_back(tex); }
private:
std::vector<ComPtr<IDirect3DTexture9>> texturesToDelete;
};