mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Unify most of the DebugGetShader* functions
This commit is contained in:
parent
92ee6e6a75
commit
8fb75e0c12
10 changed files with 41 additions and 98 deletions
|
@ -18,6 +18,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Draw {
|
||||
class DrawContext;
|
||||
|
@ -132,6 +134,9 @@ public:
|
|||
virtual void DeviceLost() = 0;
|
||||
virtual void DeviceRestore(Draw::DrawContext *draw) = 0; // must set draw_ to draw
|
||||
|
||||
virtual std::vector<std::string> DebugGetShaderIDs(DebugShaderType type) = 0;
|
||||
virtual std::string DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) = 0;
|
||||
|
||||
protected:
|
||||
Draw::DrawContext *draw_ = nullptr;
|
||||
};
|
||||
|
|
|
@ -166,25 +166,3 @@ void GPU_D3D11::GetStats(char *buffer, size_t bufsize) {
|
|||
shaderManagerD3D11_->GetNumFragmentShaders()
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> GPU_D3D11::DebugGetShaderIDs(DebugShaderType type) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_VERTEXLOADER:
|
||||
return drawEngine_.DebugGetVertexLoaderIDs();
|
||||
case SHADER_TYPE_TEXTURE:
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderIDs(type);
|
||||
default:
|
||||
return shaderManagerD3D11_->DebugGetShaderIDs(type);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GPU_D3D11::DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_VERTEXLOADER:
|
||||
return drawEngine_.DebugGetVertexLoaderString(id, stringType);
|
||||
case SHADER_TYPE_TEXTURE:
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderString(id, type, stringType);
|
||||
default:
|
||||
return shaderManagerD3D11_->DebugGetShaderString(id, type, stringType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,10 +40,6 @@ public:
|
|||
void DeviceLost() override; // Only happens on Android. Drop all textures and shaders.
|
||||
void DeviceRestore() override;
|
||||
|
||||
// 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;
|
||||
|
||||
protected:
|
||||
void FinishDeferred() override;
|
||||
|
||||
|
|
|
@ -146,25 +146,3 @@ void GPU_DX9::GetStats(char *buffer, size_t bufsize) {
|
|||
shaderManagerDX9_->GetNumFragmentShaders()
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> GPU_DX9::DebugGetShaderIDs(DebugShaderType type) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_VERTEXLOADER:
|
||||
return drawEngine_.DebugGetVertexLoaderIDs();
|
||||
case SHADER_TYPE_TEXTURE:
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderIDs(type);
|
||||
default:
|
||||
return shaderManagerDX9_->DebugGetShaderIDs(type);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GPU_DX9::DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_VERTEXLOADER:
|
||||
return drawEngine_.DebugGetVertexLoaderString(id, stringType);
|
||||
case SHADER_TYPE_TEXTURE:
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderString(id, type, stringType);
|
||||
default:
|
||||
return shaderManagerDX9_->DebugGetShaderString(id, type, stringType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,10 +39,6 @@ public:
|
|||
void ReapplyGfxState() override;
|
||||
void GetStats(char *buffer, size_t bufsize) override;
|
||||
|
||||
// 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;
|
||||
|
||||
protected:
|
||||
void FinishDeferred() override;
|
||||
|
||||
|
|
|
@ -311,25 +311,3 @@ void GPU_GLES::GetStats(char *buffer, size_t bufsize) {
|
|||
shaderManagerGL_->GetNumPrograms()
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> GPU_GLES::DebugGetShaderIDs(DebugShaderType type) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_VERTEXLOADER:
|
||||
return drawEngine_.DebugGetVertexLoaderIDs();
|
||||
case SHADER_TYPE_TEXTURE:
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderIDs(type);
|
||||
default:
|
||||
return shaderManagerGL_->DebugGetShaderIDs(type);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GPU_GLES::DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_VERTEXLOADER:
|
||||
return drawEngine_.DebugGetVertexLoaderString(id, stringType);
|
||||
case SHADER_TYPE_TEXTURE:
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderString(id, type, stringType);
|
||||
default:
|
||||
return shaderManagerGL_->DebugGetShaderString(id, type, stringType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,10 +48,6 @@ public:
|
|||
void DeviceLost() override; // Only happens on Android. Drop all textures and shaders.
|
||||
void DeviceRestore() override;
|
||||
|
||||
// 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;
|
||||
|
||||
void BeginHostFrame() override;
|
||||
void EndHostFrame() override;
|
||||
|
||||
|
|
|
@ -546,3 +546,25 @@ void GPUCommonHW::UpdateMSAALevel(Draw::DrawContext *draw) {
|
|||
msaaLevel_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> GPUCommonHW::DebugGetShaderIDs(DebugShaderType type) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_VERTEXLOADER:
|
||||
return drawEngineCommon_->DebugGetVertexLoaderIDs();
|
||||
case SHADER_TYPE_TEXTURE:
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderIDs(type);
|
||||
default:
|
||||
return shaderManager_->DebugGetShaderIDs(type);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GPUCommonHW::DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_VERTEXLOADER:
|
||||
return drawEngineCommon_->DebugGetVertexLoaderString(id, stringType);
|
||||
case SHADER_TYPE_TEXTURE:
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderString(id, type, stringType);
|
||||
default:
|
||||
return shaderManager_->DebugGetShaderString(id, type, stringType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,10 @@ public:
|
|||
|
||||
u32 CheckGPUFeatures() const override;
|
||||
|
||||
// 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;
|
||||
|
||||
protected:
|
||||
void UpdateCmdInfo() override;
|
||||
|
||||
|
|
|
@ -499,34 +499,24 @@ void GPU_Vulkan::GetStats(char *buffer, size_t bufsize) {
|
|||
}
|
||||
|
||||
std::vector<std::string> GPU_Vulkan::DebugGetShaderIDs(DebugShaderType type) {
|
||||
if (type == SHADER_TYPE_VERTEXLOADER) {
|
||||
return drawEngine_.DebugGetVertexLoaderIDs();
|
||||
} else if (type == SHADER_TYPE_PIPELINE) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_PIPELINE:
|
||||
return pipelineManager_->DebugGetObjectIDs(type);
|
||||
} else if (type == SHADER_TYPE_TEXTURE) {
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderIDs(type);
|
||||
} else if (type == SHADER_TYPE_VERTEX || type == SHADER_TYPE_FRAGMENT || type == SHADER_TYPE_GEOMETRY) {
|
||||
return shaderManagerVulkan_->DebugGetShaderIDs(type);
|
||||
} else if (type == SHADER_TYPE_SAMPLER) {
|
||||
case SHADER_TYPE_SAMPLER:
|
||||
return textureCacheVulkan_->DebugGetSamplerIDs();
|
||||
} else {
|
||||
return std::vector<std::string>();
|
||||
default:
|
||||
return GPUCommonHW::DebugGetShaderIDs(type);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GPU_Vulkan::DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) {
|
||||
if (type == SHADER_TYPE_VERTEXLOADER) {
|
||||
return drawEngine_.DebugGetVertexLoaderString(id, stringType);
|
||||
} else if (type == SHADER_TYPE_PIPELINE) {
|
||||
switch (type) {
|
||||
case SHADER_TYPE_PIPELINE:
|
||||
return pipelineManager_->DebugGetObjectString(id, type, stringType, shaderManagerVulkan_);
|
||||
} else if (type == SHADER_TYPE_TEXTURE) {
|
||||
return textureCache_->GetTextureShaderCache()->DebugGetShaderString(id, type, stringType);
|
||||
} else if (type == SHADER_TYPE_SAMPLER) {
|
||||
case SHADER_TYPE_SAMPLER:
|
||||
return textureCacheVulkan_->DebugGetSamplerString(id, stringType);
|
||||
} else if (type == SHADER_TYPE_VERTEX || type == SHADER_TYPE_FRAGMENT || type == SHADER_TYPE_GEOMETRY) {
|
||||
return shaderManagerVulkan_->DebugGetShaderString(id, type, stringType);
|
||||
} else {
|
||||
return std::string();
|
||||
default:
|
||||
return GPUCommonHW::DebugGetShaderString(id, type, stringType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue