2019-12-26 15:32:37 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# pragma once
2016-11-23 15:48:37 -05:00
# include "CoreMinimal.h"
2022-07-20 12:03:45 -04:00
# include "HAL/Platform.h"
2014-03-14 14:13:41 -04:00
# include "ShaderCore.h"
2022-07-20 12:03:45 -04:00
class FShaderCompilerDefinitions ;
2023-05-03 10:17:48 -04:00
class FShaderPreprocessOutput ;
2022-07-20 12:03:45 -04:00
class FString ;
2020-06-23 18:40:00 -04:00
struct FShaderCompilerInput ;
struct FShaderCompilerOutput ;
2023-12-06 13:32:32 -05:00
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
2020-02-10 16:07:53 -05:00
{
/** Will not be dumped unless Input.DumpDebugInfoPath is set */
DontCare ,
/** No defines */
DontIncludeDefines ,
/** Defines will be added in the comments */
AlwaysIncludeDefines
} ;
2023-10-04 09:22:36 -04:00
UE_DEPRECATED ( 5.4 , " Please use overload of PreprocessShader accepting a FShaderPreprocessOutput struct. " )
2014-03-14 14:13:41 -04:00
extern SHADERPREPROCESSOR_API bool PreprocessShader (
FString & OutPreprocessedShader ,
FShaderCompilerOutput & ShaderOutput ,
const FShaderCompilerInput & ShaderInput ,
2023-07-22 06:35:10 -04:00
PRAGMA_DISABLE_DEPRECATION_WARNINGS // FShaderCompilerDefinitions will be made internal in the future, marked deprecated until then
2019-09-14 09:45:25 -04:00
const FShaderCompilerDefinitions & AdditionalDefines ,
2023-12-06 13:32:32 -05:00
EDumpShaderDefines DefinesPolicy = EDumpShaderDefines : : DontCare
2023-07-22 06:35:10 -04:00
PRAGMA_ENABLE_DEPRECATION_WARNINGS
2023-12-06 13:32:32 -05:00
) ;
2023-05-03 10:17:48 -04:00
/**
* 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 ,
2023-07-22 06:35:10 -04:00
PRAGMA_DISABLE_DEPRECATION_WARNINGS // FShaderCompilerDefinitions will be made internal in the future, marked deprecated until then
2023-12-06 13:32:32 -05:00
const FShaderCompilerDefinitions & AdditionalDefines = FShaderCompilerDefinitions ( )
2023-07-22 06:35:10 -04:00
PRAGMA_ENABLE_DEPRECATION_WARNINGS
2023-12-06 13:32:32 -05:00
) ;
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 ) ;
}