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;
|
|
|
|
|
class FString;
|
2020-06-23 18:40:00 -04:00
|
|
|
struct FShaderCompilerInput;
|
|
|
|
|
struct FShaderCompilerOutput;
|
|
|
|
|
|
2020-02-10 16:07:53 -05:00
|
|
|
/** Governs the behavior for adding shader defines to the preprocessed source. Can be helpful for the debugging, but makes the source unique
|
|
|
|
|
which can prevent efficient caching.
|
|
|
|
|
*/
|
|
|
|
|
enum class EDumpShaderDefines : uint8
|
|
|
|
|
{
|
|
|
|
|
/** Will not be dumped unless Input.DumpDebugInfoPath is set */
|
|
|
|
|
DontCare,
|
|
|
|
|
/** No defines */
|
|
|
|
|
DontIncludeDefines,
|
|
|
|
|
/** Defines will be added in the comments */
|
|
|
|
|
AlwaysIncludeDefines
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/**
|
|
|
|
|
* Preprocess a shader.
|
|
|
|
|
* @param OutPreprocessedShader - Upon return contains the preprocessed source code.
|
|
|
|
|
* @param ShaderOutput - ShaderOutput to which errors can be added.
|
|
|
|
|
* @param ShaderInput - The shader compiler input.
|
|
|
|
|
* @param AdditionalDefines - Additional defines with which to preprocess the shader.
|
2019-09-14 09:45:25 -04:00
|
|
|
* @param bShaderDumpDefinesAsCommentedCode - Whether to add shader definitions as comments.
|
2014-03-14 14:13:41 -04:00
|
|
|
* @returns true if the shader is preprocessed without error.
|
|
|
|
|
*/
|
|
|
|
|
extern SHADERPREPROCESSOR_API bool PreprocessShader(
|
|
|
|
|
FString& OutPreprocessedShader,
|
|
|
|
|
FShaderCompilerOutput& ShaderOutput,
|
|
|
|
|
const FShaderCompilerInput& ShaderInput,
|
2019-09-14 09:45:25 -04:00
|
|
|
const FShaderCompilerDefinitions& AdditionalDefines,
|
2020-02-10 16:07:53 -05:00
|
|
|
EDumpShaderDefines DefinesPolicy = EDumpShaderDefines::DontCare);
|