CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/GPU/GLES/TextureCacheGLES.h
Views: 1401
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/GPUInterface.h"
25
#include "GPU/GPUState.h"
26
#include "GPU/Common/TextureCacheCommon.h"
27
28
struct VirtualFramebuffer;
29
class FramebufferManagerGLES;
30
class TextureShaderCache;
31
class ShaderManagerGLES;
32
class DrawEngineGLES;
33
class GLRTexture;
34
35
class TextureCacheGLES : public TextureCacheCommon {
36
public:
37
TextureCacheGLES(Draw::DrawContext *draw, Draw2D *draw2D);
38
~TextureCacheGLES();
39
40
void Clear(bool delete_them) override;
41
void StartFrame() override;
42
43
void SetFramebufferManager(FramebufferManagerGLES *fbManager);
44
void SetDepalShaderCache(TextureShaderCache *dpCache) {
45
textureShaderCache_ = dpCache;
46
}
47
void SetDrawEngine(DrawEngineGLES *td) {
48
drawEngine_ = td;
49
}
50
51
void ForgetLastTexture() override {
52
lastBoundTexture = nullptr;
53
}
54
55
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
56
57
void DeviceLost() override;
58
void DeviceRestore(Draw::DrawContext *draw) override;
59
60
protected:
61
void BindTexture(TexCacheEntry *entry) override;
62
void Unbind() override;
63
void ReleaseTexture(TexCacheEntry *entry, bool delete_them) override;
64
65
void BindAsClutTexture(Draw::Texture *tex, bool smooth) override;
66
void *GetNativeTextureView(const TexCacheEntry *entry) override;
67
68
private:
69
void ApplySamplingParams(const SamplerCacheKey &key) override;
70
static Draw::DataFormat GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) ;
71
72
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
73
void BuildTexture(TexCacheEntry *const entry) override;
74
75
GLRenderManager *render_;
76
77
GLRTexture *lastBoundTexture = nullptr;
78
79
FramebufferManagerGLES *framebufferManagerGL_;
80
DrawEngineGLES *drawEngine_;
81
82
enum { INVALID_TEX = -1 };
83
};
84
85
Draw::DataFormat getClutDestFormat(GEPaletteFormat format);
86
87