Add -shaderdebug cmd line switch to Editor for shaders debugging

This commit is contained in:
Wojtek Figat
2021-02-15 11:55:31 +01:00
parent c9ea812a24
commit cd2a02a5c8
3 changed files with 12 additions and 2 deletions

View File

@@ -133,6 +133,7 @@ bool CommandLine::Parse(const Char* cmdLine)
PARSE_BOOL_SWITCH("-genprojectfiles ", GenProjectFiles);
PARSE_ARG_SWITCH("-build ", Build);
PARSE_BOOL_SWITCH("-skipcompile ", SkipCompile);
PARSE_BOOL_SWITCH("-shaderdebug ", ShaderDebug);
#endif

View File

@@ -150,6 +150,11 @@ public:
/// </summary>
Nullable<bool> SkipCompile;
/// <summary>
/// -shaderdebug (enables debugging data generation for shaders and disables shader compiler optimizations)
/// </summary>
Nullable<bool> ShaderDebug;
#endif
};

View File

@@ -3,6 +3,7 @@
#include "ShaderAssetBase.h"
#include "ShaderStorage.h"
#include "ShaderCacheManager.h"
#include "Engine/Engine/CommandLine.h"
#include "Engine/Serialization/MemoryReadStream.h"
#include "Engine/ShadowsOfMordor/AtlasChartsPacker.h"
@@ -225,8 +226,11 @@ bool ShaderAssetBase::LoadShaderCache(ShaderCacheResult& result)
options.SourceLength = sourceLength;
options.Profile = shaderProfile;
options.Output = &cacheStream;
//options.GenerateDebugData = true;
//options.NoOptimize = true;
if (CommandLine::Options.ShaderDebug)
{
options.GenerateDebugData = true;
options.NoOptimize = true;
}
auto& platformDefine = options.Macros.AddOne();
#if PLATFORM_WINDOWS
platformDefine.Name = "PLATFORM_WINDOWS";