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