Add shaders profiling console command
This commit is contained in:
@@ -156,6 +156,7 @@ bool CommandLine::Parse(const Char* cmdLine)
|
||||
PARSE_ARG_SWITCH("-build ", Build);
|
||||
PARSE_BOOL_SWITCH("-skipcompile ", SkipCompile);
|
||||
PARSE_BOOL_SWITCH("-shaderdebug ", ShaderDebug);
|
||||
PARSE_BOOL_SWITCH("-shaderprofile ", ShaderProfile);
|
||||
PARSE_ARG_OPT_SWITCH("-play ", Play);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -169,6 +169,11 @@ public:
|
||||
/// </summary>
|
||||
Nullable<bool> ShaderDebug;
|
||||
|
||||
/// <summary>
|
||||
/// -shaderprofile (enables debugging data generation for shaders but leaves shader compiler optimizations active for performance profiling)
|
||||
/// </summary>
|
||||
Nullable<bool> ShaderProfile;
|
||||
|
||||
/// <summary>
|
||||
/// -play !guid! ( Scene to play, can be empty to use default )
|
||||
/// </summary>
|
||||
|
||||
@@ -254,6 +254,10 @@ bool ShaderAssetBase::LoadShaderCache(ShaderCacheResult& result)
|
||||
options.GenerateDebugData = true;
|
||||
options.NoOptimize = true;
|
||||
}
|
||||
else if (CommandLine::Options.ShaderProfile)
|
||||
{
|
||||
options.GenerateDebugData = true;
|
||||
}
|
||||
auto& platformDefine = options.Macros.AddOne();
|
||||
#if PLATFORM_WINDOWS
|
||||
platformDefine.Name = "PLATFORM_WINDOWS";
|
||||
|
||||
@@ -188,11 +188,13 @@ bool ShaderCacheManagerService::Init()
|
||||
int32 MaterialGraphVersion = -1;
|
||||
int32 ParticleGraphVersion = -1;
|
||||
bool ShaderDebug;
|
||||
bool ShaderProfile;
|
||||
};
|
||||
CacheVersion cacheVersion;
|
||||
const String cacheVerFile = rootDir / TEXT("CacheVersion");
|
||||
#if USE_EDITOR
|
||||
const bool shaderDebug = CommandLine::Options.ShaderDebug;
|
||||
const bool shaderProfile = CommandLine::Options.ShaderProfile;
|
||||
#else
|
||||
const bool shaderDebug = false;
|
||||
#endif
|
||||
@@ -209,6 +211,7 @@ bool ShaderCacheManagerService::Init()
|
||||
|| cacheVersion.MaterialGraphVersion != MATERIAL_GRAPH_VERSION
|
||||
|| cacheVersion.ParticleGraphVersion != PARTICLE_GPU_GRAPH_VERSION
|
||||
|| cacheVersion.ShaderDebug != shaderDebug
|
||||
|| cacheVersion.ShaderProfile != shaderProfile
|
||||
)
|
||||
{
|
||||
LOG(Warning, "Shaders cache database is invalid. Performing reset.");
|
||||
@@ -227,6 +230,7 @@ bool ShaderCacheManagerService::Init()
|
||||
cacheVersion.MaterialGraphVersion = MATERIAL_GRAPH_VERSION;
|
||||
cacheVersion.ParticleGraphVersion = PARTICLE_GPU_GRAPH_VERSION;
|
||||
cacheVersion.ShaderDebug = shaderDebug;
|
||||
cacheVersion.ShaderProfile = shaderProfile;
|
||||
if (File::WriteAllBytes(cacheVerFile, (byte*)&cacheVersion, sizeof(cacheVersion)))
|
||||
{
|
||||
LOG(Error, "Failed to create the shaders cache database version file.");
|
||||
|
||||
Reference in New Issue
Block a user