ppsspp/GPU/Directx9/TextureCacheDX9.h

79 lines
2.4 KiB
C
Raw Normal View History

2013-08-17 11:23:51 +02:00
// Copyright (c) 2012- PPSSPP Project.
// This program 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, version 2.0 or later versions.
// This program 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
#include <d3d9.h>
#include "GPU/GPU.h"
2013-08-17 11:23:51 +02:00
#include "GPU/GPUInterface.h"
#include "GPU/Common/TextureCacheCommon.h"
2013-08-17 11:23:51 +02:00
struct VirtualFramebuffer;
class TextureShaderCache;
class FramebufferManagerDX9;
class ShaderManagerDX9;
2013-08-17 11:23:51 +02:00
class TextureCacheDX9 : public TextureCacheCommon {
2013-08-17 11:23:51 +02:00
public:
TextureCacheDX9(Draw::DrawContext *draw, Draw2D *draw2D);
~TextureCacheDX9();
2013-08-17 11:23:51 +02:00
void StartFrame() override;
2013-08-17 11:23:51 +02:00
2017-02-08 15:58:46 +01:00
void SetFramebufferManager(FramebufferManagerDX9 *fbManager);
2023-02-24 21:53:12 +01:00
void ForgetLastTexture() override;
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
2023-02-25 15:59:35 +01:00
void DeviceLost() override {}
void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }
protected:
2017-02-19 23:07:00 +01:00
void BindTexture(TexCacheEntry *entry) override;
2017-02-08 15:43:53 +01:00
void Unbind() override;
void ReleaseTexture(TexCacheEntry *entry, bool delete_them) override;
void BindAsClutTexture(Draw::Texture *tex, bool smooth) override;
void *GetNativeTextureView(const TexCacheEntry *entry) override;
private:
2022-08-05 15:40:31 +02:00
void ApplySamplingParams(const SamplerCacheKey &key) override;
D3DFORMAT GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const;
2017-02-20 00:05:23 +01:00
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
2013-08-17 11:23:51 +02:00
void BuildTexture(TexCacheEntry *const entry) override;
LPDIRECT3DBASETEXTURE9 &DxTex(const TexCacheEntry *entry) const {
2022-07-30 20:41:31 +02:00
return *(LPDIRECT3DBASETEXTURE9 *)&entry->texturePtr;
}
2013-08-17 11:23:51 +02:00
2017-03-02 11:39:02 +01:00
LPDIRECT3DDEVICE9 device_;
LPDIRECT3DDEVICE9EX deviceEx_;
LPDIRECT3DVERTEXDECLARATION9 pFramebufferVertexDecl;
2022-07-30 20:41:31 +02:00
LPDIRECT3DBASETEXTURE9 lastBoundTexture;
2013-08-17 11:23:51 +02:00
float maxAnisotropyLevel;
2013-08-19 20:36:43 +02:00
2017-02-08 15:58:46 +01:00
FramebufferManagerDX9 *framebufferManagerDX9_;
2013-08-17 11:23:51 +02:00
};
D3DFORMAT getClutDestFormat(GEPaletteFormat format);