// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Templates/Function.h" namespace UE::HlslParser { // Structure to hold forward declarations for a specific scope/namespace chain for the HlslParser struct FScopedDeclarations { FScopedDeclarations(TConstArrayView InScope, TConstArrayView InSymbols) : Scope(InScope) , Symbols(InSymbols) { } TConstArrayView Scope; TConstArrayView Symbols; }; extern HLSLPARSER_API bool RemoveUnusedOutputs( FString& InOutSourceCode, TConstArrayView InUsedOutputs, TConstArrayView InExceptions, TConstArrayView InScopedDeclarations, FString& InOutEntryPoint, TArray& OutErrors ); extern HLSLPARSER_API bool RemoveUnusedOutputs(FString& InOutSourceCode, const TArray& InUsedOutputs, const TArray& InExceptions, FString& InOutEntryPoint, TArray& OutErrors); extern HLSLPARSER_API bool RemoveUnusedInputs( FString& InOutSourceCode, TConstArrayView InUsedInputs, TConstArrayView InScopedDeclarations, FString& InOutEntryPoint, TArray& OutErrors ); extern HLSLPARSER_API bool RemoveUnusedInputs(FString& InOutSourceCode, const TArray& InUsedInputs, FString& InOutEntryPoint, TArray& OutErrors); // Shader input/output parameter storage classes. Naming adopted from SPIR-V nomenclature. enum class EShaderParameterStorageClass { Input, Output, }; // Returns the semantic names of all individual entry point parameters (i.e. all structure fields are inlined) extern HLSLPARSER_API bool FindEntryPointParameters( const FString& InSourceCode, const FString& InEntryPoint, EShaderParameterStorageClass ParameterStorageClass, TConstArrayView InScopedDeclarations, TArray& OutParameterSemantics, TArray& OutErrors ); // Invokes the input callback for each identifier in the specified HLSL source code until the callback returns false. extern HLSLPARSER_API bool ForEachHlslIdentifier(const FString& InSourceCode, const FString& InFilename, const TFunction& InIdentifierCallback); } // namespace UE::HlslParser