You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- add new IShaderFormat API for separate preprocessing and compilation; backends can implement one or the other depending on the return value of SupportsIndependentPreprocessing - add support for executing preprocessing in the cook process prior to job submission and constructing job input hashes based on preprocessed source (and a subset of the environment used as compile inputs). controlled by a cvar for now and disabled by default - add a BaseShaderFormat class in ShaderCompilerCommon which implements common behaviour for output of debug data - note this function is only called for formats which support independent preprocessing, so is expected to be used only by formats which have been converted to use this API - add new cvars for output of some additional shader debug data - 1. a txt file containing the input hash a.k.a. job cache key 2. a text file containing all diagnostic messages (errors and warnings) for the job - minor change to how input hashes are constructed for pipeline jobs - sum hashes as 256-bit ints instead of adding to a buffer and re-hashing. faster and simpler, and also more collision resistant (sum of two well distributed hashes equally well distributed) #rb Jason.Nadro #rb Yuriy.ODonnell #preflight 64512c88c86798f650b953d3 [CL 25317218 by dan elksnitis in ue5-main branch]
61 lines
2.4 KiB
C++
61 lines
2.4 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;
|
|
|
|
/** 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
|
|
};
|
|
|
|
/**
|
|
* 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.
|
|
* @param bShaderDumpDefinesAsCommentedCode - Whether to add shader definitions as comments.
|
|
* @returns true if the shader is preprocessed without error.
|
|
*/
|
|
extern SHADERPREPROCESSOR_API bool PreprocessShader(
|
|
FString& OutPreprocessedShader,
|
|
FShaderCompilerOutput& ShaderOutput,
|
|
const FShaderCompilerInput& ShaderInput,
|
|
const FShaderCompilerDefinitions& AdditionalDefines,
|
|
EDumpShaderDefines DefinesPolicy = EDumpShaderDefines::DontCare);
|
|
|
|
/**
|
|
* 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.
|
|
* @param bShaderDumpDefinesAsCommentedCode - Whether to add shader definitions as comments.
|
|
* @returns true if the shader is preprocessed without error.
|
|
*/
|
|
extern SHADERPREPROCESSOR_API bool PreprocessShader(
|
|
FShaderPreprocessOutput& Output,
|
|
const FShaderCompilerInput& Input,
|
|
const FShaderCompilerEnvironment& MergedEnvironment,
|
|
const FShaderCompilerDefinitions& AdditionalDefines,
|
|
EDumpShaderDefines DefinesPolicy = EDumpShaderDefines::DontCare);
|