ShaderCache: Implement compile priority

Currently, when immediately compile shaders is not enabled, the
ubershaders will be placed before any specialized shaders in the compile
queue in hybrid ubershaders mode. This means that Dolphin could
potentially use the ubershaders for a longer time than it would have if
we blocked startup until all shaders were compiled, leading to a drop in
performance.
This commit is contained in:
Stenzek
2018-03-16 22:48:56 +10:00
parent d3dd85dbd7
commit 93865b327f
4 changed files with 60 additions and 41 deletions

View File

@ -108,12 +108,23 @@ private:
void AppendGXPipelineUID(const GXPipelineUid& config);
// ASync Compiler Methods
void QueueVertexShaderCompile(const VertexShaderUid& uid);
void QueueVertexUberShaderCompile(const UberShader::VertexShaderUid& uid);
void QueuePixelShaderCompile(const PixelShaderUid& uid);
void QueuePixelUberShaderCompile(const UberShader::PixelShaderUid& uid);
void QueuePipelineCompile(const GXPipelineUid& uid);
void QueueUberPipelineCompile(const GXUberPipelineUid& uid);
void QueueVertexShaderCompile(const VertexShaderUid& uid, u32 priority);
void QueueVertexUberShaderCompile(const UberShader::VertexShaderUid& uid, u32 priority);
void QueuePixelShaderCompile(const PixelShaderUid& uid, u32 priority);
void QueuePixelUberShaderCompile(const UberShader::PixelShaderUid& uid, u32 priority);
void QueuePipelineCompile(const GXPipelineUid& uid, u32 priority);
void QueueUberPipelineCompile(const GXUberPipelineUid& uid, u32 priority);
// Priorities for compiling. The lower the value, the sooner the pipeline is compiled.
// The shader cache is compiled last, as it is the least likely to be required. On demand
// shaders are always compiled before pending ubershaders, as we want to use the ubershader
// for as few frames as possible, otherwise we risk framerate drops.
enum : u32
{
COMPILE_PRIORITY_ONDEMAND_PIPELINE = 100,
COMPILE_PRIORITY_UBERSHADER_PIPELINE = 200,
COMPILE_PRIORITY_SHADERCACHE_PIPELINE = 300
};
// Configuration bits.
APIType m_api_type = APIType::Nothing;