Minor refactor allowing getting the GPU profile string outside games

This commit is contained in:
Henrik Rydgård 2023-08-03 16:31:20 +02:00
parent a32249a3cf
commit be63ce3a4a
9 changed files with 13 additions and 27 deletions

View File

@ -492,6 +492,10 @@ public:
renderManager_.SetInvalidationCallback(callback);
}
std::string GetGpuProfileString() const override {
return renderManager_.GetGpuProfileString();
}
private:
void ApplySamplers();

View File

@ -531,6 +531,10 @@ public:
renderManager_.SetInvalidationCallback(callback);
}
std::string GetGpuProfileString() const override {
return renderManager_.GetGpuProfileString();
}
private:
VulkanTexture *GetNullTexture();
VulkanContext *vulkan_ = nullptr;

View File

@ -848,6 +848,10 @@ public:
return FrameTimeData{};
}
virtual std::string GetGpuProfileString() const {
return "";
}
protected:
ShaderModule *vsPresets_[VS_MAX_PRESET];
ShaderModule *fsPresets_[FS_MAX_PRESET];

View File

@ -252,14 +252,6 @@ public:
virtual bool GetOutputFramebuffer(GPUDebugBuffer &buffer) {
return false;
}
// TODO:
// cached framebuffers / textures / vertices?
// get content of specific framebuffer / texture?
// vertex / texture decoding?
// Note: Wanted to name it GetProfileString but clashes with a Windows API.
virtual std::string GetGpuProfileString() { return ""; }
};
bool GPUDebugInitExpression(GPUDebugInterface *g, const char *str, PostfixExpression &exp);

View File

@ -309,8 +309,3 @@ void GPU_GLES::GetStats(char *buffer, size_t bufsize) {
shaderManagerGL_->GetNumPrograms()
);
}
std::string GPU_GLES::GetGpuProfileString() {
GLRenderManager *rm = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
return rm->GetGpuProfileString();
}

View File

@ -51,8 +51,6 @@ public:
void BeginHostFrame() override;
void EndHostFrame() override;
std::string GetGpuProfileString() override;
protected:
void FinishDeferred() override;

View File

@ -98,9 +98,6 @@ void DrawGPUMemoryVis(UIContext *ui, GPUInterface *gpu) {
}
void DrawGPUProfilerVis(UIContext *ui, GPUInterface *gpu) {
if (!gpu) {
return;
}
using namespace Draw;
const int padding = 10 + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_LEFT);
const int starty = 50 + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_TOP);
@ -115,8 +112,7 @@ void DrawGPUProfilerVis(UIContext *ui, GPUInterface *gpu) {
scale = 0.7f;
}
GPUCommon *gpuCommon = static_cast<GPUCommon *>(gpu);
std::string text = gpuCommon->GetGpuProfileString();
std::string text = ui->GetDrawContext()->GetGpuProfileString();
ui->SetFontScale(0.4f, 0.4f);
ui->DrawTextShadow(text.c_str(), x, y, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);

View File

@ -499,8 +499,3 @@ std::string GPU_Vulkan::DebugGetShaderString(std::string id, DebugShaderType typ
return GPUCommonHW::DebugGetShaderString(id, type, stringType);
}
}
std::string GPU_Vulkan::GetGpuProfileString() {
VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
return rm->GetGpuProfileString();
}

View File

@ -59,8 +59,6 @@ public:
return textureCacheVulkan_;
}
std::string GetGpuProfileString() override;
protected:
void FinishDeferred() override;
void CheckRenderResized() override;