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/GPUCommonHW.h
Views: 1401
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
void CopyDisplayToOutput(bool reallyDirty) override;
13
void DoState(PointerWrap &p) override;
14
void DeviceLost() override;
15
void DeviceRestore(Draw::DrawContext *draw) override;
16
17
void BeginHostFrame() override;
18
19
u32 CheckGPUFeatures() const override;
20
21
// From GPUDebugInterface.
22
bool GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferType type, int maxRes) override;
23
bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override;
24
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override;
25
bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override;
26
std::vector<const VirtualFramebuffer *> GetFramebufferList() const override;
27
bool GetCurrentTexture(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
28
bool GetCurrentClut(GPUDebugBuffer &buffer) override;
29
30
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
31
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
32
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
33
34
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
35
void InvalidateCache(u32 addr, int size, GPUInvalidationType type) override;
36
37
bool FramebufferDirty() override;
38
bool FramebufferReallyDirty() override;
39
40
void Execute_VertexType(u32 op, u32 diff);
41
void Execute_VertexTypeSkinning(u32 op, u32 diff);
42
43
void Execute_Prim(u32 op, u32 diff);
44
void Execute_Bezier(u32 op, u32 diff);
45
void Execute_Spline(u32 op, u32 diff);
46
void Execute_BlockTransferStart(u32 op, u32 diff);
47
48
void Execute_TexSize0(u32 op, u32 diff);
49
void Execute_TexLevel(u32 op, u32 diff);
50
void Execute_LoadClut(u32 op, u32 diff);
51
52
void Execute_WorldMtxNum(u32 op, u32 diff);
53
void Execute_WorldMtxData(u32 op, u32 diff);
54
void Execute_ViewMtxNum(u32 op, u32 diff);
55
void Execute_ViewMtxData(u32 op, u32 diff);
56
void Execute_ProjMtxNum(u32 op, u32 diff);
57
void Execute_ProjMtxData(u32 op, u32 diff);
58
void Execute_TgenMtxNum(u32 op, u32 diff);
59
void Execute_TgenMtxData(u32 op, u32 diff);
60
void Execute_BoneMtxNum(u32 op, u32 diff);
61
void Execute_BoneMtxData(u32 op, u32 diff);
62
63
void Execute_TexFlush(u32 op, u32 diff);
64
65
// TODO: Have these return an error code if they jump to a bad address. If bad, stop the FastRunLoop.
66
typedef void (GPUCommonHW::*CmdFunc)(u32 op, u32 diff);
67
68
void FastRunLoop(DisplayList &list) override;
69
void ExecuteOp(u32 op, u32 diff) override;
70
71
private:
72
void CheckDepthUsage(VirtualFramebuffer *vfb) override;
73
void CheckFlushOp(int cmd, u32 diff);
74
75
protected:
76
size_t FormatGPUStatsCommon(char *buf, size_t size);
77
void UpdateCmdInfo() override;
78
79
void PreExecuteOp(u32 op, u32 diff) override;
80
void ClearCacheNextFrame() override;
81
82
// Needs to be called on GPU thread, not reporting thread.
83
void BuildReportingInfo() override;
84
void UpdateMSAALevel(Draw::DrawContext *draw) override;
85
86
void CheckDisplayResized() override;
87
void CheckRenderResized() override;
88
void CheckConfigChanged() override;
89
90
u32 CheckGPUFeaturesLate(u32 features) const;
91
92
int msaaLevel_ = 0;
93
bool sawExactEqualDepth_ = false;
94
ShaderManagerCommon *shaderManager_ = nullptr;
95
};
96
97