Files
ppsspp/GPU/GLES/TextureCacheGLES.h

86 lines
2.7 KiB
C
Raw Permalink Normal View History

2012-11-01 16:19:01 +01: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.
2012-11-01 16:19:01 +01:00
// 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 "Common/GPU/OpenGL/GLFeatures.h"
#include "Common/GPU/OpenGL/GLCommon.h"
#include "Common/GPU/OpenGL/GLRenderManager.h"
2022-08-05 10:00:27 +02:00
#include "Common/GPU/thin3d.h"
#include "GPU/GPUInterface.h"
2013-02-17 01:06:06 +01:00
#include "GPU/GPUState.h"
2014-09-13 13:15:18 +02:00
#include "GPU/Common/TextureCacheCommon.h"
2012-11-01 16:19:01 +01:00
struct VirtualFramebuffer;
class FramebufferManagerGLES;
class TextureShaderCache;
class ShaderManagerGLES;
class DrawEngineGLES;
2017-11-19 17:37:56 +01:00
class GLRTexture;
class TextureCacheGLES : public TextureCacheCommon {
2013-01-30 20:40:26 +01:00
public:
TextureCacheGLES(Draw::DrawContext *draw, Draw2D *draw2D);
~TextureCacheGLES();
2013-01-30 20:40:26 +01:00
2017-02-27 23:09:12 +01:00
void Clear(bool delete_them) override;
void StartFrame() override;
2017-02-08 15:58:46 +01:00
void SetFramebufferManager(FramebufferManagerGLES *fbManager);
void SetDepalShaderCache(TextureShaderCache *dpCache) {
textureShaderCache_ = dpCache;
2014-03-29 21:58:38 +01:00
}
2017-02-04 11:47:19 +01:00
void SetDrawEngine(DrawEngineGLES *td) {
drawEngine_ = td;
}
2017-02-07 00:24:38 +01:00
void ForgetLastTexture() override {
2017-11-19 17:37:56 +01:00
lastBoundTexture = nullptr;
2017-02-19 23:50:04 +01:00
}
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;
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;
2022-08-05 10:00:27 +02:00
private:
void ApplySamplingParams(const SamplerCacheKey &key) override;
Draw::DataFormat GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const;
2017-02-20 00:05:23 +01:00
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
void BuildTexture(TexCacheEntry *const entry) override;
2017-11-19 17:37:56 +01:00
GLRenderManager *render_;
2015-04-08 20:52:35 +02:00
GLRTexture *lastBoundTexture = nullptr;
2017-02-08 15:58:46 +01:00
FramebufferManagerGLES *framebufferManagerGL_;
2017-02-04 11:47:19 +01:00
DrawEngineGLES *drawEngine_;
2017-02-19 23:50:04 +01:00
enum { INVALID_TEX = -1 };
2013-01-30 20:40:26 +01:00
};
2012-11-01 16:19:01 +01:00
Draw::DataFormat getClutDestFormat(GEPaletteFormat format);