Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/GPU/GLES/TextureCacheGLES.h
5656 views
1
// Copyright (c) 2012- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include "Common/GPU/OpenGL/GLFeatures.h"
21
#include "Common/GPU/OpenGL/GLCommon.h"
22
#include "Common/GPU/OpenGL/GLRenderManager.h"
23
#include "Common/GPU/thin3d.h"
24
#include "GPU/GPUState.h"
25
#include "GPU/Common/TextureCacheCommon.h"
26
27
struct VirtualFramebuffer;
28
class FramebufferManagerGLES;
29
class TextureShaderCache;
30
class ShaderManagerGLES;
31
class DrawEngineGLES;
32
class GLRTexture;
33
34
class TextureCacheGLES : public TextureCacheCommon {
35
public:
36
TextureCacheGLES(Draw::DrawContext *draw, Draw2D *draw2D);
37
~TextureCacheGLES();
38
39
void Clear(bool delete_them) override;
40
void StartFrame() override;
41
42
void SetFramebufferManager(FramebufferManagerGLES *fbManager);
43
void SetDepalShaderCache(TextureShaderCache *dpCache) {
44
textureShaderCache_ = dpCache;
45
}
46
void SetDrawEngine(DrawEngineGLES *td) {
47
drawEngine_ = td;
48
}
49
50
void ForgetLastTexture() override {
51
lastBoundTexture = nullptr;
52
}
53
54
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
55
56
void DeviceLost() override;
57
void DeviceRestore(Draw::DrawContext *draw) override;
58
59
protected:
60
void BindTexture(TexCacheEntry *entry) override;
61
void Unbind() override;
62
void ReleaseTexture(TexCacheEntry *entry, bool delete_them) override;
63
64
void BindAsClutTexture(Draw::Texture *tex, bool smooth) override;
65
void *GetNativeTextureView(const TexCacheEntry *entry, bool flat) const override;
66
67
private:
68
void ApplySamplingParams(const SamplerCacheKey &key) override;
69
static Draw::DataFormat GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) ;
70
71
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
72
void BuildTexture(TexCacheEntry *const entry) override;
73
74
GLRenderManager *render_;
75
76
GLRTexture *lastBoundTexture = nullptr;
77
78
FramebufferManagerGLES *framebufferManagerGL_;
79
DrawEngineGLES *drawEngine_;
80
81
enum { INVALID_TEX = -1 };
82
};
83
84
static Draw::DataFormat getClutDestFormat(GEPaletteFormat format);
85
86