Files
UnrealEngineUWP/Engine/Source/Developer/ShaderCompilerCommon/Public/ShaderMinifier.h
Yuriy ODonnell a18b223061 Groundwork for custom shader preprocessing step that removes unused code from shader source before compilation (not used yet by the shader pipeline)
#preflight 631bca62304480f8f8c2db54
#rb Jason.Nadro

[CL 21931128 by Yuriy ODonnell in ue5-main branch]
2022-09-09 19:33:52 -04:00

51 lines
917 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Containers/UnrealString.h"
#include "Misc/EnumClassFlags.h"
namespace UE::ShaderMinifier
{
enum EMinifyShaderFlags
{
None = 0,
OutputReasons = 1 << 1,
OutputStats = 1 << 2,
};
ENUM_CLASS_FLAGS(EMinifyShaderFlags)
struct FDiagnosticMessage
{
FString Message;
FString File;
int32 Offset = INDEX_NONE;
int32 Line = INDEX_NONE;
int32 Column = INDEX_NONE;
};
struct FDiagnostics
{
TArray<FDiagnosticMessage> Errors;
TArray<FDiagnosticMessage> Warnings;
};
struct FMinifiedShader
{
FString Code;
FDiagnostics Diagnostics;
bool Success() const
{
return Diagnostics.Errors.IsEmpty();
}
};
extern SHADERCOMPILERCOMMON_API FMinifiedShader Minify(const FStringView PreprocessedShader, const FStringView EntryPoint, EMinifyShaderFlags Flags = EMinifyShaderFlags::None);
} // UE::ShaderMinifier