Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/GPU/GPUCommonHW.h
3185 views
1
#pragma once
2
3
#include "GPUCommon.h"
4
5
// Shared GPUCommon implementation for the HW backends.
6
// Things that are irrelevant for SoftGPU should live here.
7
class GPUCommonHW : public GPUCommon {
8
public:
9
GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
10
~GPUCommonHW();
11
12
// This can fail, and if so no render pass is active.
13
void CopyDisplayToOutput(bool reallyDirty) override;
14
void DoState(PointerWrap &p) override;
15
void DeviceLost() override;
16
void DeviceRestore(Draw::DrawContext *draw) override;
17
18
void BeginHostFrame() override;
19
20
u32 CheckGPUFeatures() const override;
21
22
// From GPUDebugInterface.
23
bool GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferType type, int maxRes) override;
24
bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override;
25
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override;
26
bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override;
27
std::vector<const VirtualFramebuffer *> GetFramebufferList() const override;
28
bool GetCurrentTexture(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
29
bool GetCurrentClut(GPUDebugBuffer &buffer) override;
30
31
FramebufferManagerCommon *GetFramebufferManagerCommon() override {
32
return framebufferManager_;
33
}
34
TextureCacheCommon *GetTextureCacheCommon() override {
35
return textureCache_;
36
}
37
38
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
39
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
40
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
41
42
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
43
void InvalidateCache(u32 addr, int size, GPUInvalidationType type) override;
44
45
u32 DrawSync(int mode) override;
46
int ListSync(int listid, int mode) override;
47
48
bool FramebufferDirty() override;
49
bool FramebufferReallyDirty() override;
50
51
void Execute_VertexType(u32 op, u32 diff);
52
void Execute_VertexTypeSkinning(u32 op, u32 diff);
53
54
void Execute_Prim(u32 op, u32 diff);
55
void Execute_Bezier(u32 op, u32 diff);
56
void Execute_Spline(u32 op, u32 diff);
57
void Execute_BlockTransferStart(u32 op, u32 diff);
58
59
void Execute_TexSize0(u32 op, u32 diff);
60
void Execute_TexLevel(u32 op, u32 diff);
61
void Execute_LoadClut(u32 op, u32 diff);
62
63
void Execute_WorldMtxNum(u32 op, u32 diff);
64
void Execute_WorldMtxData(u32 op, u32 diff);
65
void Execute_ViewMtxNum(u32 op, u32 diff);
66
void Execute_ViewMtxData(u32 op, u32 diff);
67
void Execute_ProjMtxNum(u32 op, u32 diff);
68
void Execute_ProjMtxData(u32 op, u32 diff);
69
void Execute_TgenMtxNum(u32 op, u32 diff);
70
void Execute_TgenMtxData(u32 op, u32 diff);
71
void Execute_BoneMtxNum(u32 op, u32 diff);
72
void Execute_BoneMtxData(u32 op, u32 diff);
73
74
void Execute_TexFlush(u32 op, u32 diff);
75
76
// TODO: Have these return an error code if they jump to a bad address. If bad, stop the FastRunLoop.
77
typedef void (GPUCommonHW::*CmdFunc)(u32 op, u32 diff);
78
79
void FastRunLoop(DisplayList &list) override;
80
void ExecuteOp(u32 op, u32 diff) override;
81
82
bool PresentedThisFrame() const override;
83
84
private:
85
void CheckDepthUsage(VirtualFramebuffer *vfb) override;
86
void CheckFlushOp(int cmd, u32 diff);
87
88
protected:
89
size_t FormatGPUStatsCommon(char *buf, size_t size);
90
void UpdateCmdInfo() override;
91
92
void PreExecuteOp(u32 op, u32 diff) override;
93
void ClearCacheNextFrame() override;
94
95
// Needs to be called on GPU thread, not reporting thread.
96
void BuildReportingInfo() override;
97
void UpdateMSAALevel(Draw::DrawContext *draw) override;
98
99
void CheckDisplayResized() override;
100
void CheckRenderResized() override;
101
void CheckConfigChanged() override;
102
103
u32 CheckGPUFeaturesLate(u32 features) const;
104
105
int msaaLevel_ = 0;
106
bool sawExactEqualDepth_ = false;
107
ShaderManagerCommon *shaderManager_ = nullptr;
108
};
109
110