mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Move some more stuff to GPUCommonHW
This commit is contained in:
parent
3dc47c7fef
commit
231f4efbbb
5 changed files with 60 additions and 75 deletions
|
@ -12,12 +12,9 @@
|
|||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
#include <mutex>
|
||||
|
||||
#include "Common/Profiler/Profiler.h"
|
||||
|
||||
#include "Common/Data/Convert/ColorConv.h"
|
||||
#include "Common/GraphicsContext.h"
|
||||
#include "Common/LogReporting.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
|
@ -41,10 +38,8 @@
|
|||
#include "Core/HLE/sceGe.h"
|
||||
#include "Core/HW/Display.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/Util/PPGeDraw.h"
|
||||
#include "GPU/Common/DrawEngineCommon.h"
|
||||
#include "GPU/Common/FramebufferManagerCommon.h"
|
||||
#include "GPU/Common/SplineCommon.h"
|
||||
#include "GPU/Common/TextureCacheCommon.h"
|
||||
#include "GPU/Debugger/Debugger.h"
|
||||
#include "GPU/Debugger/Record.h"
|
||||
|
@ -74,13 +69,6 @@ GPUCommon::GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw) :
|
|||
|
||||
UpdateVsyncInterval(true);
|
||||
ResetMatrices();
|
||||
|
||||
PPGeSetDrawContext(draw);
|
||||
}
|
||||
|
||||
GPUCommon::~GPUCommon() {
|
||||
// Probably not necessary.
|
||||
PPGeSetDrawContext(nullptr);
|
||||
}
|
||||
|
||||
void GPUCommon::BeginHostFrame() {
|
||||
|
@ -126,19 +114,6 @@ void GPUCommon::Reinitialize() {
|
|||
framebufferManager_->DestroyAllFBOs();
|
||||
}
|
||||
|
||||
// Call at the END of the GPU implementation's DeviceLost
|
||||
void GPUCommon::DeviceLost() {
|
||||
framebufferManager_->DeviceLost();
|
||||
draw_ = nullptr;
|
||||
}
|
||||
|
||||
// Call at the start of the GPU implementation's DeviceRestore
|
||||
void GPUCommon::DeviceRestore(Draw::DrawContext *draw) {
|
||||
draw_ = draw;
|
||||
framebufferManager_->DeviceRestore(draw_);
|
||||
PPGeSetDrawContext(draw_);
|
||||
}
|
||||
|
||||
void GPUCommon::UpdateVsyncInterval(bool force) {
|
||||
#if !(PPSSPP_PLATFORM(ANDROID) || defined(USING_QT_UI) || PPSSPP_PLATFORM(UWP) || PPSSPP_PLATFORM(IOS))
|
||||
int desiredVSyncInterval = g_Config.bVSync ? 1 : 0;
|
||||
|
@ -2053,46 +2028,3 @@ void GPUCommon::UpdateUVScaleOffset() {
|
|||
gstate_c.uv.vOff = getFloat24(gstate.texoffsetv);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t GPUCommon::FormatGPUStatsCommon(char *buffer, size_t size) {
|
||||
float vertexAverageCycles = gpuStats.numVertsSubmitted > 0 ? (float)gpuStats.vertexGPUCycles / (float)gpuStats.numVertsSubmitted : 0.0f;
|
||||
return snprintf(buffer, size,
|
||||
"DL processing time: %0.2f ms, %d drawsync, %d listsync\n"
|
||||
"Draw calls: %d, flushes %d, clears %d (cached: %d)\n"
|
||||
"Num Tracked Vertex Arrays: %d\n"
|
||||
"Vertices: %d cached: %d uncached: %d\n"
|
||||
"FBOs active: %d (evaluations: %d)\n"
|
||||
"Textures: %d, dec: %d, invalidated: %d, hashed: %d kB\n"
|
||||
"readbacks %d (%d non-block), uploads %d, depal %d\n"
|
||||
"Copies: depth %d, color %d, reint %d, blend %d, selftex %d\n"
|
||||
"GPU cycles executed: %d (%f per vertex)\n",
|
||||
gpuStats.msProcessingDisplayLists * 1000.0f,
|
||||
gpuStats.numDrawSyncs,
|
||||
gpuStats.numListSyncs,
|
||||
gpuStats.numDrawCalls,
|
||||
gpuStats.numFlushes,
|
||||
gpuStats.numClears,
|
||||
gpuStats.numCachedDrawCalls,
|
||||
gpuStats.numTrackedVertexArrays,
|
||||
gpuStats.numVertsSubmitted,
|
||||
gpuStats.numCachedVertsDrawn,
|
||||
gpuStats.numUncachedVertsDrawn,
|
||||
(int)framebufferManager_->NumVFBs(),
|
||||
gpuStats.numFramebufferEvaluations,
|
||||
(int)textureCache_->NumLoadedTextures(),
|
||||
gpuStats.numTexturesDecoded,
|
||||
gpuStats.numTextureInvalidations,
|
||||
gpuStats.numTextureDataBytesHashed / 1024,
|
||||
gpuStats.numBlockingReadbacks,
|
||||
gpuStats.numReadbacks,
|
||||
gpuStats.numUploads,
|
||||
gpuStats.numDepal,
|
||||
gpuStats.numDepthCopies,
|
||||
gpuStats.numColorCopies,
|
||||
gpuStats.numReinterpretCopies,
|
||||
gpuStats.numCopiesForShaderBlend,
|
||||
gpuStats.numCopiesForSelfTex,
|
||||
gpuStats.vertexGPUCycles + gpuStats.otherGPUCycles,
|
||||
vertexAverageCycles
|
||||
);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ struct TransformedVertex {
|
|||
class GPUCommon : public GPUInterface, public GPUDebugInterface {
|
||||
public:
|
||||
GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
|
||||
~GPUCommon();
|
||||
|
||||
Draw::DrawContext *GetDrawContext() override {
|
||||
return draw_;
|
||||
|
@ -225,9 +224,6 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
void DeviceLost() override;
|
||||
void DeviceRestore(Draw::DrawContext *draw) override;
|
||||
|
||||
void ClearCacheNextFrame() override {}
|
||||
|
||||
virtual void CheckRenderResized() {}
|
||||
|
@ -275,8 +271,6 @@ protected:
|
|||
}
|
||||
}
|
||||
|
||||
size_t FormatGPUStatsCommon(char *buf, size_t size);
|
||||
|
||||
virtual void BuildReportingInfo() = 0;
|
||||
|
||||
virtual void UpdateMSAALevel(Draw::DrawContext *draw) {}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "Core/System.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Util/PPGeDraw.h"
|
||||
|
||||
#include "GPU/GPUCommonHW.h"
|
||||
#include "GPU/Common/SplineCommon.h"
|
||||
|
@ -386,6 +387,8 @@ GPUCommonHW::GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : GPU
|
|||
|
||||
UpdateCmdInfo();
|
||||
UpdateMSAALevel(draw);
|
||||
|
||||
PPGeSetDrawContext(draw);
|
||||
}
|
||||
|
||||
GPUCommonHW::~GPUCommonHW() {
|
||||
|
@ -407,13 +410,22 @@ void GPUCommonHW::CheckRenderResized() {
|
|||
}
|
||||
}
|
||||
|
||||
// Call at the END of the GPU implementation's DeviceLost
|
||||
void GPUCommonHW::DeviceLost() {
|
||||
textureCache_->Clear(false);
|
||||
framebufferManager_->DeviceLost();
|
||||
draw_ = nullptr;
|
||||
textureCache_->Clear(false);
|
||||
textureCache_->DeviceLost();
|
||||
shaderManager_->DeviceLost();
|
||||
}
|
||||
|
||||
// Call at the start of the GPU implementation's DeviceRestore
|
||||
void GPUCommonHW::DeviceRestore(Draw::DrawContext *draw) {
|
||||
draw_ = draw;
|
||||
framebufferManager_->DeviceRestore(draw_);
|
||||
PPGeSetDrawContext(draw_);
|
||||
}
|
||||
|
||||
void GPUCommonHW::UpdateCmdInfo() {
|
||||
if (g_Config.bSoftwareSkinning) {
|
||||
cmdInfo_[GE_CMD_VERTEXTYPE].flags &= ~FLAG_FLUSHBEFOREONCHANGE;
|
||||
|
@ -1599,3 +1611,46 @@ void GPUCommonHW::Execute_BoneMtxData(u32 op, u32 diff) {
|
|||
gstate.boneMatrixNumber = (GE_CMD_BONEMATRIXNUMBER << 24) | (num & 0x00FFFFFF);
|
||||
gstate.boneMatrixData = GE_CMD_BONEMATRIXDATA << 24;
|
||||
}
|
||||
|
||||
size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) {
|
||||
float vertexAverageCycles = gpuStats.numVertsSubmitted > 0 ? (float)gpuStats.vertexGPUCycles / (float)gpuStats.numVertsSubmitted : 0.0f;
|
||||
return snprintf(buffer, size,
|
||||
"DL processing time: %0.2f ms, %d drawsync, %d listsync\n"
|
||||
"Draw calls: %d, flushes %d, clears %d (cached: %d)\n"
|
||||
"Num Tracked Vertex Arrays: %d\n"
|
||||
"Vertices: %d cached: %d uncached: %d\n"
|
||||
"FBOs active: %d (evaluations: %d)\n"
|
||||
"Textures: %d, dec: %d, invalidated: %d, hashed: %d kB\n"
|
||||
"readbacks %d (%d non-block), uploads %d, depal %d\n"
|
||||
"Copies: depth %d, color %d, reint %d, blend %d, selftex %d\n"
|
||||
"GPU cycles executed: %d (%f per vertex)\n",
|
||||
gpuStats.msProcessingDisplayLists * 1000.0f,
|
||||
gpuStats.numDrawSyncs,
|
||||
gpuStats.numListSyncs,
|
||||
gpuStats.numDrawCalls,
|
||||
gpuStats.numFlushes,
|
||||
gpuStats.numClears,
|
||||
gpuStats.numCachedDrawCalls,
|
||||
gpuStats.numTrackedVertexArrays,
|
||||
gpuStats.numVertsSubmitted,
|
||||
gpuStats.numCachedVertsDrawn,
|
||||
gpuStats.numUncachedVertsDrawn,
|
||||
(int)framebufferManager_->NumVFBs(),
|
||||
gpuStats.numFramebufferEvaluations,
|
||||
(int)textureCache_->NumLoadedTextures(),
|
||||
gpuStats.numTexturesDecoded,
|
||||
gpuStats.numTextureInvalidations,
|
||||
gpuStats.numTextureDataBytesHashed / 1024,
|
||||
gpuStats.numBlockingReadbacks,
|
||||
gpuStats.numReadbacks,
|
||||
gpuStats.numUploads,
|
||||
gpuStats.numDepal,
|
||||
gpuStats.numDepthCopies,
|
||||
gpuStats.numColorCopies,
|
||||
gpuStats.numReinterpretCopies,
|
||||
gpuStats.numCopiesForShaderBlend,
|
||||
gpuStats.numCopiesForSelfTex,
|
||||
gpuStats.vertexGPUCycles + gpuStats.otherGPUCycles,
|
||||
vertexAverageCycles
|
||||
);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ public:
|
|||
void CopyDisplayToOutput(bool reallyDirty) override;
|
||||
void DoState(PointerWrap &p) override;
|
||||
void DeviceLost() override;
|
||||
void DeviceRestore(Draw::DrawContext *draw) override;
|
||||
|
||||
void BeginFrame() override;
|
||||
|
||||
|
@ -69,6 +70,7 @@ private:
|
|||
void CheckFlushOp(int cmd, u32 diff);
|
||||
|
||||
protected:
|
||||
size_t FormatGPUStatsCommon(char *buf, size_t size);
|
||||
void UpdateCmdInfo() override;
|
||||
|
||||
void PreExecuteOp(u32 op, u32 diff) override;
|
||||
|
|
|
@ -454,6 +454,8 @@ SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
|||
NotifyConfigChanged();
|
||||
NotifyRenderResized();
|
||||
NotifyDisplayResized();
|
||||
|
||||
PPGeSetDrawContext(draw);
|
||||
}
|
||||
|
||||
void SoftGPU::DeviceLost() {
|
||||
|
|
Loading…
Add table
Reference in a new issue