2023-02-25 13:24:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GPUCommon.h"
|
|
|
|
|
|
|
|
// Shared GPUCommon implementation for the HW backends.
|
|
|
|
// Things that are irrelevant for SoftGPU should live here.
|
|
|
|
class GPUCommonHW : public GPUCommon {
|
|
|
|
public:
|
|
|
|
GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
|
|
|
|
~GPUCommonHW();
|
|
|
|
|
2024-10-28 11:43:18 +00:00
|
|
|
// This can fail, and if so no render pass is active.
|
2023-02-25 13:28:22 +00:00
|
|
|
void CopyDisplayToOutput(bool reallyDirty) override;
|
2023-02-25 13:34:30 +00:00
|
|
|
void DoState(PointerWrap &p) override;
|
2023-02-25 15:12:24 +00:00
|
|
|
void DeviceLost() override;
|
2023-02-26 09:33:11 +00:00
|
|
|
void DeviceRestore(Draw::DrawContext *draw) override;
|
2023-02-25 13:28:22 +00:00
|
|
|
|
2023-12-11 22:05:37 +00:00
|
|
|
void BeginHostFrame() override;
|
2023-02-25 16:40:11 +00:00
|
|
|
|
2023-02-25 15:13:54 +00:00
|
|
|
u32 CheckGPUFeatures() const override;
|
|
|
|
|
2023-02-25 17:17:28 +00:00
|
|
|
// From GPUDebugInterface.
|
|
|
|
bool GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferType type, int maxRes) override;
|
|
|
|
bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override;
|
|
|
|
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override;
|
|
|
|
bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override;
|
2023-12-02 12:56:18 +00:00
|
|
|
std::vector<const VirtualFramebuffer *> GetFramebufferList() const override;
|
2023-02-25 17:17:28 +00:00
|
|
|
bool GetCurrentTexture(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
|
|
|
|
bool GetCurrentClut(GPUDebugBuffer &buffer) override;
|
2023-02-25 16:42:46 +00:00
|
|
|
|
2024-11-21 13:12:17 +00:00
|
|
|
FramebufferManagerCommon *GetFramebufferManagerCommon() override {
|
|
|
|
return framebufferManager_;
|
|
|
|
}
|
|
|
|
|
2023-02-25 15:40:52 +00:00
|
|
|
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
|
|
|
|
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
|
|
|
|
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
|
|
|
|
|
2023-02-25 17:17:28 +00:00
|
|
|
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
|
|
|
|
void InvalidateCache(u32 addr, int size, GPUInvalidationType type) override;
|
|
|
|
|
|
|
|
bool FramebufferDirty() override;
|
|
|
|
bool FramebufferReallyDirty() override;
|
|
|
|
|
2023-02-25 16:37:57 +00:00
|
|
|
void Execute_VertexType(u32 op, u32 diff);
|
|
|
|
void Execute_VertexTypeSkinning(u32 op, u32 diff);
|
|
|
|
|
2023-02-25 16:17:09 +00:00
|
|
|
void Execute_Prim(u32 op, u32 diff);
|
|
|
|
void Execute_Bezier(u32 op, u32 diff);
|
|
|
|
void Execute_Spline(u32 op, u32 diff);
|
|
|
|
void Execute_BlockTransferStart(u32 op, u32 diff);
|
|
|
|
|
2023-02-25 16:37:57 +00:00
|
|
|
void Execute_TexSize0(u32 op, u32 diff);
|
|
|
|
void Execute_TexLevel(u32 op, u32 diff);
|
|
|
|
void Execute_LoadClut(u32 op, u32 diff);
|
|
|
|
|
2023-02-25 16:48:37 +00:00
|
|
|
void Execute_WorldMtxNum(u32 op, u32 diff);
|
|
|
|
void Execute_WorldMtxData(u32 op, u32 diff);
|
|
|
|
void Execute_ViewMtxNum(u32 op, u32 diff);
|
|
|
|
void Execute_ViewMtxData(u32 op, u32 diff);
|
|
|
|
void Execute_ProjMtxNum(u32 op, u32 diff);
|
|
|
|
void Execute_ProjMtxData(u32 op, u32 diff);
|
|
|
|
void Execute_TgenMtxNum(u32 op, u32 diff);
|
|
|
|
void Execute_TgenMtxData(u32 op, u32 diff);
|
|
|
|
void Execute_BoneMtxNum(u32 op, u32 diff);
|
|
|
|
void Execute_BoneMtxData(u32 op, u32 diff);
|
|
|
|
|
2023-03-01 21:38:46 +00:00
|
|
|
void Execute_TexFlush(u32 op, u32 diff);
|
|
|
|
|
2023-05-04 07:00:48 +00:00
|
|
|
// TODO: Have these return an error code if they jump to a bad address. If bad, stop the FastRunLoop.
|
2023-02-25 16:17:09 +00:00
|
|
|
typedef void (GPUCommonHW::*CmdFunc)(u32 op, u32 diff);
|
|
|
|
|
2023-02-25 16:37:57 +00:00
|
|
|
void FastRunLoop(DisplayList &list) override;
|
|
|
|
void ExecuteOp(u32 op, u32 diff) override;
|
|
|
|
|
2024-10-16 13:25:53 +00:00
|
|
|
bool PresentedThisFrame() const override;
|
|
|
|
|
2023-02-25 17:27:16 +00:00
|
|
|
private:
|
2023-03-23 16:14:12 +00:00
|
|
|
void CheckDepthUsage(VirtualFramebuffer *vfb) override;
|
2023-02-25 17:27:16 +00:00
|
|
|
void CheckFlushOp(int cmd, u32 diff);
|
|
|
|
|
2023-02-25 13:24:59 +00:00
|
|
|
protected:
|
2023-02-26 09:33:11 +00:00
|
|
|
size_t FormatGPUStatsCommon(char *buf, size_t size);
|
2023-02-25 15:20:34 +00:00
|
|
|
void UpdateCmdInfo() override;
|
|
|
|
|
2023-02-25 16:37:57 +00:00
|
|
|
void PreExecuteOp(u32 op, u32 diff) override;
|
2023-02-25 14:07:00 +00:00
|
|
|
void ClearCacheNextFrame() override;
|
2023-02-25 13:34:30 +00:00
|
|
|
|
2023-02-25 14:07:00 +00:00
|
|
|
// Needs to be called on GPU thread, not reporting thread.
|
|
|
|
void BuildReportingInfo() override;
|
2023-02-25 15:27:00 +00:00
|
|
|
void UpdateMSAALevel(Draw::DrawContext *draw) override;
|
|
|
|
|
2023-05-26 08:28:10 +00:00
|
|
|
void CheckDisplayResized() override;
|
2023-02-25 15:27:00 +00:00
|
|
|
void CheckRenderResized() override;
|
2023-05-26 08:28:10 +00:00
|
|
|
void CheckConfigChanged() override;
|
|
|
|
|
2023-02-25 16:37:57 +00:00
|
|
|
u32 CheckGPUFeaturesLate(u32 features) const;
|
2023-02-25 15:27:00 +00:00
|
|
|
|
|
|
|
int msaaLevel_ = 0;
|
2023-02-25 16:40:11 +00:00
|
|
|
bool sawExactEqualDepth_ = false;
|
2023-02-25 17:27:16 +00:00
|
|
|
ShaderManagerCommon *shaderManager_ = nullptr;
|
2023-02-25 16:17:09 +00:00
|
|
|
};
|