You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- never append the environment defines as commented code to the source used for further preprocessing/compilation; instead only append it to the debug USF - strip comments after loading the debug usf in direct compile mode as some backends expect comments to have already been removed and the extra ones we add to the debug dump cause them to barf - change all #if 0s in the debug usf to block comments instead so the above can strip them (said backends also don't like preprocessor directives left in the file) #rb Jason.Nadro, rob.krajcarski [CL 30161438 by dan elksnitis in ue5-main branch]
71 lines
2.9 KiB
C++
71 lines
2.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "HAL/Platform.h"
|
|
#include "ShaderCore.h"
|
|
|
|
class FShaderCompilerDefinitions;
|
|
class FShaderPreprocessOutput;
|
|
class FString;
|
|
struct FShaderCompilerInput;
|
|
struct FShaderCompilerOutput;
|
|
|
|
enum class
|
|
UE_DEPRECATED(5.4, "EDumpShaderDefines is no longer used. Shader defines will always be included in preprocessed source debug dumps, but no longer explicitly added to the source by preprocessing.")
|
|
EDumpShaderDefines : uint8
|
|
{
|
|
/** Will not be dumped unless Input.DumpDebugInfoPath is set */
|
|
DontCare,
|
|
/** No defines */
|
|
DontIncludeDefines,
|
|
/** Defines will be added in the comments */
|
|
AlwaysIncludeDefines
|
|
};
|
|
|
|
UE_DEPRECATED(5.4, "Please use overload of PreprocessShader accepting a FShaderPreprocessOutput struct.")
|
|
extern SHADERPREPROCESSOR_API bool PreprocessShader(
|
|
FString& OutPreprocessedShader,
|
|
FShaderCompilerOutput& ShaderOutput,
|
|
const FShaderCompilerInput& ShaderInput,
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS // FShaderCompilerDefinitions will be made internal in the future, marked deprecated until then
|
|
const FShaderCompilerDefinitions& AdditionalDefines,
|
|
EDumpShaderDefines DefinesPolicy = EDumpShaderDefines::DontCare
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
|
);
|
|
|
|
/**
|
|
* Preprocess a shader.
|
|
* @param Output - Preprocess output struct. Source, directives and possibly errors will be populated.
|
|
* @param Input - The shader compiler input.
|
|
* @param MergedEnvironment - The result of merging the Environment and SharedEnvironment from the FShaderCompilerInput
|
|
* (it is assumed this overload is called outside of the worker process which merges this in-place, so this merge step must be
|
|
* performed by the caller)
|
|
* @param AdditionalDefines - Additional defines with which to preprocess the shader.
|
|
* @returns true if the shader is preprocessed without error.
|
|
*/
|
|
extern SHADERPREPROCESSOR_API bool PreprocessShader(
|
|
FShaderPreprocessOutput& Output,
|
|
const FShaderCompilerInput& Input,
|
|
const FShaderCompilerEnvironment& MergedEnvironment,
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS // FShaderCompilerDefinitions will be made internal in the future, marked deprecated until then
|
|
const FShaderCompilerDefinitions& AdditionalDefines = FShaderCompilerDefinitions()
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
|
);
|
|
|
|
UE_DEPRECATED(5.4, "EDumpShaderDefines is no longer used. Shader defines will always be included in preprocessed source debug dumps, but no longer explicitly added to the source by preprocessing.")
|
|
inline bool PreprocessShader(
|
|
FShaderPreprocessOutput& Output,
|
|
const FShaderCompilerInput& Input,
|
|
const FShaderCompilerEnvironment& MergedEnvironment,
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS // FShaderCompilerDefinitions will be made internal in the future, marked deprecated until then
|
|
const FShaderCompilerDefinitions& AdditionalDefines,
|
|
EDumpShaderDefines DefinesPolicy
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
|
)
|
|
{
|
|
return PreprocessShader(Output, Input, MergedEnvironment, AdditionalDefines);
|
|
}
|
|
|