2016-12-08 08:52:44 -05:00
|
|
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
2014-11-03 11:36:09 -05:00
|
|
|
|
|
|
|
|
/*=============================================================================
|
|
|
|
|
HlslParser.cpp - Implementation for parsing hlsl.
|
|
|
|
|
=============================================================================*/
|
|
|
|
|
|
|
|
|
|
#include "HlslParser.h"
|
|
|
|
|
#include "HlslExpressionParser.inl"
|
2015-03-18 15:32:09 -04:00
|
|
|
#include "CCIR.h"
|
2014-11-03 11:36:09 -05:00
|
|
|
|
|
|
|
|
namespace CrossCompiler
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseExpressionStatement(class FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement);
|
|
|
|
|
EParseResult ParseStructBody(FHlslScanner& Scanner, FSymbolScope* SymbolScope, FLinearAllocator* Allocator, AST::FTypeSpecifier** OutTypeSpecifier);
|
|
|
|
|
EParseResult TryParseAttribute(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FAttribute** OutAttribute);
|
|
|
|
|
|
|
|
|
|
typedef EParseResult(*TTryRule)(class FHlslParser& Scanner, FLinearAllocator* Allocator, AST::FNode** OutStatement);
|
2014-11-03 11:36:09 -05:00
|
|
|
struct FRulePair
|
|
|
|
|
{
|
|
|
|
|
EHlslToken Token;
|
|
|
|
|
TTryRule TryRule;
|
2014-12-11 15:49:40 -05:00
|
|
|
bool bSupportsAttributes;
|
2014-11-03 11:36:09 -05:00
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
FRulePair(EHlslToken InToken, TTryRule InTryRule, bool bInSupportsAttributes = false) : Token(InToken), TryRule(InTryRule), bSupportsAttributes(bInSupportsAttributes) {}
|
2014-11-03 11:36:09 -05:00
|
|
|
};
|
|
|
|
|
typedef TArray<FRulePair> TRulesArray;
|
|
|
|
|
|
|
|
|
|
class FHlslParser
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-10-28 19:18:20 -04:00
|
|
|
FHlslParser(FLinearAllocator* InAllocator, FCompilerMessages& InCompilerMessages);
|
2014-11-03 11:36:09 -05:00
|
|
|
FHlslScanner Scanner;
|
2015-10-28 19:18:20 -04:00
|
|
|
FCompilerMessages& CompilerMessages;
|
2014-11-03 11:36:09 -05:00
|
|
|
FSymbolScope GlobalScope;
|
2015-10-28 19:18:20 -04:00
|
|
|
FSymbolScope Namespaces;
|
2014-11-03 11:36:09 -05:00
|
|
|
FSymbolScope* CurrentScope;
|
2014-12-11 15:49:40 -05:00
|
|
|
FLinearAllocator* Allocator;
|
2014-11-03 11:36:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TRulesArray RulesStatements;
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
EParseResult TryStatementRules(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutNode)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2015-03-04 17:00:58 -05:00
|
|
|
for (const auto& Rule : RulesStatements)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
auto CurrentTokenIndex = Parser.Scanner.GetCurrentTokenIndex();
|
2014-12-11 15:49:40 -05:00
|
|
|
TLinearArray<AST::FAttribute*> Attributes(Allocator);
|
|
|
|
|
if (Rule.bSupportsAttributes)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
while (Parser.Scanner.HasMoreTokens())
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
const auto* Peek = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
if (Peek->Token == EHlslToken::LeftSquareBracket)
|
|
|
|
|
{
|
|
|
|
|
AST::FAttribute* Attribute = nullptr;
|
|
|
|
|
auto Result = TryParseAttribute(Parser, Allocator, &Attribute);
|
|
|
|
|
if (Result == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
Attributes.Add(Attribute);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Parser.Scanner.MatchToken(Rule.Token) || Rule.Token == EHlslToken::Invalid)
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FNode* Node = nullptr;
|
|
|
|
|
EParseResult Result = (*Rule.TryRule)(Parser, Allocator, &Node);
|
|
|
|
|
if (Result == EParseResult::Error)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
if (Attributes.Num() > 0)
|
|
|
|
|
{
|
|
|
|
|
Swap(Node->Attributes, Attributes);
|
|
|
|
|
}
|
|
|
|
|
*OutNode = Node;
|
|
|
|
|
return EParseResult::Matched;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Parser.Scanner.SetCurrentTokenIndex(CurrentTokenIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-10 21:55:37 -05:00
|
|
|
bool MatchPragma(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutNode)
|
|
|
|
|
{
|
|
|
|
|
const auto* Peek = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Pragma))
|
|
|
|
|
{
|
|
|
|
|
auto* Pragma = new(Allocator)AST::FPragma(Allocator, *Peek->String, Peek->SourceInfo);
|
|
|
|
|
*OutNode = Pragma;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseDeclarationArrayBracketsAndIndex(FHlslScanner& Scanner, FSymbolScope* SymbolScope, bool bNeedsDimension, FLinearAllocator* Allocator, AST::FExpression** OutExpression)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Scanner.MatchToken(EHlslToken::LeftSquareBracket))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto ExpressionResult = ParseExpression(Scanner, SymbolScope, false, Allocator, OutExpression);
|
|
|
|
|
if (ExpressionResult == EParseResult::Error)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Expected expression!"));
|
|
|
|
|
return EParseResult::Error;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-11-07 09:45:40 -05:00
|
|
|
if (!Scanner.MatchToken(EHlslToken::RightSquareBracket))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Expected ']'!"));
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
if (ExpressionResult == EParseResult::NotMatched)
|
|
|
|
|
{
|
|
|
|
|
if (bNeedsDimension)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected array dimension!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseDeclarationMultiArrayBracketsAndIndex(FHlslScanner& Scanner, FSymbolScope* SymbolScope, bool bNeedsDimension, FLinearAllocator* Allocator, AST::FDeclaration* Declaration)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
bool bFoundOne = false;
|
|
|
|
|
do
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FExpression* Dimension = nullptr;
|
|
|
|
|
auto Result = ParseDeclarationArrayBracketsAndIndex(Scanner, SymbolScope, bNeedsDimension, Allocator, &Dimension);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::NotMatched)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
Declaration->ArraySize.Add(Dimension);
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
bFoundOne = true;
|
|
|
|
|
}
|
2014-11-07 09:45:40 -05:00
|
|
|
while (Scanner.HasMoreTokens());
|
2014-11-03 11:36:09 -05:00
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
if (bFoundOne)
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
Declaration->bIsArray = true;
|
|
|
|
|
return EParseResult::Matched;
|
2014-11-04 14:12:02 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
2014-11-04 14:12:02 -05:00
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseTextureOrBufferSimpleDeclaration(FHlslScanner& Scanner, FSymbolScope* SymbolScope, bool bMultiple, FLinearAllocator* Allocator, AST::FDeclaratorList** OutDeclaratorList)
|
|
|
|
|
{
|
|
|
|
|
auto OriginalToken = Scanner.GetCurrentTokenIndex();
|
|
|
|
|
const auto* Token = Scanner.GetCurrentToken();
|
|
|
|
|
auto* FullType = (*OutDeclaratorList)->Type;
|
|
|
|
|
if (ParseGeneralType(Scanner, ETF_SAMPLER_TEXTURE_BUFFER, nullptr, Allocator, &FullType->Specifier) == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
if (Scanner.MatchToken(EHlslToken::Lower))
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FTypeSpecifier* ElementTypeSpecifier = nullptr;
|
|
|
|
|
auto Result = ParseGeneralType(Scanner, ETF_BUILTIN_NUMERIC | ETF_USER_TYPES, SymbolScope, Allocator, &ElementTypeSpecifier);
|
|
|
|
|
if (Result != EParseResult::Matched)
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Expected type!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FullType->Specifier->InnerType = ElementTypeSpecifier->TypeName;
|
|
|
|
|
|
|
|
|
|
if (Scanner.MatchToken(EHlslToken::Comma))
|
|
|
|
|
{
|
|
|
|
|
auto* Integer = Scanner.GetCurrentToken();
|
|
|
|
|
if (!Scanner.MatchToken(EHlslToken::UnsignedIntegerConstant))
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected constant!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
FullType->Specifier->TextureMSNumSamples = Integer->UnsignedInteger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Scanner.MatchToken(EHlslToken::Greater))
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected '>'!"));
|
2014-11-04 14:12:02 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
else
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
//TypeSpecifier->InnerName = "float4";
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
do
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
// Handle 'Sampler2D Sampler'
|
|
|
|
|
AST::FTypeSpecifier* DummyTypeSpecifier = nullptr;
|
|
|
|
|
const auto* IdentifierToken = Scanner.GetCurrentToken();
|
|
|
|
|
AST::FDeclaration* Declaration = nullptr;
|
|
|
|
|
if (ParseGeneralType(Scanner, ETF_SAMPLER_TEXTURE_BUFFER, nullptr, Allocator, &DummyTypeSpecifier) == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
Declaration = new(Allocator) AST::FDeclaration(Allocator, DummyTypeSpecifier->SourceInfo);
|
|
|
|
|
Declaration->Identifier = Allocator->Strdup(DummyTypeSpecifier->TypeName);
|
|
|
|
|
}
|
|
|
|
|
else if (Scanner.MatchToken(EHlslToken::Identifier))
|
|
|
|
|
{
|
|
|
|
|
Declaration = new(Allocator) AST::FDeclaration(Allocator, IdentifierToken->SourceInfo);
|
|
|
|
|
Declaration->Identifier = Allocator->Strdup(IdentifierToken->String);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected Identifier!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
if (ParseDeclarationMultiArrayBracketsAndIndex(Scanner, SymbolScope, true, Allocator, Declaration) == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(*OutDeclaratorList)->Declarations.Add(Declaration);
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
while (bMultiple && Scanner.MatchToken(EHlslToken::Comma));
|
2014-11-03 11:36:09 -05:00
|
|
|
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
// Unmatched
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SetCurrentTokenIndex(OriginalToken);
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Multi declaration parser flags
|
|
|
|
|
enum EDeclarationFlags
|
|
|
|
|
{
|
2015-03-04 17:00:58 -05:00
|
|
|
EDF_CONST_ROW_MAJOR = (1 << 0),
|
|
|
|
|
EDF_STATIC = (1 << 1),
|
|
|
|
|
EDF_UNIFORM = (1 << 2),
|
|
|
|
|
EDF_TEXTURE_SAMPLER_OR_BUFFER = (1 << 3),
|
|
|
|
|
EDF_INITIALIZER = (1 << 4),
|
|
|
|
|
EDF_INITIALIZER_LIST = (1 << 5) | EDF_INITIALIZER,
|
|
|
|
|
EDF_SEMANTIC = (1 << 6),
|
|
|
|
|
EDF_SEMICOLON = (1 << 7),
|
|
|
|
|
EDF_IN_OUT = (1 << 8),
|
|
|
|
|
EDF_MULTIPLE = (1 << 9),
|
|
|
|
|
EDF_PRIMITIVE_DATA_TYPE = (1 << 10),
|
|
|
|
|
EDF_SHARED = (1 << 11),
|
|
|
|
|
EDF_INTERPOLATION = (1 << 12),
|
2014-11-03 11:36:09 -05:00
|
|
|
};
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseInitializer(FHlslScanner& Scanner, FSymbolScope* SymbolScope, bool bAllowLists, FLinearAllocator* Allocator, AST::FExpression** OutList)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
if (bAllowLists && Scanner.MatchToken(EHlslToken::LeftBrace))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutList = new(Allocator) AST::FInitializerListExpression(Allocator, Scanner.GetCurrentToken()->SourceInfo);
|
|
|
|
|
auto Result = ParseExpressionList(EHlslToken::RightBrace, Scanner, SymbolScope, EHlslToken::LeftBrace, Allocator, *OutList);
|
2014-11-14 11:33:43 -05:00
|
|
|
if (Result != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-14 11:33:43 -05:00
|
|
|
Scanner.SourceError(TEXT("Invalid initializer list\n"));
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-11-14 11:33:43 -05:00
|
|
|
return EParseResult::Matched;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
//@todo-rco?
|
|
|
|
|
auto Result = ParseExpression(Scanner, SymbolScope, true, Allocator, OutList);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Invalid initializer expression\n"));
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
EParseResult ParseDeclarationStorageQualifiers(FHlslScanner& Scanner, int32 TypeFlags, int32 DeclarationFlags, bool& bOutPrimitiveFound, AST::FTypeQualifier* Qualifier)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
bOutPrimitiveFound = false;
|
2014-11-03 11:36:09 -05:00
|
|
|
int32 StaticFound = 0;
|
2015-03-04 17:00:58 -05:00
|
|
|
int32 InterpolationLinearFound = 0;
|
|
|
|
|
int32 InterpolationCentroidFound = 0;
|
|
|
|
|
int32 InterpolationNoInterpolationFound = 0;
|
|
|
|
|
int32 InterpolationNoPerspectiveFound = 0;
|
|
|
|
|
int32 InterpolationSampleFound = 0;
|
2014-11-04 14:12:02 -05:00
|
|
|
int32 SharedFound = 0;
|
2014-11-03 11:36:09 -05:00
|
|
|
int32 ConstFound = 0;
|
2014-11-04 14:12:02 -05:00
|
|
|
int32 RowMajorFound = 0;
|
2014-11-03 11:36:09 -05:00
|
|
|
int32 InFound = 0;
|
|
|
|
|
int32 OutFound = 0;
|
|
|
|
|
int32 InOutFound = 0;
|
2014-11-04 14:12:02 -05:00
|
|
|
int32 PrimitiveFound = 0;
|
2015-02-23 09:53:19 -05:00
|
|
|
int32 UniformFound = 0;
|
2014-11-04 14:12:02 -05:00
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
if (DeclarationFlags & EDF_PRIMITIVE_DATA_TYPE)
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
const auto* Token = Scanner.GetCurrentToken();
|
2014-11-04 14:12:02 -05:00
|
|
|
if (Token && Token->Token == EHlslToken::Identifier)
|
|
|
|
|
{
|
|
|
|
|
if (Token->String == TEXT("point") ||
|
|
|
|
|
Token->String == TEXT("line") ||
|
|
|
|
|
Token->String == TEXT("triangle") ||
|
2015-10-28 19:18:20 -04:00
|
|
|
Token->String == TEXT("Triangle") || // PSSL
|
|
|
|
|
Token->String == TEXT("AdjacentLine") || // PSSL
|
2014-11-04 14:12:02 -05:00
|
|
|
Token->String == TEXT("lineadj") ||
|
2015-10-28 19:18:20 -04:00
|
|
|
Token->String == TEXT("AdjacentTriangle") || // PSSL
|
2014-11-04 14:12:02 -05:00
|
|
|
Token->String == TEXT("triangleadj"))
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.Advance();
|
2014-11-04 14:12:02 -05:00
|
|
|
++PrimitiveFound;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
|
2014-11-07 09:45:40 -05:00
|
|
|
while (Scanner.HasMoreTokens())
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
bool bFound = false;
|
2015-03-04 17:00:58 -05:00
|
|
|
auto* Token = Scanner.GetCurrentToken();
|
|
|
|
|
if ((DeclarationFlags & EDF_STATIC) && Scanner.MatchToken(EHlslToken::Static))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
++StaticFound;
|
2014-12-11 15:49:40 -05:00
|
|
|
Qualifier->bIsStatic = true;
|
2014-11-03 11:36:09 -05:00
|
|
|
if (StaticFound > 1)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("'static' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if ((DeclarationFlags & EDF_SHARED) && Scanner.MatchToken(EHlslToken::GroupShared))
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
|
|
|
|
++SharedFound;
|
2014-12-11 15:49:40 -05:00
|
|
|
Qualifier->bShared = true;
|
2014-11-04 14:12:02 -05:00
|
|
|
if (SharedFound > 1)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("'groupshared' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
2014-11-04 14:12:02 -05:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if ((DeclarationFlags & EDF_CONST_ROW_MAJOR) && Scanner.MatchToken(EHlslToken::Const))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
++ConstFound;
|
2014-12-11 15:49:40 -05:00
|
|
|
Qualifier->bConstant = true;
|
2014-11-03 11:36:09 -05:00
|
|
|
if (ConstFound > 1)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("'const' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if ((DeclarationFlags & EDF_CONST_ROW_MAJOR) && Scanner.MatchToken(EHlslToken::RowMajor))
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
|
|
|
|
++RowMajorFound;
|
2014-12-11 15:49:40 -05:00
|
|
|
Qualifier->bRowMajor = true;
|
2014-11-04 14:12:02 -05:00
|
|
|
if (RowMajorFound > 1)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("'row_major' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
2014-11-04 14:12:02 -05:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if ((DeclarationFlags & EDF_IN_OUT) && Scanner.MatchToken(EHlslToken::In))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
++InFound;
|
2014-12-11 15:49:40 -05:00
|
|
|
Qualifier->bIn = true;
|
2014-11-03 11:36:09 -05:00
|
|
|
if (InFound > 1)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("'in' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else if (InOutFound > 0)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'in' can't be used with 'inout'!\n"));
|
|
|
|
|
return EParseResult::Error;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if ((DeclarationFlags & EDF_IN_OUT) && Scanner.MatchToken(EHlslToken::Out))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
++OutFound;
|
2014-12-11 15:49:40 -05:00
|
|
|
Qualifier->bOut = true;
|
2014-11-03 11:36:09 -05:00
|
|
|
if (OutFound > 1)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("'out' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else if (InOutFound > 0)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'out' can't be used with 'inout'!\n"));
|
|
|
|
|
return EParseResult::Error;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if ((DeclarationFlags & EDF_IN_OUT) && Scanner.MatchToken(EHlslToken::InOut))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
++InOutFound;
|
2014-12-11 15:49:40 -05:00
|
|
|
Qualifier->bIn = true;
|
|
|
|
|
Qualifier->bOut = true;
|
2014-11-03 11:36:09 -05:00
|
|
|
if (InOutFound > 1)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("'inout' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else if (InFound > 0 || OutFound > 0)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'inout' can't be used with 'in' or 'out'!\n"));
|
|
|
|
|
return EParseResult::Error;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if ((DeclarationFlags & EDF_UNIFORM) && Scanner.MatchToken(EHlslToken::Uniform))
|
2015-02-23 09:53:19 -05:00
|
|
|
{
|
|
|
|
|
++UniformFound;
|
|
|
|
|
Qualifier->bUniform = true;
|
|
|
|
|
if (UniformFound > 1)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'uniform' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if ((DeclarationFlags & EDF_INTERPOLATION) && Token->Token == EHlslToken::Identifier)
|
|
|
|
|
{
|
|
|
|
|
if (Token->String == TEXT("linear"))
|
|
|
|
|
{
|
|
|
|
|
Scanner.Advance();
|
|
|
|
|
++InterpolationLinearFound;
|
|
|
|
|
Qualifier->bLinear = true;
|
|
|
|
|
if (InterpolationLinearFound > 1)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'linear' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Token->String == TEXT("centroid"))
|
|
|
|
|
{
|
|
|
|
|
Scanner.Advance();
|
|
|
|
|
++InterpolationCentroidFound;
|
|
|
|
|
Qualifier->bCentroid = true;
|
|
|
|
|
if (InterpolationCentroidFound > 1)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'centroid' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Token->String == TEXT("nointerpolation"))
|
|
|
|
|
{
|
|
|
|
|
Scanner.Advance();
|
|
|
|
|
++InterpolationNoInterpolationFound;
|
|
|
|
|
Qualifier->bNoInterpolation = true;
|
|
|
|
|
if (InterpolationNoInterpolationFound > 1)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'nointerpolation' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-10-28 19:18:20 -04:00
|
|
|
else if (Token->String == TEXT("noperspective") || Token->String == TEXT("nopersp")) // PSSL nopersp
|
2015-03-04 17:00:58 -05:00
|
|
|
{
|
|
|
|
|
Scanner.Advance();
|
|
|
|
|
++InterpolationNoPerspectiveFound;
|
|
|
|
|
Qualifier->bNoPerspective = true;
|
|
|
|
|
if (InterpolationNoPerspectiveFound > 1)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'noperspective' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Token->String == TEXT("sample"))
|
|
|
|
|
{
|
|
|
|
|
Scanner.Advance();
|
|
|
|
|
++InterpolationSampleFound;
|
|
|
|
|
Qualifier->bSample = true;
|
|
|
|
|
if (InterpolationSampleFound > 1)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'sample' found more than once!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
int32 InterpolationFound = InterpolationLinearFound + InterpolationCentroidFound + InterpolationNoInterpolationFound + InterpolationNoPerspectiveFound + InterpolationSampleFound;
|
|
|
|
|
if (InterpolationFound)
|
|
|
|
|
{
|
|
|
|
|
if (InterpolationLinearFound && InterpolationNoInterpolationFound)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Can't have both 'linear' and 'nointerpolation'!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (InterpolationCentroidFound && !(InterpolationLinearFound || InterpolationNoPerspectiveFound))
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'centroid' must be used with either 'linear' or 'noperspective'!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (UniformFound && (OutFound || InOutFound || PrimitiveFound || SharedFound || InterpolationFound))
|
2015-02-23 09:53:19 -05:00
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("'uniform' can not be used with other storage qualifiers (inout, out, nointerpolation, etc)!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-07 09:45:40 -05:00
|
|
|
bOutPrimitiveFound = (PrimitiveFound > 0);
|
2014-11-04 14:12:02 -05:00
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
return (ConstFound + RowMajorFound + InFound + OutFound + InOutFound + StaticFound + SharedFound + PrimitiveFound + InterpolationFound + UniformFound)
|
2014-11-07 09:45:40 -05:00
|
|
|
? EParseResult::Matched
|
|
|
|
|
: EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
EParseResult ParseGeneralDeclarationNoSemicolon(FHlslScanner& Scanner, FSymbolScope* SymbolScope, int32 TypeFlags, int32 DeclarationFlags, FLinearAllocator* Allocator, AST::FDeclaratorList** OutDeclaratorList)
|
2014-11-07 09:45:40 -05:00
|
|
|
{
|
|
|
|
|
auto OriginalToken = Scanner.GetCurrentTokenIndex();
|
|
|
|
|
bool bPrimitiveFound = false;
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* FullType = new(Allocator) AST::FFullySpecifiedType(Allocator, Scanner.GetCurrentToken()->SourceInfo);
|
2015-03-04 17:00:58 -05:00
|
|
|
auto ParseResult = ParseDeclarationStorageQualifiers(Scanner, TypeFlags, DeclarationFlags, bPrimitiveFound, &FullType->Qualifier);
|
2015-02-19 12:13:52 -05:00
|
|
|
if (ParseResult == EParseResult::Error)
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2015-02-19 12:13:52 -05:00
|
|
|
bool bCanBeUnmatched = (ParseResult == EParseResult::NotMatched);
|
2014-11-07 09:45:40 -05:00
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* DeclaratorList = new(Allocator) AST::FDeclaratorList(Allocator, FullType->SourceInfo);
|
|
|
|
|
DeclaratorList->Type = FullType;
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
if (!bPrimitiveFound && (DeclarationFlags & EDF_PRIMITIVE_DATA_TYPE))
|
2014-11-07 09:45:40 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
const auto* StreamToken = Scanner.GetCurrentToken();
|
2015-03-04 17:00:58 -05:00
|
|
|
if (StreamToken)
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2015-03-04 17:00:58 -05:00
|
|
|
if (StreamToken->Token == EHlslToken::Identifier)
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2015-03-04 17:00:58 -05:00
|
|
|
if (StreamToken->String == TEXT("PointStream") ||
|
2015-10-28 19:18:20 -04:00
|
|
|
StreamToken->String == TEXT("PointBuffer") || // PSSL
|
2015-03-04 17:00:58 -05:00
|
|
|
StreamToken->String == TEXT("LineStream") ||
|
2015-10-28 19:18:20 -04:00
|
|
|
StreamToken->String == TEXT("LineBuffer") || // PSSL
|
2015-03-04 17:00:58 -05:00
|
|
|
StreamToken->String == TEXT("TriangleStream") ||
|
2015-10-28 19:18:20 -04:00
|
|
|
StreamToken->String == TEXT("TriangleBuffer") || // PSSL
|
2015-03-04 17:00:58 -05:00
|
|
|
StreamToken->String == TEXT("InputPatch") ||
|
|
|
|
|
StreamToken->String == TEXT("OutputPatch"))
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2015-03-04 17:00:58 -05:00
|
|
|
Scanner.Advance();
|
|
|
|
|
bCanBeUnmatched = false;
|
|
|
|
|
|
|
|
|
|
if (!Scanner.MatchToken(EHlslToken::Lower))
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected '<'!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AST::FTypeSpecifier* TypeSpecifier = nullptr;
|
|
|
|
|
if (ParseGeneralType(Scanner, ETF_BUILTIN_NUMERIC | ETF_USER_TYPES, SymbolScope, Allocator, &TypeSpecifier) != EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected type!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StreamToken->String == TEXT("InputPatch") || StreamToken->String == TEXT("OutputPatch"))
|
|
|
|
|
{
|
|
|
|
|
if (!Scanner.MatchToken(EHlslToken::Comma))
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected ','!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//@todo-rco: Save this value!
|
|
|
|
|
auto* Elements = Scanner.GetCurrentToken();
|
|
|
|
|
if (!Scanner.MatchToken(EHlslToken::UnsignedIntegerConstant))
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected number!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TypeSpecifier->TextureMSNumSamples = Elements->UnsignedInteger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Scanner.MatchToken(EHlslToken::Greater))
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected '>'!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto* IdentifierToken = Scanner.GetCurrentToken();
|
|
|
|
|
if (!Scanner.MatchToken(EHlslToken::Identifier))
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Expected identifier!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TypeSpecifier->InnerType = TypeSpecifier->TypeName;
|
|
|
|
|
TypeSpecifier->TypeName = Allocator->Strdup(StreamToken->String);
|
|
|
|
|
FullType->Specifier = TypeSpecifier;
|
|
|
|
|
|
|
|
|
|
auto* Declaration = new(Allocator)AST::FDeclaration(Allocator, IdentifierToken->SourceInfo);
|
|
|
|
|
Declaration->Identifier = Allocator->Strdup(IdentifierToken->String);
|
|
|
|
|
|
|
|
|
|
DeclaratorList->Declarations.Add(Declaration);
|
|
|
|
|
*OutDeclaratorList = DeclaratorList;
|
|
|
|
|
return EParseResult::Matched;
|
2014-11-04 14:12:02 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
if (DeclarationFlags & EDF_TEXTURE_SAMPLER_OR_BUFFER)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = ParseTextureOrBufferSimpleDeclaration(Scanner, SymbolScope, (DeclarationFlags & EDF_MULTIPLE) == EDF_MULTIPLE, Allocator, &DeclaratorList);
|
2014-12-11 15:49:40 -05:00
|
|
|
if (Result == EParseResult::Matched)
|
2014-11-07 09:45:40 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutDeclaratorList = DeclaratorList;
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
2014-11-07 09:45:40 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
const bool bAllowInitializerList = (DeclarationFlags & EDF_INITIALIZER_LIST) == EDF_INITIALIZER_LIST;
|
2014-12-11 15:49:40 -05:00
|
|
|
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Scanner.MatchToken(EHlslToken::Struct))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto Result = ParseStructBody(Scanner, SymbolScope, Allocator, &FullType->Specifier);
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Result != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2014-11-07 09:45:40 -05:00
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
do
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* IdentifierToken = Scanner.GetCurrentToken();
|
|
|
|
|
if (Scanner.MatchToken(EHlslToken::Identifier))
|
2014-11-07 09:45:40 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
//... Instance
|
|
|
|
|
|
|
|
|
|
auto* Declaration = new(Allocator) AST::FDeclaration(Allocator, IdentifierToken->SourceInfo);
|
|
|
|
|
Declaration->Identifier = Allocator->Strdup(IdentifierToken->String);
|
|
|
|
|
|
|
|
|
|
if (ParseDeclarationMultiArrayBracketsAndIndex(Scanner, SymbolScope, false, Allocator, Declaration) == EParseResult::Error)
|
2014-11-07 09:45:40 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
if (DeclarationFlags & EDF_INITIALIZER)
|
2014-12-11 15:49:40 -05:00
|
|
|
{
|
|
|
|
|
if (Scanner.MatchToken(EHlslToken::Equal))
|
2014-11-07 09:45:40 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
if (ParseInitializer(Scanner, SymbolScope, bAllowInitializerList, Allocator, &Declaration->Initializer) != EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Invalid initializer\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2014-11-07 09:45:40 -05:00
|
|
|
}
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
|
|
|
|
|
DeclaratorList->Declarations.Add(Declaration);
|
2014-11-07 09:45:40 -05:00
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
while ((DeclarationFlags & EDF_MULTIPLE) == EDF_MULTIPLE && Scanner.MatchToken(EHlslToken::Comma));
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutDeclaratorList = DeclaratorList;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
2014-11-07 09:45:40 -05:00
|
|
|
else
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto Result = ParseGeneralType(Scanner, ETF_BUILTIN_NUMERIC | ETF_USER_TYPES, SymbolScope, Allocator, &FullType->Specifier);
|
2014-11-04 14:12:02 -05:00
|
|
|
if (Result == EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
bool bMatched = false;
|
|
|
|
|
do
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* IdentifierToken = Scanner.GetCurrentToken();
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3231693)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3219796 on 2016/12/02 by Rolando.Caloca
DR - vk - Increase timeout to 60ms
Change 3219884 on 2016/12/02 by Daniel.Wright
Assert to help track down rare crash locking capsule indirect shadow vertex buffer
Change 3219885 on 2016/12/02 by Daniel.Wright
Fixed saving a package that doesn't exist on disk but exists in p4 at a newer revision when the user chooses 'Mark Writable'
Change 3219886 on 2016/12/02 by Daniel.Wright
Don't create projected shadows when r.ShadowQuality is 0
* Fixes crash in the forward path trying to render shadows
* In the deferred path, the shadowmap was still being rendered and only the projection skipped, now all cost will be skipped
Change 3219887 on 2016/12/02 by Daniel.Wright
Changed ClearRenderTarget2D default alpha to 1, which is necessary for correct compositing
Change 3219893 on 2016/12/02 by Daniel.Wright
AMD AGS library with approved TPS
Disabled DFAO on AMD pre-GCN PC video cards to workaround a driver bug which won't be fixed (Radeon 6xxx and below)
Change 3219913 on 2016/12/02 by Daniel.Wright
Level unload of a lighting scenario propagates the lighting scenario change - fixes crash when precomputed lighting volume data gets unloaded
Change 3220029 on 2016/12/02 by Daniel.Wright
Async shader compiling now recreates scene proxies which are affected by the material which was compiled. This fixes crashes which were occuring as proxies cache various material properties, but applying compiled materials would not update these cached properties (bRequiresAdjacencyInformation).
* A new ensure has been added in FMeshElementCollector::AddMesh and FBatchingSPDI::DrawMesh to catch attempts to render with a material not reported in GetUsedMaterials
* Fixed UParticleSystemComponent::GetUsedMaterials and UMaterialBillboardComponent::GetUsedMaterials
* FMaterialUpdateContext should be changed to use the same pattern, but that hasn't been done yet
Change 3220108 on 2016/12/02 by Daniel.Wright
Fixed shadowmap channel assignment for stationary lights which are not in a lighting scenario level, when a lighting scenario level is present
Change 3220504 on 2016/12/03 by Mark.Satterthwaite
Metal Desktop Tessellation support from Unicorn.
- Apple: Metal tessellation support added to MetalShaderFormat, MetalRHI and incl. changes to engine runtime/shaders for Desktop renderer and enabled in ElementalDemo by default (OS X 10.11 will run SM4).
- Epic: Support for different Metal shader standards on Mac, iOS & tvOS which required moving some RHI functions around as this is a project setting and not a compile-time constant.
- Epic: Fragment shader UAV support, which is also tied to newer Metal shader standard like Tessellation.
- Epic: Significant refactor of MetalRHI's internals to clearly separate state-caching from render-pass management and command-encoding.
- Epic: Internal MetalRHI validation code is now cleanly separated out into custom implementations of the Metal @protocol's and is on by default.
- Epic: Various fixes to Layered Rendering for Metal.
- Omits Mobile Tessellation support which needs further revision.
Change 3220881 on 2016/12/04 by Mark.Satterthwaite
Compiles fixes for iOS & static analysis fixes from Windows.
Change 3221180 on 2016/12/05 by Guillaume.Abadie
Avoid compiling PreviousFrameSwitch's both Current Frame and Previous Frame inputs every time.
Change 3221217 on 2016/12/05 by Chris.Bunner
More NVAPI warning fixups.
Change 3221219 on 2016/12/05 by Chris.Bunner
When comparing overriden properties used to force instance recompilation we need to check against the base material, not assume the immediate parent.
#jira UE-37792
Change 3221220 on 2016/12/05 by Chris.Bunner
Exported GetAllStaticSwitchParamNames and GetAllStaticComponentMaskParamNames.
#jira UE-35132
Change 3221221 on 2016/12/05 by Chris.Bunner
PR #2785: Fix comment typo in RendererInterface.h (Contributed by dustin-biser)
#jira UE-35760
Change 3221223 on 2016/12/05 by Chris.Bunner
Default to include dev-code when compiling material preview stats.
#jira UE-20321
Change 3221534 on 2016/12/05 by Rolando.Caloca
DR - Added FDynamicRHI::GetName()
Change 3221833 on 2016/12/05 by Chris.Bunner
Set correct output extent on PostProcessUpscale (allows users to extend chain correctly).
#jira UE-36989
Change 3221852 on 2016/12/05 by Chris.Bunner
32-bit/ch EXR screenshot and frame dump output.
Fixed row increment bug in 128-bit/px surface format readback.
#jira UE-37962
Change 3222059 on 2016/12/05 by Rolando.Caloca
DR - vk - Fix memory type not found
Change 3222104 on 2016/12/05 by Rolando.Caloca
DR - Lambdaize
- Added quicker method to check if system textures are initialized
Change 3222290 on 2016/12/05 by Mark.Satterthwaite
Trivial fixes to reporting Metal shader pipeline errors - need to check if Hull & Domain exist.
Change 3222864 on 2016/12/06 by Rolando.Caloca
DR - Fix mem leak when exiting
Change 3222873 on 2016/12/06 by Rolando.Caloca
DR - vk - Minor info to help track down leaks
Change 3222875 on 2016/12/06 by Rolando.Caloca
DR - Fix mem leak with VisualizeTexture
#jira UE-39360
Change 3223226 on 2016/12/06 by Chris.Bunner
Static analysis warning workaround.
Change 3223235 on 2016/12/06 by Ben.Woodhouse
Integrate from NREAL: Set a custom projection matrix on a SceneCapture2D
Change 3223343 on 2016/12/06 by Chris.Bunner
Moved HLOD persistent data to viewstate to fix per-view compatability.
#jira UE-37539
Change 3223349 on 2016/12/06 by Chris.Bunner
Fixed HLOD with FreezeRendering command.
#jira UE-29839
Change 3223371 on 2016/12/06 by Michael.Trepka
Removed obsolete check() in FMetalSurface constructor
Change 3223450 on 2016/12/06 by Chris.Bunner
Added explicit ScRGB output device selection rather than Nvidia-only hardcoded checks. Allows easier support for Mac and other devices moving forward.
Change 3223638 on 2016/12/06 by Michael.Trepka
Restored part of the check() in FMetalSurface constructor removed in CL 3223371
Change 3223642 on 2016/12/06 by Mark.Satterthwaite
Experimental Metal EDR/HDR output support for Mac (iOS/tvOS need custom formats & shaders so they are not supported yet).
- Only available on macOS Sierra (10.12) for Macs with HDR displays (e.g. Retina iMacs).
- Enable with -metaledr command-line argument as it is off-by-default.
- Sets up the CAMetalLayer & the back-buffer for RGBA_FP16 output on Mac using DCI-P3 as the color gamut and ACES 1000 nit ScRGB output encoding.
Change 3223830 on 2016/12/06 by Rolando.Caloca
DR - vk - Better error when finding an invalid Vulkan driver
#jira UE-37495
Change 3223869 on 2016/12/06 by Rolando.Caloca
DR - vk - Reuse fences
Change 3223906 on 2016/12/06 by Guillaume.Abadie
Fix alpha through TempAA artifact causing a small darker edge layouts.
Change 3224199 on 2016/12/06 by Mark.Satterthwaite
Fix a dumb copy-paste error from the HDR changes to Metal.
Change 3224220 on 2016/12/06 by Mark.Satterthwaite
Fix various errors with Metal UAV & Render-Pass Restart support so that we can use the Pixel Shader culling for DistanceField effects.
- Unfortunately Metal requires that a texture be bound to start a render-pass, so reuse the dummy depth-stencil surface from the problematic editor preview tile rendering.
Change 3224236 on 2016/12/06 by Mark.Satterthwaite
IWYU CIS compile fix for iOS.
Change 3224366 on 2016/12/06 by Mark.Satterthwaite
Simplify some of the changes from CL# 3224220 so that we don't perform unnecessary clears.
- If the RenderPass is broken to issue compute or blit operations then treat the cached RenderTargetsInfo as invalid, unless the RenderPass is restarted.
- This guarantees that we don't erroneously ignore calls to SetRenderTargets if the calling code issues a dispatch between two RenderPasses that use the same RenderTargetsInfo.
Change 3224416 on 2016/12/06 by Uriel.Doyon
New default implementation for UPrimitiveComponent::GetStreamingTextureInfo using a conservative heuristic where the textures are stretched across the bounds.
Optimized UPrimitiveComponent::GetStreamingTextureInfoWithNULLRemoval by not handling registered components with no proxy (essentially hidden game / collision primitives).
Added blueprint support for texture streaming built data through FStaticMeshComponentInstanceData.
Fix for material texture streaming data not being available on some cooked builds.
Enabled split requests on all texture load requests (first loading everything visible and then loaded everything not visible).
This is controlled by "r.Streaming.MinMipForSplitRequest" which defines the minimum mip for which to allow splitting.
Forced residency are now loaded in two steps (visible, then forced), improving reactiveness.
Updated "stat streaming" to include "UnkownRefMips" which represent texture with no known component referencing them,
and also "LastRenderTimeMips" which related to timed primitives.
Changed "Forced Mips" so that it only shows mips that are loaded become of forced residency.
"Texture Streaming Build" now updates the map check after execution.
Removed Orphaned texture logic as this has become irrelevant with the latest retention priority logic.
Updated "r.streaming.usenewmetrics" so that it shows behavior before and after 4.12 improvements.
Change 3224532 on 2016/12/07 by Uriel.Doyon
Integrated CL 3223965 :
Building texture streaming data for materials does not wait for pending shaders to finish compilation anymore.
Added more options to allow the user to cancel this build also.
Change 3224714 on 2016/12/07 by Ben.Woodhouse
Cherry pick CL 3223972 from //fortnite/main:
Disable Geometry shader onchip on XB1. This saves 4ms for a single shadow casting point light @ 512x512 (4.8ms to 1.8ms)
Change 3224715 on 2016/12/07 by Ben.Woodhouse
New version of d3dx12.h from Microsoft which incorporates my suggested static analysis fixes. This avoids us diverging from the official version
Change 3224975 on 2016/12/07 by Rolando.Caloca
DR - vk - Dump improvements
Change 3225012 on 2016/12/07 by Rolando.Caloca
DR - Show warning if trying to use num samples != (1,2,4,8,16)
Change 3225126 on 2016/12/07 by Chris.Bunner
Added 'force 128-bit rendering pipeline' to high-res screenshot tool.
#jira UE-39345
Change 3225449 on 2016/12/07 by Chris.Bunner
Updated engine rendering defaults to better match current best practices.
#jira UE-38081
Change 3225485 on 2016/12/07 by Chris.Bunner
Moved QuantizeSceneBufferSize to RenderCore and added call for PostProcess settings. Fixes screenpercentage out-of-bounds reads in some cases.
#jira UE-19394
Change 3225486 on 2016/12/07 by Chris.Bunner
Only disable TAA during HighResScreenshots if we don't have a reasonable frame-delay enabled.
Change 3225505 on 2016/12/07 by Daniel.Wright
Fixed exponential height fog disappearing with no skybox
Change 3225655 on 2016/12/07 by Benjamin.Hyder
Updating TM-Shadermodels to include Translucent lighting, Two sided, updated cloth animation, and adjusted lighting.
Change 3225668 on 2016/12/07 by Chris.Bunner
Dirty owning packages when user manually forces regeneration of all reflection captures.
#jira UE-38759
Change 3226139 on 2016/12/07 by Rolando.Caloca
DR - Fix recompute tangents disabling skin cache
- Make some macros into lambdas
#jira UE-39143
Change 3226212 on 2016/12/07 by Daniel.Wright
Features which require a full prepass use DDM_AllOpaque instead of DDM_AllOccluders, which can be skipped if the component has bUseAsOccluder=false
Change 3226213 on 2016/12/07 by Daniel.Wright
Scene Capture 2D can specify a global clip plane, which is useful for portals
* Requires the global clip plane project setting to be enabled
Change 3226214 on 2016/12/07 by Daniel.Wright
Improved deferred shadowing with MSAA by upsampling light attenuation intelligently in the base pass
* If the current fragment's depth doesn't match what was used for deferred shadowing, the neighbor (cross pattern) with the nearest depth's shadowing is used
* Edge artifacts can still occur where the upsample fails or the shadow factor was computed per-sample due to depth / stencil testing
* Indirect Occlusion from capsule shadows also uses the nearest depth neighbor UV for no extra cost
* Base pass on 970 GTX 1.69ms -> 1.85ms (.16ms) in RoboRecall
Change 3226258 on 2016/12/07 by Rolando.Caloca
DR - Typo fix
Change 3226259 on 2016/12/07 by Rolando.Caloca
DR - compile fix
#jira UE-39143
Change 3226932 on 2016/12/08 by Chris.Bunner
Re-saved Infiltrator maps to update reflection captures.
#jira UE-38759
Change 3227063 on 2016/12/08 by Mark.Satterthwaite
For Metal platforms ONLY temporarily disable USE_LIGHT_GRID_REFLECTION_CAPTURE_CULLING to avoid UE-37436 while the Nvidia driver team investigate why this doesn't work for them but does for the others. This won't affect non-Metal platforms and the intent is to revert this prior to 4.16 provided we can work through the problem with Nvidia.
#jira UE-37436
Change 3227120 on 2016/12/08 by Gil.Gribb
Merging //UE4/Dev-Main@3226895 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3227211 on 2016/12/08 by Arne.Schober
DR - UE-38585 - Fixing crash where HierInstStaticMesh duplication fails. Also reverting the fix from UE-28189 which is redundant.
Change 3227257 on 2016/12/08 by Marc.Olano
Extension to PseudoVolumeTexture for more flexible layout
Change by ryan.brucks
Change 3227286 on 2016/12/08 by Rolando.Caloca
DR - Fix crash when using custom expressions and using reserved keywords
#jira UE-39311
Change 3227376 on 2016/12/08 by Mark.Satterthwaite
Must not include a private header inside the MenuStack public header as that causes compile errors in plugins.
Change 3227415 on 2016/12/08 by Mark.Satterthwaite
Fix shader compilation due to my disabling of USE_LIGHT_GRID_REFLECTION_CAPTURE_CULLING on Metal - InstancedCompositeTileReflectionCaptureIndices needs to be defined even though Metal doesn't support instanced-stereo rendering.
Change 3227516 on 2016/12/08 by Daniel.Wright
Implemented UWidgetComponent::GetUsedMaterials
Change 3227521 on 2016/12/08 by Guillaume.Abadie
Fixes post process volume's indirect lighting color.
#jira UE-38888
Change 3227567 on 2016/12/08 by Marc.Olano
New upscale filters: Lanczos-2 (new default), Lanczos-3 and Gaussian Unsharp Mask
Change 3227628 on 2016/12/08 by Daniel.Wright
Removed redundant ResolveSceneDepthTexture from the merge
Change 3227635 on 2016/12/08 by Daniel.Wright
Forward renderer supports shadowing from movable lights and light functions
* Only 4 shadow casting movable or stationary lights can overlap at any point in space, otherwise the movable lights will lose their shadows and an on-screen message will be displayed
* Light functions only work on shadow casting lights since they need a shadowmap channel to be assigned
Change 3227660 on 2016/12/08 by Rolando.Caloca
DR - vk - Fix r.MobileMSAA on Vulkan
- r.MobileMSAA is now read-only (to be fixed on 4.16)
- Show time for PSO creation hitches
#jira UE-39184
Change 3227704 on 2016/12/08 by Mark.Satterthwaite
Fix Mac HDR causing incorrect output color encoding being used, HDR support is now entirely off unless you pass -metaledr which will enable it regardless of whether the current display supports HDR (as we haven't written the detection code yet). Fixed the LUT/UI compositing along the way - Mac Metal wasn't using volume LUT as it should have been, RHISupportsVertexShaderLayer now correctly returns false for non-Mac Metal platforms.
Change 3227705 on 2016/12/08 by Daniel.Wright
Replaced built-in samplers in the nearest depth translucency upsample because the built-in samplers are no longer bound on PC (cl 2852426)
Change 3227787 on 2016/12/08 by Chris.Bunner
Added extent clear to motion blur pass to catch misized buffers bringing in errors.
Added early out to clear call when excluded region matches RT region.
#jira UE-39437
Change 3228177 on 2016/12/08 by Marc.Olano
Fix DCC sqrt(int) error
Change 3228285 on 2016/12/08 by Chris.Bunner
Back out changelist 3225449.
#jira UE-39528
Change 3228680 on 2016/12/09 by Gil.Gribb
Merging //UE4/Dev-Main@3228528 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3228940 on 2016/12/09 by Mark.Satterthwaite
Editor fixes for 4.15:
- PostProcessTonemap can't fail to bind a texture to the ColorLUT or the subsequent rendering will be garbage: the changes for optimising stereo rendering forgot to account for the Editor's use of Views without States for the asset preview thumbnails. Amended the CombineLUT post-processing to allocate a local output texture when there's no ViewState and read from this when this situation arises which makes everything function again.
- Don't start render-passes without a valid render-target-array in MetalRHI.
Change 3228950 on 2016/12/09 by Mark.Satterthwaite
Make GPUSkinCache run on Mac Metal - it wasn't working because it was forcibly disabled on all platforms but for Windows D3D 11.
- Fixed the Skeleton editor tree trying to access a widget before it has been constructed.
- Enable GPUSkinCache for Metal SM5: doesn't render correctly, even on AMD, so needs Radar's filing and investigation.
#jira UE-39256
Change 3229013 on 2016/12/09 by Mark.Satterthwaite
Further tidy up in SSkeletonTreeView as suggested by Nick.A.
Change 3229101 on 2016/12/09 by Chris.Bunner
Log compile error fix and updated cvar comments.
Change 3229236 on 2016/12/09 by Ben.Woodhouse
XB1 D3D11 and D3D12: Use the DXGI frame statistics to get accurate GPU time unaffected by bubbles
Change 3229430 on 2016/12/09 by Ben.Woodhouse
PR #2680: Optimized histogram generation. (Contributed by PjotrSvetachov)
Profiled on nvidia 980GTX (2x faster), and on XB1 (marginally faster)
Change 3229580 on 2016/12/09 by Marcus.Wassmer
DepthBoundsTest for AMD.
Change 3229701 on 2016/12/09 by Michael.Trepka
Changed "OS X" to "macOS" in few places where we display it and updated the code that asks users to update to latest version to check for 10.12.2
Change 3229706 on 2016/12/09 by Chris.Bunner
Added GameUserSettings controls for HDR display output.
Removed Metal commandline as this should replace the need for it.
Change 3229774 on 2016/12/09 by Michael.Trepka
Disabled OpenGL on Mac. -opengl is now ignored, we always use Metal. On old Macs that do not support Metal we show a message saying that the app requires Metal and exit.
Change 3229819 on 2016/12/09 by Chris.Bunner
Updated engine rendering defaults to better match current best practices.
#jira UE-38081
Change 3229948 on 2016/12/09 by Rolando.Caloca
DR - Fix d3d debug error
#jira UE-39589
Change 3230341 on 2016/12/11 by Mark.Satterthwaite
Don't fatally assert that the game-thread stalled waiting for the rendering thread in the Editor executable, even when running -game as the rendering thread can take a while to respond if shaders need to be compiled.
#jira UE-39613
Change 3230860 on 2016/12/12 by Marcus.Wassmer
Experimental Nvidia AFR support.
Change 3230930 on 2016/12/12 by Mark.Satterthwaite
Disable RHICmdList state-caching on Mac - Metal already does this internally and depends on receiving all state changes in order to function.
Change 3231252 on 2016/12/12 by Marcus.Wassmer
Fix NumGPU detection. (SLI only crash)
Change 3231486 on 2016/12/12 by Mark.Satterthwaite
Fix a stupid mistake in MetalStateCache::CommitResourceTable that would unnecessarily rebind samplers.
Change 3231661 on 2016/12/12 by Mark.Satterthwaite
Retain the RHI samplers in MetalRHI to guarantee lifetime.
[CL 3231696 by Gil Gribb in Main branch]
2016-12-12 17:47:42 -05:00
|
|
|
if (Scanner.MatchToken(EHlslToken::Texture) || Scanner.MatchToken(EHlslToken::Sampler) || Scanner.MatchToken(EHlslToken::Buffer))
|
|
|
|
|
{
|
|
|
|
|
// Continue, handles the case of 'float3 Texture'...
|
|
|
|
|
}
|
|
|
|
|
else if (!Scanner.MatchToken(EHlslToken::Identifier))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SetCurrentTokenIndex(OriginalToken);
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Declaration = new(Allocator) AST::FDeclaration(Allocator, IdentifierToken->SourceInfo);
|
|
|
|
|
Declaration->Identifier = Allocator->Strdup(IdentifierToken->String);
|
|
|
|
|
//AddVar
|
|
|
|
|
|
|
|
|
|
if (ParseDeclarationMultiArrayBracketsAndIndex(Scanner, SymbolScope, false, Allocator, Declaration) == EParseResult::Error)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-04 14:12:02 -05:00
|
|
|
bool bSemanticFound = false;
|
2015-03-04 17:00:58 -05:00
|
|
|
if (DeclarationFlags & EDF_SEMANTIC)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Scanner.MatchToken(EHlslToken::Colon))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Semantic = Scanner.GetCurrentToken();
|
2014-11-07 09:45:40 -05:00
|
|
|
if (!Scanner.MatchToken(EHlslToken::Identifier))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Expected identifier for semantic!"));
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2014-11-04 14:12:02 -05:00
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
Declaration->Semantic = Allocator->Strdup(Semantic->String);
|
2014-11-04 14:12:02 -05:00
|
|
|
bSemanticFound = true;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
2014-11-04 14:12:02 -05:00
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
if ((DeclarationFlags & EDF_INITIALIZER) && !bSemanticFound)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Scanner.MatchToken(EHlslToken::Equal))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
if (ParseInitializer(Scanner, SymbolScope, bAllowInitializerList, Allocator, &Declaration->Initializer) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Invalid initializer\n"));
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
|
|
|
|
|
DeclaratorList->Declarations.Add(Declaration);
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
while ((DeclarationFlags & EDF_MULTIPLE) == EDF_MULTIPLE && Scanner.MatchToken(EHlslToken::Comma));
|
2014-12-11 15:49:40 -05:00
|
|
|
|
|
|
|
|
*OutDeclaratorList = DeclaratorList;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
2014-11-04 14:12:02 -05:00
|
|
|
else if (bCanBeUnmatched && Result == EParseResult::NotMatched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SetCurrentTokenIndex(OriginalToken);
|
2014-11-04 14:12:02 -05:00
|
|
|
return EParseResult::NotMatched;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-07 09:45:40 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
EParseResult ParseGeneralDeclaration(FHlslScanner& Scanner, FSymbolScope* SymbolScope, FLinearAllocator* Allocator, AST::FDeclaratorList** OutDeclaration, int32 TypeFlags, int32 DeclarationFlags)
|
2014-11-07 09:45:40 -05:00
|
|
|
{
|
|
|
|
|
auto OriginalToken = Scanner.GetCurrentTokenIndex();
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = ParseGeneralDeclarationNoSemicolon(Scanner, SymbolScope, TypeFlags, DeclarationFlags, Allocator, OutDeclaration);
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Result == EParseResult::NotMatched || Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
if (DeclarationFlags & EDF_SEMICOLON)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
if (!Scanner.MatchToken(EHlslToken::Semicolon))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("';' expected!\n"));
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseCBuffer(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutDeclaration)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
const auto* Token = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
if (!Token)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected '{'!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto* CBuffer = new(Allocator) AST::FCBufferDeclaration(Allocator, Token->SourceInfo);
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Identifier))
|
|
|
|
|
{
|
|
|
|
|
CBuffer->Name = Allocator->Strdup(Token->String);
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
bool bFoundRightBrace = false;
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::LeftBrace))
|
|
|
|
|
{
|
|
|
|
|
while (Parser.Scanner.HasMoreTokens())
|
|
|
|
|
{
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::RightBrace))
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
|
|
|
|
{
|
|
|
|
|
// Optional???
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutDeclaration = CBuffer;
|
2014-11-07 09:45:40 -05:00
|
|
|
return EParseResult::Matched;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FDeclaratorList* Declaration = nullptr;
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = ParseGeneralDeclaration(Parser.Scanner, Parser.CurrentScope, Allocator, &Declaration, 0, EDF_CONST_ROW_MAJOR | EDF_SEMICOLON | EDF_TEXTURE_SAMPLER_OR_BUFFER);
|
2014-11-04 14:12:02 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::NotMatched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
CBuffer->Declarations.Add(Declaration);
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected '}'!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseStructBody(FHlslScanner& Scanner, FSymbolScope* SymbolScope, FLinearAllocator* Allocator, AST::FTypeSpecifier** OutTypeSpecifier)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
const auto* Name = Scanner.GetCurrentToken();
|
2015-03-04 17:00:58 -05:00
|
|
|
if (!Name)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2015-03-04 17:00:58 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bAnonymous = true;
|
|
|
|
|
if (Scanner.MatchToken(EHlslToken::Identifier))
|
|
|
|
|
{
|
|
|
|
|
bAnonymous = false;
|
2014-11-07 09:45:40 -05:00
|
|
|
SymbolScope->Add(Name->String);
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
const TCHAR* Parent = nullptr;
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Scanner.MatchToken(EHlslToken::Colon))
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
const auto* ParentToken = Scanner.GetCurrentToken();
|
2014-11-07 09:45:40 -05:00
|
|
|
if (!Scanner.MatchToken(EHlslToken::Identifier))
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Identifier expected!\n"));
|
2014-11-04 14:12:02 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
|
|
|
|
|
Parent = Allocator->Strdup(ParentToken->String);
|
2014-11-04 14:12:02 -05:00
|
|
|
}
|
|
|
|
|
|
2014-11-07 09:45:40 -05:00
|
|
|
if (!Scanner.MatchToken(EHlslToken::LeftBrace))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Expected '{'!"));
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Struct = new(Allocator) AST::FStructSpecifier(Allocator, Name->SourceInfo);
|
|
|
|
|
Struct->ParentName = Allocator->Strdup(Parent);
|
2015-03-04 17:00:58 -05:00
|
|
|
//@todo-rco: Differentiate anonymous!
|
|
|
|
|
Struct->Name = bAnonymous ? nullptr : Allocator->Strdup(Name->String);
|
2014-12-11 15:49:40 -05:00
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
bool bFoundRightBrace = false;
|
2014-11-07 09:45:40 -05:00
|
|
|
while (Scanner.HasMoreTokens())
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
if (Scanner.MatchToken(EHlslToken::RightBrace))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
bFoundRightBrace = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FDeclaratorList* Declaration = nullptr;
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = ParseGeneralDeclaration(Scanner, SymbolScope, Allocator, &Declaration, 0, EDF_CONST_ROW_MAJOR | EDF_SEMICOLON | EDF_SEMANTIC | EDF_TEXTURE_SAMPLER_OR_BUFFER | EDF_INTERPOLATION);
|
2014-11-04 14:12:02 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::NotMatched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
Struct->Declarations.Add(Declaration);
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!bFoundRightBrace)
|
|
|
|
|
{
|
2014-11-07 09:45:40 -05:00
|
|
|
Scanner.SourceError(TEXT("Expected '}'!"));
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* TypeSpecifier = new(Allocator) AST::FTypeSpecifier(Allocator, Struct->SourceInfo);
|
|
|
|
|
TypeSpecifier->Structure = Struct;
|
|
|
|
|
*OutTypeSpecifier = TypeSpecifier;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseFunctionParameterDeclaration(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FFunction* Function)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
bool bStrictCheck = false;
|
|
|
|
|
|
|
|
|
|
while (Parser.Scanner.HasMoreTokens())
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FDeclaratorList* Declaration = nullptr;
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = ParseGeneralDeclaration(Parser.Scanner, Parser.CurrentScope, Allocator, &Declaration, 0, EDF_CONST_ROW_MAJOR | EDF_IN_OUT | EDF_TEXTURE_SAMPLER_OR_BUFFER | EDF_INITIALIZER | EDF_SEMANTIC | EDF_PRIMITIVE_DATA_TYPE | EDF_INTERPOLATION | EDF_UNIFORM);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
|
|
|
|
|
auto* Parameter = AST::FParameterDeclarator::CreateFromDeclaratorList(Declaration, Allocator);
|
|
|
|
|
Function->Parameters.Add(Parameter);
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Comma))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-11-04 14:12:02 -05:00
|
|
|
else if (Result == EParseResult::NotMatched)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Internal error on function parameter!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseFunctionDeclarator(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FFunction** OutFunction)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
auto OriginalToken = Parser.Scanner.GetCurrentTokenIndex();
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FTypeSpecifier* TypeSpecifier = nullptr;
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = ParseGeneralType(Parser.Scanner, ETF_BUILTIN_NUMERIC | ETF_SAMPLER_TEXTURE_BUFFER | ETF_USER_TYPES | ETF_ERROR_IF_NOT_USER_TYPE | ETF_VOID, Parser.CurrentScope, Allocator, &TypeSpecifier);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::NotMatched)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SetCurrentTokenIndex(OriginalToken);
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
2015-03-04 17:00:58 -05:00
|
|
|
else if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
check(Result == EParseResult::Matched);
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Identifier = Parser.Scanner.GetCurrentToken();
|
2014-11-03 11:36:09 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Identifier))
|
|
|
|
|
{
|
|
|
|
|
// This could be an error... But we should allow testing for a global variable before any rash decisions
|
|
|
|
|
Parser.Scanner.SetCurrentTokenIndex(OriginalToken);
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::LeftParenthesis))
|
|
|
|
|
{
|
|
|
|
|
// This could be an error... But we should allow testing for a global variable before any rash decisions
|
|
|
|
|
Parser.Scanner.SetCurrentTokenIndex(OriginalToken);
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Function = new(Allocator) AST::FFunction(Allocator, Identifier->SourceInfo);
|
|
|
|
|
Function->Identifier = Allocator->Strdup(Identifier->String);
|
|
|
|
|
Function->ReturnType = new(Allocator) AST::FFullySpecifiedType(Allocator, TypeSpecifier->SourceInfo);
|
|
|
|
|
Function->ReturnType->Specifier = TypeSpecifier;
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Void))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
// Nothing to do here...
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
else if (Parser.Scanner.MatchToken(EHlslToken::RightParenthesis))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
goto Done;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
Result = ParseFunctionParameterDeclaration(Parser, Allocator, Function);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::RightParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("')' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
Done:
|
|
|
|
|
*OutFunction = Function;
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2015-12-10 21:55:37 -05:00
|
|
|
if (MatchPragma(Parser, Allocator, OutStatement))
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
const auto* Token = Parser.Scanner.PeekToken();
|
|
|
|
|
if (Token && Token->Token == EHlslToken::RightBrace)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
return TryStatementRules(Parser, Allocator, OutStatement);
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseStatementBlock(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
FCreateSymbolScope SymbolScope(Allocator, &Parser.CurrentScope);
|
|
|
|
|
auto* Block = new(Allocator) AST::FCompoundStatement(Allocator, Parser.Scanner.GetCurrentToken()->SourceInfo);
|
2014-11-03 11:36:09 -05:00
|
|
|
while (Parser.Scanner.HasMoreTokens())
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FNode* Statement = nullptr;
|
|
|
|
|
auto Result = ParseStatement(Parser, Allocator, &Statement);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::NotMatched)
|
|
|
|
|
{
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::RightBrace))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutStatement = Block;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Statement expected!"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
|
|
|
|
|
if (Statement)
|
|
|
|
|
{
|
|
|
|
|
Block->Statements.Add(Statement);
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'}' expected!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseFunctionDeclaration(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutFunction)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
const auto* CurrentToken = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
|
|
|
|
|
AST::FFunction* Function = nullptr;
|
|
|
|
|
EParseResult Result = ParseFunctionDeclarator(Parser, Allocator, &Function);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::NotMatched || Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
check(0);
|
2014-11-03 11:36:09 -05:00
|
|
|
// Forward declare
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Optional semantic
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Colon))
|
|
|
|
|
{
|
2015-10-28 19:18:20 -04:00
|
|
|
const auto* Semantic = Parser.Scanner.GetCurrentToken();
|
2014-11-03 11:36:09 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Identifier))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Identifier for semantic expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2015-10-28 19:18:20 -04:00
|
|
|
Function->ReturnSemantic = Allocator->Strdup(Semantic->String);
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::LeftBrace))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'{' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* FunctionDefinition = new(Allocator) AST::FFunctionDefinition(Allocator, CurrentToken->SourceInfo);
|
|
|
|
|
AST::FNode* Body = nullptr;
|
|
|
|
|
Result = ParseStatementBlock(Parser, Allocator, &Body);
|
|
|
|
|
if (Result == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
FunctionDefinition->Body = (AST::FCompoundStatement*)Body;
|
|
|
|
|
FunctionDefinition->Prototype = Function;
|
|
|
|
|
*OutFunction = FunctionDefinition;
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseLocalDeclaration(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutDeclaration)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FDeclaratorList* List = nullptr;
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = ParseGeneralDeclaration(Parser.Scanner, Parser.CurrentScope, Allocator, &List, 0, EDF_CONST_ROW_MAJOR | EDF_INITIALIZER | EDF_INITIALIZER_LIST | EDF_SEMICOLON | EDF_MULTIPLE | EDF_STATIC);
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutDeclaration = List;
|
|
|
|
|
return Result;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseGlobalVariableDeclaration(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutDeclaration)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FDeclaratorList* List = nullptr;
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = ParseGeneralDeclaration(Parser.Scanner, Parser.CurrentScope, Allocator, &List, ETF_USER_TYPES | ETF_ERROR_IF_NOT_USER_TYPE, EDF_CONST_ROW_MAJOR | EDF_STATIC | EDF_SHARED | EDF_TEXTURE_SAMPLER_OR_BUFFER | EDF_INITIALIZER | EDF_INITIALIZER_LIST | EDF_SEMICOLON | EDF_MULTIPLE | EDF_UNIFORM | EDF_INTERPOLATION);
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutDeclaration = List;
|
|
|
|
|
return Result;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseReturnStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Statement = new(Allocator) AST::FJumpStatement(Allocator, AST::EJumpType::Return, Parser.Scanner.GetCurrentToken()->SourceInfo);
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutStatement = Statement;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
if (ParseExpression(Parser.Scanner, Parser.CurrentScope, true, Allocator, &Statement->OptionalExpression) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expression expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("';' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutStatement = Statement;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseDoStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
FCreateSymbolScope SymbolScope(Allocator, &Parser.CurrentScope);
|
|
|
|
|
const auto* Token = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
AST::FNode* Body = nullptr;
|
|
|
|
|
auto Result = ParseStatement(Parser, Allocator, &Body);
|
|
|
|
|
if (Result != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::While))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'while' expected"));
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::LeftParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'(' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FExpression* ConditionExpression = nullptr;
|
|
|
|
|
if (ParseExpression(Parser.Scanner, Parser.CurrentScope, true, Allocator, &ConditionExpression) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expression expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::RightParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("')' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
Parser.Scanner.SourceError(TEXT("';' expected"));
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* DoWhile = new(Allocator) AST::FIterationStatement(Allocator, Token->SourceInfo, AST::EIterationType::DoWhile);
|
|
|
|
|
DoWhile->Condition = ConditionExpression;
|
|
|
|
|
DoWhile->Body = Body;
|
|
|
|
|
*OutStatement = DoWhile;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseWhileStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
FCreateSymbolScope SymbolScope(Allocator, &Parser.CurrentScope);
|
|
|
|
|
const auto* Token = Parser.Scanner.GetCurrentToken();
|
2014-11-03 11:36:09 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::LeftParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'(' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FExpression* ConditionExpression = nullptr;
|
|
|
|
|
if (ParseExpression(Parser.Scanner, Parser.CurrentScope, true, Allocator, &ConditionExpression) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expression expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::RightParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("')' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FNode* Body = nullptr;
|
|
|
|
|
auto Result = ParseStatement(Parser, Allocator, &Body);
|
|
|
|
|
if (Result != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* While = new(Allocator) AST::FIterationStatement(Allocator, Token->SourceInfo, AST::EIterationType::While);
|
|
|
|
|
While->Condition = ConditionExpression;
|
|
|
|
|
While->Body = Body;
|
|
|
|
|
*OutStatement = While;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseForStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
FCreateSymbolScope SymbolScope(Allocator, &Parser.CurrentScope);
|
|
|
|
|
const auto* Token = Parser.Scanner.GetCurrentToken();
|
2014-11-03 11:36:09 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::LeftParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected '('!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FNode* InitExpression = nullptr;
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
// Do nothing...
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
else
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto Result = ParseLocalDeclaration(Parser, Allocator, &InitExpression);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected expression or declaration!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
else if (Result == EParseResult::NotMatched)
|
|
|
|
|
{
|
|
|
|
|
Result = ParseExpressionStatement(Parser, Allocator, &InitExpression);
|
|
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected expression or declaration!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FExpression* ConditionExpression = nullptr;
|
|
|
|
|
auto Result = ParseExpression(Parser.Scanner, Parser.CurrentScope, true, Allocator, &ConditionExpression);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected expression or declaration!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected ';'!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FExpression* RestExpression = nullptr;
|
|
|
|
|
Result = ParseExpression(Parser.Scanner, Parser.CurrentScope, true, Allocator, &RestExpression);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected expression or declaration!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::RightParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expected ')'!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FNode* Body = nullptr;
|
|
|
|
|
Result = ParseStatement(Parser, Allocator, &Body);
|
|
|
|
|
if (Result != EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto* For = new(Allocator) AST::FIterationStatement(Allocator, Token->SourceInfo, AST::EIterationType::For);
|
|
|
|
|
For->InitStatement = InitExpression;
|
|
|
|
|
For->Condition = ConditionExpression;
|
|
|
|
|
For->RestExpression = RestExpression;
|
|
|
|
|
For->Body = Body;
|
|
|
|
|
*OutStatement = For;
|
|
|
|
|
return EParseResult::Matched;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseIfStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
FCreateSymbolScope SymbolScope(Allocator, &Parser.CurrentScope);
|
|
|
|
|
|
|
|
|
|
auto* Statement = new(Allocator) AST::FSelectionStatement(Allocator, Parser.Scanner.GetCurrentToken()->SourceInfo);
|
2014-11-07 09:45:40 -05:00
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::LeftParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'(' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
if (ParseExpression(Parser.Scanner, Parser.CurrentScope, true, Allocator, &Statement->Condition) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expression expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::RightParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("')' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
if (ParseStatement(Parser, Allocator, &Statement->ThenStatement) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Statement expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Else))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
if (ParseStatement(Parser, Allocator, &Statement->ElseStatement) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Statement expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutStatement = Statement;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseAttributeArgList(FHlslScanner& Scanner, FSymbolScope* SymbolScope, FLinearAllocator* Allocator, AST::FAttribute* OutAttribute)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
while (Scanner.HasMoreTokens())
|
|
|
|
|
{
|
|
|
|
|
const auto* Token = Scanner.PeekToken();
|
|
|
|
|
if (Scanner.MatchToken(EHlslToken::RightParenthesis))
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bMultiple = false;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
bMultiple = false;
|
|
|
|
|
Token = Scanner.PeekToken();
|
|
|
|
|
if (Scanner.MatchToken(EHlslToken::StringConstant))
|
|
|
|
|
{
|
|
|
|
|
auto* Arg = new(Allocator) AST::FAttributeArgument(Allocator, Token->SourceInfo);
|
|
|
|
|
Arg->StringArgument = Allocator->Strdup(Token->String);
|
|
|
|
|
OutAttribute->Arguments.Add(Arg);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AST::FExpression* Expression = nullptr;
|
|
|
|
|
EParseResult Result = ParseExpression(Scanner, SymbolScope, false, Allocator, &Expression);
|
|
|
|
|
if (Result != EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
Scanner.SourceError(TEXT("Incorrect attribute expression!\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
auto* Arg = new(Allocator) AST::FAttributeArgument(Allocator, Token->SourceInfo);
|
|
|
|
|
Arg->ExpressionArgument = Expression;
|
|
|
|
|
OutAttribute->Arguments.Add(Arg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Scanner.MatchToken(EHlslToken::Comma))
|
|
|
|
|
{
|
|
|
|
|
bMultiple = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (bMultiple);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EParseResult TryParseAttribute(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FAttribute** OutAttribute)
|
|
|
|
|
{
|
|
|
|
|
const auto* Token = Parser.Scanner.GetCurrentToken();
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::LeftSquareBracket))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Identifier = Parser.Scanner.GetCurrentToken();
|
2014-11-03 11:36:09 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Identifier))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Incorrect attribute\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Attribute = new(Allocator) AST::FAttribute(Allocator, Token->SourceInfo, Allocator->Strdup(Identifier->String));
|
|
|
|
|
|
2014-11-04 14:12:02 -05:00
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::LeftParenthesis))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
auto Result = ParseAttributeArgList(Parser.Scanner, Parser.CurrentScope, Allocator, Attribute);
|
2014-11-14 11:33:43 -05:00
|
|
|
if (Result != EParseResult::Matched)
|
2014-11-04 14:12:02 -05:00
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Incorrect attribute! Expected ')'.\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::RightSquareBracket))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Incorrect attribute\n"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutAttribute = Attribute;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseSwitchBody(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FSwitchBody** OutBody)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
const auto* Token = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::LeftBrace))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'{' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto* Body = new(Allocator) AST::FSwitchBody(Allocator, Token->SourceInfo);
|
|
|
|
|
|
|
|
|
|
// Empty switch
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::RightBrace))
|
|
|
|
|
{
|
|
|
|
|
*OutBody = Body;
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Body->CaseList = new(Allocator) AST::FCaseStatementList(Allocator, Token->SourceInfo);
|
|
|
|
|
|
|
|
|
|
bool bDefaultFound = false;
|
|
|
|
|
while (Parser.Scanner.HasMoreTokens())
|
|
|
|
|
{
|
2015-02-19 12:13:52 -05:00
|
|
|
Token = Parser.Scanner.GetCurrentToken();
|
2014-12-11 15:49:40 -05:00
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::RightBrace))
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto* Labels = new(Allocator) AST::FCaseLabelList(Allocator, Token->SourceInfo);
|
|
|
|
|
auto* CaseStatement = new(Allocator) AST::FCaseStatement(Allocator, Token->SourceInfo, Labels);
|
|
|
|
|
|
|
|
|
|
// Case labels
|
|
|
|
|
bool bLabelFound = false;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
bLabelFound = false;
|
|
|
|
|
AST::FCaseLabel* Label = nullptr;
|
|
|
|
|
Token = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Default))
|
|
|
|
|
{
|
|
|
|
|
if (bDefaultFound)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'default' found twice on switch() statement!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Colon))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("':' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Label = new(Allocator) AST::FCaseLabel(Allocator, Token->SourceInfo, nullptr);
|
|
|
|
|
bDefaultFound = true;
|
|
|
|
|
bLabelFound = true;
|
|
|
|
|
}
|
|
|
|
|
else if (Parser.Scanner.MatchToken(EHlslToken::Case))
|
|
|
|
|
{
|
|
|
|
|
AST::FExpression* CaseExpression = nullptr;
|
|
|
|
|
if (ParseExpression(Parser.Scanner, Parser.CurrentScope, true, Allocator, &CaseExpression) != EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expression expected on case label!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::Colon))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("':' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Label = new(Allocator) AST::FCaseLabel(Allocator, Token->SourceInfo, CaseExpression);
|
|
|
|
|
bLabelFound = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Label)
|
|
|
|
|
{
|
|
|
|
|
CaseStatement->Labels->Labels.Add(Label);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (bLabelFound);
|
|
|
|
|
|
|
|
|
|
// Statements
|
|
|
|
|
Token = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
bool bMatchedOnce = false;
|
|
|
|
|
while (Parser.Scanner.HasMoreTokens())
|
|
|
|
|
{
|
|
|
|
|
auto* Peek = Parser.Scanner.PeekToken();
|
|
|
|
|
if (!Peek)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (Peek->Token == EHlslToken::RightBrace)
|
|
|
|
|
{
|
|
|
|
|
// End of switch
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (Peek->Token == EHlslToken::Case || Peek->Token == EHlslToken::Default)
|
|
|
|
|
{
|
|
|
|
|
// Next CaseStatement
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AST::FNode* Statement = nullptr;
|
|
|
|
|
auto Result = ParseStatement(Parser, Allocator, &Statement);
|
|
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::NotMatched)
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Internal Error parsing statment inside case list"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CaseStatement->Statements.Add(Statement);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Body->CaseList->Cases.Add(CaseStatement);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*OutBody = Body;
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EParseResult ParseSwitchStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
|
|
|
|
{
|
|
|
|
|
const auto* Token = Parser.Scanner.GetCurrentToken();
|
2014-11-03 11:36:09 -05:00
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::LeftParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("'(' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FExpression* Condition = nullptr;
|
|
|
|
|
if (ParseExpression(Parser.Scanner, Parser.CurrentScope, false, Allocator, &Condition) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Expression expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Parser.Scanner.MatchToken(EHlslToken::RightParenthesis))
|
|
|
|
|
{
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("')' expected"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FSwitchBody* Body = nullptr;
|
|
|
|
|
if (ParseSwitchBody(Parser, Allocator, &Body) != EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Switch = new(Allocator) AST::FSwitchStatement(Allocator, Token->SourceInfo, Condition, Body);
|
|
|
|
|
*OutStatement = Switch;
|
2014-11-03 11:36:09 -05:00
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
return EParseResult::Matched;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseExpressionStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
auto OriginalToken = Parser.Scanner.GetCurrentTokenIndex();
|
2014-12-11 15:49:40 -05:00
|
|
|
auto* Statement = new(Allocator) AST::FExpressionStatement(Allocator, nullptr, Parser.Scanner.GetCurrentToken()->SourceInfo);
|
|
|
|
|
if (ParseExpression(Parser.Scanner, Parser.CurrentScope, true, Allocator, &Statement->Expression) == EParseResult::Matched)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
|
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutStatement = Statement;
|
2014-11-03 11:36:09 -05:00
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Parser.Scanner.SetCurrentTokenIndex(OriginalToken);
|
|
|
|
|
return EParseResult::NotMatched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseEmptyStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
check(*OutStatement == nullptr);
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
// Nothing to do here...
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseBreakStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
check(*OutStatement == nullptr);
|
|
|
|
|
|
|
|
|
|
auto* Statement = new(Allocator) AST::FJumpStatement(Allocator, AST::EJumpType::Break, Parser.Scanner.PeekToken(-1)->SourceInfo);
|
|
|
|
|
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
*OutStatement = Statement;
|
|
|
|
|
return EParseResult::Matched;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
2014-12-11 15:49:40 -05:00
|
|
|
|
|
|
|
|
return EParseResult::Error;
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
EParseResult ParseContinueStatement(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutStatement)
|
|
|
|
|
{
|
|
|
|
|
check(*OutStatement == nullptr);
|
|
|
|
|
|
|
|
|
|
auto* Statement = new(Allocator) AST::FJumpStatement(Allocator, AST::EJumpType::Continue, Parser.Scanner.PeekToken(-1)->SourceInfo);
|
|
|
|
|
|
|
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::Semicolon))
|
|
|
|
|
{
|
|
|
|
|
*OutStatement = Statement;
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
EParseResult TryTranslationUnit(FHlslParser& Parser, FLinearAllocator* Allocator, AST::FNode** OutNode)
|
|
|
|
|
{
|
2015-12-10 21:55:37 -05:00
|
|
|
if (MatchPragma(Parser, Allocator, OutNode))
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Matched;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:00:58 -05:00
|
|
|
if (Parser.Scanner.MatchToken(EHlslToken::CBuffer))
|
|
|
|
|
{
|
|
|
|
|
auto Result = ParseCBuffer(Parser, Allocator, OutNode);
|
|
|
|
|
if (Result == EParseResult::Error || Result == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Match Attributes
|
|
|
|
|
TLinearArray<AST::FAttribute*> Attributes(Allocator);
|
|
|
|
|
while (Parser.Scanner.HasMoreTokens())
|
|
|
|
|
{
|
|
|
|
|
const auto* Peek = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
if (Peek->Token == EHlslToken::LeftSquareBracket)
|
|
|
|
|
{
|
|
|
|
|
AST::FAttribute* Attribute = nullptr;
|
|
|
|
|
auto Result = TryParseAttribute(Parser, Allocator, &Attribute);
|
|
|
|
|
if (Result == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
Attributes.Add(Attribute);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto* Peek = Parser.Scanner.GetCurrentToken();
|
|
|
|
|
if (!Peek)
|
|
|
|
|
{
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto Result = ParseFunctionDeclaration(Parser, Allocator, OutNode);
|
|
|
|
|
if (Result == EParseResult::Error || Result == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Result = ParseGlobalVariableDeclaration(Parser, Allocator, OutNode);
|
|
|
|
|
if (Result == EParseResult::Error || Result == EParseResult::Matched)
|
|
|
|
|
{
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Parser.Scanner.SourceError(TEXT("Unable to match rule!"));
|
|
|
|
|
return EParseResult::Error;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 15:49:40 -05:00
|
|
|
namespace ParserRules
|
|
|
|
|
{
|
|
|
|
|
static struct FStaticInitializer
|
|
|
|
|
{
|
|
|
|
|
FStaticInitializer()
|
|
|
|
|
{
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::LeftBrace, ParseStatementBlock));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::Return, ParseReturnStatement));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::Do, ParseDoStatement));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::While, ParseWhileStatement, true));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::For, ParseForStatement, true));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::If, ParseIfStatement, true));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::Switch, ParseSwitchStatement, true));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::Semicolon, ParseEmptyStatement));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::Break, ParseBreakStatement));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::Continue, ParseContinueStatement));
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::Invalid, ParseLocalDeclaration));
|
|
|
|
|
// Always try expressions last
|
|
|
|
|
RulesStatements.Add(FRulePair(EHlslToken::Invalid, ParseExpressionStatement));
|
|
|
|
|
}
|
|
|
|
|
} GStaticInitializer;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-28 19:18:20 -04:00
|
|
|
FHlslParser::FHlslParser(FLinearAllocator* InAllocator, FCompilerMessages& InCompilerMessages) :
|
|
|
|
|
Scanner(InCompilerMessages),
|
|
|
|
|
CompilerMessages(InCompilerMessages),
|
2014-12-11 15:49:40 -05:00
|
|
|
GlobalScope(InAllocator, nullptr),
|
2015-10-28 19:18:20 -04:00
|
|
|
Namespaces(InAllocator, nullptr),
|
2014-12-11 15:49:40 -05:00
|
|
|
Allocator(InAllocator)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
CurrentScope = &GlobalScope;
|
2015-10-28 19:18:20 -04:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
FCreateSymbolScope SceScope(Allocator, &CurrentScope);
|
|
|
|
|
CurrentScope->Name = TEXT("sce");
|
|
|
|
|
{
|
|
|
|
|
FCreateSymbolScope GnmScope(Allocator, &CurrentScope);
|
|
|
|
|
CurrentScope->Name = TEXT("Gnm");
|
|
|
|
|
|
|
|
|
|
CurrentScope->Add(TEXT("Sampler")); // sce::Gnm::Sampler
|
|
|
|
|
|
|
|
|
|
CurrentScope->Add(TEXT("kAnisotropyRatio1")); // sce::Gnm::kAnisotropyRatio1
|
|
|
|
|
CurrentScope->Add(TEXT("kBorderColorTransBlack")); // sce::Gnm::kBorderColorTransBlack
|
|
|
|
|
CurrentScope->Add(TEXT("kDepthCompareNever")); // sce::Gnm::kDepthCompareNever
|
|
|
|
|
}
|
|
|
|
|
//auto* Found = CurrentScope->FindGlobalNamespace(TEXT("sce"), CurrentScope);
|
|
|
|
|
//Found = Found->FindNamespace(TEXT("Gnm"));
|
|
|
|
|
//Found->FindType(Found, TEXT("Sampler"), false);
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Parser
|
|
|
|
|
{
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3028916)
#lockdown nick.penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3006483 on 2016/06/08 by Simon.Tovey
Fix for UE-31653
Instance params from the Spawn, Required and TypeData modules were not being autopopulated.
Change 3006514 on 2016/06/08 by Zabir.Hoque
MIGRATING FIX @ Request
Off by 1 error on reflection roughness calculation affecting 4.12. When I hoisted the max mip index i did a -1 on both sides(c++ & hlsl). This is the simplest hotfix. In 4.13 I'll remove the shader instruction and only do the "-1" in c++ this 1 less shader instruction.
#CodeReview: Marcus.Wassmer, Daniel.Wright
Change 3006605 on 2016/06/08 by Rolando.Caloca
DR - vk - Remove a bunch of unused code, clean up some todos
Change 3006969 on 2016/06/08 by HaarmPieter.Duiker
Add #ifdefs around inverse tonemapping to avoid performance hit in normal use
Change 3007240 on 2016/06/09 by Chris.Bunner
Made a pass at fixing global shader compile warnings and errors.
Change 3007242 on 2016/06/09 by Chris.Bunner
Don't force unlit mode when re-loading a map.
#jira UE-31247
Change 3007243 on 2016/06/09 by Chris.Bunner
Cache InvalidLightmapSettings material for instanced meshes.
#jira UE-31182
Change 3007258 on 2016/06/09 by Chris.Bunner
Fixed refractive depth bias material parameter.
Change 3007466 on 2016/06/09 by Rolando.Caloca
DR - Use vulkan debug marker extension directly from header
Change 3007504 on 2016/06/09 by Martin.Mittring
added refresh button to ImageVerifier
Change 3007528 on 2016/06/09 by Martin.Mittring
ALU optimization to SSR, minor perf difference on NVTitan, needs to to be profiled on lower end
make render more deterministic
Change 3007551 on 2016/06/09 by Chris.Bunner
Reverted constant type change in previous commit.
Change 3007559 on 2016/06/09 by Martin.Mittring
updated ImageValidator
Change 3007584 on 2016/06/09 by Rolando.Caloca
DR - Fix case when not running under RD
Change 3007668 on 2016/06/09 by Rolando.Caloca
DR - vk - Split layers/extensions by required/optional
Change 3007820 on 2016/06/09 by Rolando.Caloca
DR - Android compile fix
Change 3007926 on 2016/06/09 by Martin.Mittring
fixed UI scaling in ImageVerifyer
Change 3007931 on 2016/06/09 by John.Billon
-Fixed cutouts not working for certain sized texture/subUV size combinations.
-Also fixed issue with subUV module not being postloaded consistently on startup.
#Jira UE-31583
Change 3008023 on 2016/06/09 by Martin.Mittring
refactor noise code in shaders
Change 3008127 on 2016/06/09 by Zabir.Hoque
Merging back hot fixes:
1. Fix DX12 crashing due to oclusion queries waiting on incorrect sync point. Integrating change from MS.
2. Immediate context should flush directly and not attempt to flush the immediate context, ie. itself.
Change 3008129 on 2016/06/09 by Daniel.Wright
Disabled r.ProfileGPU.PrintAssetSummary by default due to spam
Change 3008169 on 2016/06/09 by Rolando.Caloca
DR - Fix mobile rendering not freeing resource when using RHI thread
Change 3008429 on 2016/06/09 by Uriel.Doyon
Enabled texture streaming new metrics.
Added progress bar while texture streaming is being built.
Added debug shader validation to prevent crashes when there are uniform expression set mismatches.
Added texture streaming build to "Build All"
Change 3008436 on 2016/06/09 by Uriel.Doyon
Fixed shipping build
Change 3008833 on 2016/06/10 by Rolando.Caloca
DR - Allow RenderTargets to be easily shared via GPU to other DX or OpenGL applications
Submitted by Allar
PR #1864
#jira UE-24545
Change 3008842 on 2016/06/10 by Rolando.Caloca
DR - Remove vertex densities view mode
Change 3008857 on 2016/06/10 by John.Billon
Added a PostLoad to ParticleModuleSubUV to call postload on the SubUV animation to ensure that the animation is loaded in time for caching.
Change 3008870 on 2016/06/10 by Rolando.Caloca
DR - Rebuild hlslcc libs (missing from last merge)
Change 3008925 on 2016/06/10 by John.Billon
Fixed r.ScreenPercentage.Editor
#Jira UE-31549
Change 3009028 on 2016/06/10 by Daniel.Wright
Shadow depth refactor
* Shadow setup and render target allocation now happens in InitViews, and shadow depth rendering happens at one spot in the frame
* This provides control over where shadow depths are rendered for things like async compute, and allows easy atlasing of shadowmaps for forward shading
* The 33Mb of shadow depth buffers in FSceneRenderTargets has been removed, and shadow depth buffers are now allocated as needed
* A large amount of duplicated code to handle each shadow type has been combined
* Cleaner parallel rendering: no more view hacking for the shadow depth pass, no more shadow depths in the middle of translucency
* 'vis ShadowDepthAtlas' or 'vis WholeSceneShadowMap' must now be used to visualize the shadow depth textures
Change 3009032 on 2016/06/10 by Daniel.Wright
Fixed crash with simple forward shading in the material editor
Change 3009178 on 2016/06/10 by Rolando.Caloca
DR - Add support for multi callbacks on HlslParser, added a write to string callback
Change 3009268 on 2016/06/10 by Daniel.Wright
Warning fixes
Change 3009416 on 2016/06/10 by Martin.Mittring
moved decal rendering code in common spot for upcoming MeshDecal rendering
Change 3009433 on 2016/06/10 by John.Billon
Adding ensures for translucency lighting volume render target acesses.
#Jira UE-31578
Change 3009449 on 2016/06/10 by Daniel.Wright
Fixed whole scene point light shadow depths getting rendered redundantly
Change 3009675 on 2016/06/10 by Martin.Mittring
fixed Clang compiling
Change 3009815 on 2016/06/10 by Martin.Mittring
renamed IsUsedWithDeferredDecal to IsDeferredDecal
to be more correct
Change 3009946 on 2016/06/10 by Martin.Mittring
minor optimization
Change 3010270 on 2016/06/11 by HaarmPieter.Duiker
Update gamut transformations used when dumping EXRs to account for bug UE-29935
Change 3011423 on 2016/06/13 by Martin.Mittring
fixed default of bOutputsVelocityInBasePass
#code_review:Rolando.Caloca
#test:PC
Change 3011448 on 2016/06/13 by Martin.Mittring
minor engine code cleanup
#code_review:Olaf.Piesche
#test:PC
Change 3011991 on 2016/06/13 by Daniel.Wright
Fixed downsampled translucency crash in VR
Change 3011993 on 2016/06/13 by Daniel.Wright
Stationary Mobility for primitive components is allowed again, with the meaning 'moves rarely'
Mobility tooltips now reflect whether a primitive component or light component is being inspected
Change 3012096 on 2016/06/13 by Daniel.Wright
Missing file from cl 3011993
Change 3012546 on 2016/06/14 by John.Billon
Added r.ContactShadows.Enable CVar to allow contact shadows to be globally disabled/enabled
#Jira OR-23282
Change 3012706 on 2016/06/14 by John.Billon
Renamed r.ContactShadows.Enable to r.ContactShadows
Change 3012992 on 2016/06/14 by Rolando.Caloca
DR - vk - Fixed backbuffer/swapchain order with RHI thread enabled
- Added support for CustomPresent
Change 3013030 on 2016/06/14 by Rolando.Caloca
DR - vk - Fix dev issue
Change 3013423 on 2016/06/14 by Martin.Mittring
removed code redundancy for easier upcoming changes
#test:PC
Change 3013451 on 2016/06/14 by Martin.Mittring
removed no longer needed debug cvar
#test:PC
Change 3013643 on 2016/06/14 by Zabir.Hoque
Fix API only being inlined in the cpp and not avaialble in the .h
Change 3013696 on 2016/06/14 by Olaf.Piesche
Adding missing quality level spawn rate scaling on GPU emitters
Change 3013736 on 2016/06/14 by Daniel.Wright
Cached shadowmaps for whole scene point and spot light shadows
* Controlled by 'r.Shadow.CacheWholeSceneShadows', defaults to enabled (7ms -> 1.5ms of shadow depths on Titan for ~20 lights)
* Primitives with Static or Stationary mobility have their depths cached, as long as the light is not moving
* Primitives with Movable mobility or using World Position Offset in their materials will not have their depths cached
* Cached shadowmaps are copied each frame and then movable primitive depths composited
* Fast paths exist for when there were no static primitives (skip cached shadowmap) or movable primitives (project directly from cached shadowmap)
* 'r.Shadow.CacheWPOPrimitives' controls whether materials using WPO can be cached (default is off for correctness)
* 'r.Shadow.CachedShadowsCastFromMovablePrimitives' can be used to force off all support for movable primitives, skipping the shadowmap copies (1.5ms -> 0ms of shadow depths for ~20 lights)
Change 3014103 on 2016/06/15 by Daniel.Wright
Compile fix
Change 3014507 on 2016/06/15 by Simon.Tovey
Resurrected Niagara playground and moved to Samples/NotForLicencees
Change 3014931 on 2016/06/15 by Martin.Mittring
moved r.RenderInternals code into renderer to be able to access more low level data
#test:PC, paragon
Change 3014933 on 2016/06/15 by Martin.Mittring
nicer text
Change 3014956 on 2016/06/15 by Daniel.Wright
Fixed HLOD and mesh LODs getting hit by Lightmass ray traces that didn't originate from a mesh
Volume lighting samples and precomputed visibility cells are now only placed on LOD0 (of both mesh LODs and HLOD)
Change 3014985 on 2016/06/15 by Uriel.Doyon
Enabled Texture Build shaders on Mac
Exposed IStreamingManager::AddViewSlaveLocation in ENGINE_API
Fixed issue FStreamingManagerTexture::ConditionalUpdateStaticData which would to update some data in shipping.
Fixed r.Streaming.MipBias not affecting maximum allowed resolution, showing warnings of texture streaming overbudgets
#jira UE-30566
#jira UE-31098
Change 3014995 on 2016/06/15 by Rolando.Caloca
DR - vk - Removed RHI thread wait on acquire image
- Move Descriptor pool into context
Change 3015002 on 2016/06/15 by Rolando.Caloca
DR - Add (disabled) additional cvar for r.DumpShaderDebugWorkerCommandLine
Change 3015041 on 2016/06/15 by Martin.Mittring
fixed ImageValidator crashing when using files that exist only in ref or test folder
Change 3015309 on 2016/06/15 by Rolando.Caloca
DR - vk - Enable fence re-use on SDKs >= 1.0.16.0
Change 3015356 on 2016/06/15 by Rolando.Caloca
DR - vk - Prep for staging buffer refactor
Change 3015430 on 2016/06/15 by Martin.Mittring
minor optimization for subsurfacescatteringprofile
Change 3016097 on 2016/06/16 by Simon.Tovey
Enabling Niagara by default in the Niagara playground
Change 3016098 on 2016/06/16 by Simon.Tovey
Some misc fixup to get niagara working again
Change 3016183 on 2016/06/16 by Rolando.Caloca
DR - vk - Recreate buffer view for volatile buffers
Change 3016225 on 2016/06/16 by Marcus.Wassmer
Duplicate reflection fixes from 4.12 hotfixes.
Change 3016289 on 2016/06/16 by Chris.Bunner
Always gather MP_Normal definitions as they can be shared by other material properties.
#jira UE-31792
Change 3016294 on 2016/06/16 by Daniel.Wright
Fix for ensure accessing CVarCacheWPOPrimitives in game
Change 3016305 on 2016/06/16 by Daniel.Wright
Raised r.Shadow.CSM.MaxCascades to 10 on Epic scalability level, which it should have always been
Change 3016330 on 2016/06/16 by Daniel.Wright
Cached shadowmaps are tossed after 5s of not being used for rendering - helps in the case where you fly through a bunch of lights and never look back
Skipping shadow depth cubemap clear if there will be a cached shadowmap copy later - saves .4ms on PS4 for a close up point light
Stats for shadowmap memory used under 'stat shadowrendering'
Change 3016506 on 2016/06/16 by Daniel.Wright
Fixed crash building map in SunTemple due to null access
Change 3016703 on 2016/06/16 by Uriel.Doyon
Fixed warning due to floating point imprecision when building texture streaming
Change 3016718 on 2016/06/16 by Daniel.Wright
Volume lighting samples use adaptive sampling final gather
* Increases their build time by 2x but improves quality in difficult cases (small bright sources of bounce lighting)
Change 3016871 on 2016/06/16 by Max.Chen
Sequencer: Added support for the named "PerformanceCapture" event which like Matinee, calls GEngine->PerformanceCapture to output a screenshot when the event fires. Refactor event track/sections so that the player is passed to the trigger events evaluation.
Copy from Dev-Sequencer
#jira UE-32093
Change 3017189 on 2016/06/16 by Zabir.Hoque
Fix GBuffer format selection type-o.
#CodeReview: Marcus.Wassmer
Change 3017241 on 2016/06/16 by Martin.Mittring
optimized and cleaned up rendering in transluceny, distortion, custom mesh drawing
#code_review:Daniel.Wright, Marcus.Wassmer, Nick.Penwarden
Change 3017856 on 2016/06/17 by Rolando.Caloca
DR - Missing GL enum
Change 3017910 on 2016/06/17 by Ben.Woodhouse
- Added a Video Buffer to ensure smooth submission of frames from CEF. Without this, we can get multiple texture updates per engine frame, which causes stuttering at high framerates
- Disable hardware acceleration on Windows, since this causes severe performance issues with video rendering
Please note: To actually see 60fps video, you need to ensure the browser frame rate passed into FWebBrowserSingleton::CreateBrowserWindow is set to 60 (default is 24)
#RB:Keli.Hloedversson,Martin.Mittring
Change 3018126 on 2016/06/17 by Ben.Woodhouse
Fix build warning on Mac
#RB:David.Hill
Change 3018167 on 2016/06/17 by Chris.Bunner
Handle case when float4 is passed to TransformPosition material node.
#jira UE-24980
Change 3018246 on 2016/06/17 by Benjamin.Hyder
Submitting Preliminary ShadowRefactor TestMap
Change 3018330 on 2016/06/17 by Benjamin.Hyder
labeled ShadowRefactor map
Change 3018377 on 2016/06/17 by Chris.Bunner
Removed additional node creation when initializing a RotateAboutAxis node.
#jira UE-8034
Change 3018433 on 2016/06/17 by Rolando.Caloca
DR - Fix some clang warnings on Vulkan
Change 3018664 on 2016/06/17 by Martin.Mittring
unified some code for easier maintainance, fixed missing multiply from former change (CL 2933812)
#test:PC
#code_review:Marcus.Wassmer,Brian.Karis
Change 3019023 on 2016/06/19 by Benjamin.Hyder
Re-Labeled ShadowRefactor map
Change 3019024 on 2016/06/19 by Benjamin.Hyder
Correcting Translucent Volume (Non-Directional) settings
Change 3019026 on 2016/06/19 by Benjamin.Hyder
Correcting Lighting ShadowRefactor map
Change 3019414 on 2016/06/20 by Allan.Bentham
Refactor mobile shadows
Change 3019494 on 2016/06/20 by Gil.Gribb
Merging //UE4/Dev-Main@3018959 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3019504 on 2016/06/20 by John.Billon
-Created a blueprint node (ExportRenderTarget and ExportTexture2D) to export render targets/textures as HDR images to disk.
-Moved HDR export code(FHDRExportHelper and CubemapUnwrapUtils) to runtime from editor to allow access from blueprints.
-Created a small common interface for blueprints and the editor itself to use for exporting.
#Jira UE-31429
Change 3019561 on 2016/06/20 by Gil.Gribb
UE4 - Worked around afulness of windows scheduler. This would occasionally cause hitches on quad core machines with additional load in the tick task manager.
Change 3019616 on 2016/06/20 by Rolando.Caloca
DR - Replicate change in DevRendering to fix splotches on characters with morph targets
Change: 3019599
O - Fix flickering on heroes with morph targets
Change 3019627 on 2016/06/20 by Rolando.Caloca
DR - Doh! Compile fix
Change 3019674 on 2016/06/20 by Simon.Tovey
Ripped out the quick hacky VM debugger I wrote a while back.
Over complicated the VM and didn't do enough work to justify it.
Will revisit debugging and profiling of VM scripts in future.
Change 3019691 on 2016/06/20 by Ben.Woodhouse
Add a per-object shadow setting for directional lights (r.Shadow.PerObjectDirectionalDepthBias), which is independent of the CSM setting. Often a smaller bias is desirable on per-object shadows, where detailed self-shadowing is needed.
This change also makes the CSM naming consistent with what the setting actually does (the old setting was named r.shadow.csm, although it affects per-object shadows as well as CSMs).
#RB:Martin.Mittring, Daniel.Wright
Change 3019741 on 2016/06/20 by John.Billon
Fixed compile error on mac.
Change 3019984 on 2016/06/20 by Martin.Mittring
minor optimization
Change 3020172 on 2016/06/20 by Zachary.Wilson
Fixing mesh distance fields for engine content cube and cylinder by setting distance field resolution to 2. for UE-26783 #rb: none
Change 3020195 on 2016/06/20 by Zachary.Wilson
Fixing engine coontent sphere's distance fields for UE-26783, distance fields resolution set to 2. #rb: none
Change 3020196 on 2016/06/20 by Rolando.Caloca
DR - Appease static analysis
Change 3020231 on 2016/06/20 by Zachary.Wilson
Making basic shapes consistent distance field resolution scale. #rb: none
Change 3020468 on 2016/06/20 by David.Hill
CameraWS UE-29146
Change 3020502 on 2016/06/20 by Benjamin.Hyder
Adding AutomationMatinee Camera for RenderOutputValidation
Change 3020508 on 2016/06/20 by Benjamin.Hyder
Adding AutomationMatinee for RenderOutputValidation
Change 3020514 on 2016/06/20 by Benjamin.Hyder
Setting Autoplay for AutomationMatinee (sequence)
Change 3020561 on 2016/06/20 by Daniel.Wright
Removed outdated comment on uniform expression assert
Change 3021268 on 2016/06/21 by Daniel.Wright
Scaled sphere intersection for indirect capsule shadows
* Fixes the discontinuity when capsule axis points close to the light direction
* GPU cost is effectively the same (more expensive to compute, but tighter culling)
Change 3021325 on 2016/06/21 by Daniel.Wright
Split ShadowRendering.cpp into ShadowDepthRendering.cpp
Change 3021355 on 2016/06/21 by Daniel.Wright
Fixed RTDF shadows (broken by shadowmap caching)
Change 3021444 on 2016/06/21 by Daniel.Wright
Fixed crash due to Depth drawing policy not using the default material shader map properly
Change 3021543 on 2016/06/21 by Daniel.Wright
Fixed drawing to a Canvas after EndDrawCanvasToRenderTarget causing a crash
Fixed DrawMaterialToRenderTarget breaking the Canvas object that BeginDrawCanvasToRenderTarget returns
Change 3021749 on 2016/06/21 by Daniel.Wright
Moved RenderBasePass and dependencies into BasePassRendering.cpp
Moved RenderPrePass and dependencies into DepthRendering.cpp
Change 3021766 on 2016/06/21 by Benjamin.Hyder
Adding 150dynamiclights level to Dev-Folder
Change 3021971 on 2016/06/21 by Daniel.Wright
Removed the CPU-culled light grid which is used to implement TLM_SurfacePerPixelLighting, in preparation for a GPU-culled light grid implementation
* TLM_SurfacePerPixelLighting now behaves like TLM_Surface
Change 3022760 on 2016/06/22 by Chris.Bunner
Merge fixup.
Change 3022911 on 2016/06/22 by Rolando.Caloca
DR - Added r.D3DDumpD3DAsmFile to enable dumping the fxc disassembly when dumping shaders
Change 3023037 on 2016/06/22 by Rolando.Caloca
DR - Fix for the case of global destructors calling FlushRenderingCommands() after the RHI has been destroyed
Change 3023139 on 2016/06/22 by Daniel.Wright
Added on screen message for when VisualizeMeshDistanceFields is requested but engine scalability settings have DFAO disabled
Change 3023231 on 2016/06/22 by Daniel.Wright
Only allowing opaque per-object shadows or CSM in the mobile renderer
Change 3023415 on 2016/06/22 by Daniel.Wright
Fix crash in dx12 trying to clear stencil when there is no stencil in the depth target
Change 3024888 on 2016/06/23 by Daniel.Wright
Fixed preshadows being rendered redundantly with multiple lights
Change 3025119 on 2016/06/23 by Martin.Mittring
added MeshDecal content to RenderTest
Change 3025122 on 2016/06/23 by Martin.Mittring
enabled DBuffer for RenderTest
Change 3025153 on 2016/06/23 by Marc.Olano
Fix Spherical Particle Opacity. Particles using this stopped rendering sometime after 4.10.
Needed to use world space without shader offsets, not absolute world space.
Change 3025180 on 2016/06/23 by Marc.Olano
Use translated world space for particle centers.
Better fix for Spherical Particle Opacity problems, but with fingers in more pies. Includes rename of particle center vertex factory variables.
Change 3025265 on 2016/06/23 by David.Hill
Bilbords translucent during PIE - lighting model was incorrectly set in gbuffer
#jira UE-26165
Change 3025269 on 2016/06/23 by Ryan.Brucks
Adding new Testmap for Pixel Depth Offset velocities with Temporal AA
Change 3025345 on 2016/06/23 by Benjamin.Hyder
Submitting MeshDecal Content
Change 3025444 on 2016/06/23 by Benjamin.Hyder
updating content for MeshDecal
Change 3025491 on 2016/06/23 by Benjamin.Hyder
Updating DecalMesh Textures
Change 3025802 on 2016/06/23 by Martin.Mittring
added to readme
Change 3026475 on 2016/06/24 by Rolando.Caloca
DR - Show current state of r.RHIThread.Enable when not using param
Change 3026479 on 2016/06/24 by Rolando.Caloca
DR - Upgrade glslang to 1.0.17.0
Change 3026480 on 2016/06/24 by Rolando.Caloca
DR - Vulkan headers to 1.0.17.0
Change 3026481 on 2016/06/24 by Rolando.Caloca
DR - Vulkan wrapper for extra logging
Change 3026491 on 2016/06/24 by Rolando.Caloca
DR - Missed file
Change 3026574 on 2016/06/24 by Rolando.Caloca
DR - vk - Enabled fence reuse on 1.0.17.0
- Added more logging info
Change 3026656 on 2016/06/24 by Frank.Fella
Niagara - Prevent sequencer uobjects from being garbage collected.
Change 3026657 on 2016/06/24 by Benjamin.Hyder
Updating Rendertestmap to latest
Change 3026723 on 2016/06/24 by Rolando.Caloca
DR - Fix for ES3.1 RHIs
Change 3026784 on 2016/06/24 by Martin.Mittring
New feature: Mesh Decals / Material layers (Chris.Bunner is the goto person on MeshDecals from now on)
Change 3026866 on 2016/06/24 by Olaf.Piesche
#jira OR-18363
#jira UE-27780
fix distortion in particle macro uvs
[CL 3028922 by Gil Gribb in Main branch]
2016-06-27 13:42:20 -04:00
|
|
|
bool Parse(const FString& Input, const FString& Filename, FCompilerMessages& OutCompilerMessages, TArray<TCallback*> Callbacks, TArray<void*> CallbacksData)
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
2014-12-11 15:49:40 -05:00
|
|
|
FLinearAllocator Allocator;
|
2015-10-28 19:18:20 -04:00
|
|
|
FHlslParser Parser(&Allocator, OutCompilerMessages);
|
2014-11-04 14:12:02 -05:00
|
|
|
if (!Parser.Scanner.Lex(Input, Filename))
|
2014-11-03 11:36:09 -05:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-18 15:32:09 -04:00
|
|
|
IR::FIRCreator IRCreator(&Allocator);
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
bool bSuccess = true;
|
2014-12-11 15:49:40 -05:00
|
|
|
TLinearArray<AST::FNode*> Nodes(&Allocator);
|
2014-11-03 11:36:09 -05:00
|
|
|
while (Parser.Scanner.HasMoreTokens())
|
|
|
|
|
{
|
|
|
|
|
auto LastIndex = Parser.Scanner.GetCurrentTokenIndex();
|
|
|
|
|
|
|
|
|
|
static FString GlobalDeclOrDefinition(TEXT("Global declaration or definition"));
|
2014-12-11 15:49:40 -05:00
|
|
|
AST::FNode* Node = nullptr;
|
2015-03-04 17:00:58 -05:00
|
|
|
auto Result = TryTranslationUnit(Parser, &Allocator, &Node);
|
2014-11-03 11:36:09 -05:00
|
|
|
if (Result == EParseResult::Error)
|
|
|
|
|
{
|
|
|
|
|
bSuccess = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
check(Result == EParseResult::Matched);
|
2015-10-28 08:58:16 -04:00
|
|
|
/*
|
2014-12-11 15:49:40 -05:00
|
|
|
if (bDump && Node)
|
|
|
|
|
{
|
|
|
|
|
Node->Dump(0);
|
|
|
|
|
}
|
2015-10-28 08:58:16 -04:00
|
|
|
*/
|
2014-12-11 15:49:40 -05:00
|
|
|
Nodes.Add(Node);
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check(LastIndex != Parser.Scanner.GetCurrentTokenIndex());
|
|
|
|
|
}
|
|
|
|
|
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3028916)
#lockdown nick.penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3006483 on 2016/06/08 by Simon.Tovey
Fix for UE-31653
Instance params from the Spawn, Required and TypeData modules were not being autopopulated.
Change 3006514 on 2016/06/08 by Zabir.Hoque
MIGRATING FIX @ Request
Off by 1 error on reflection roughness calculation affecting 4.12. When I hoisted the max mip index i did a -1 on both sides(c++ & hlsl). This is the simplest hotfix. In 4.13 I'll remove the shader instruction and only do the "-1" in c++ this 1 less shader instruction.
#CodeReview: Marcus.Wassmer, Daniel.Wright
Change 3006605 on 2016/06/08 by Rolando.Caloca
DR - vk - Remove a bunch of unused code, clean up some todos
Change 3006969 on 2016/06/08 by HaarmPieter.Duiker
Add #ifdefs around inverse tonemapping to avoid performance hit in normal use
Change 3007240 on 2016/06/09 by Chris.Bunner
Made a pass at fixing global shader compile warnings and errors.
Change 3007242 on 2016/06/09 by Chris.Bunner
Don't force unlit mode when re-loading a map.
#jira UE-31247
Change 3007243 on 2016/06/09 by Chris.Bunner
Cache InvalidLightmapSettings material for instanced meshes.
#jira UE-31182
Change 3007258 on 2016/06/09 by Chris.Bunner
Fixed refractive depth bias material parameter.
Change 3007466 on 2016/06/09 by Rolando.Caloca
DR - Use vulkan debug marker extension directly from header
Change 3007504 on 2016/06/09 by Martin.Mittring
added refresh button to ImageVerifier
Change 3007528 on 2016/06/09 by Martin.Mittring
ALU optimization to SSR, minor perf difference on NVTitan, needs to to be profiled on lower end
make render more deterministic
Change 3007551 on 2016/06/09 by Chris.Bunner
Reverted constant type change in previous commit.
Change 3007559 on 2016/06/09 by Martin.Mittring
updated ImageValidator
Change 3007584 on 2016/06/09 by Rolando.Caloca
DR - Fix case when not running under RD
Change 3007668 on 2016/06/09 by Rolando.Caloca
DR - vk - Split layers/extensions by required/optional
Change 3007820 on 2016/06/09 by Rolando.Caloca
DR - Android compile fix
Change 3007926 on 2016/06/09 by Martin.Mittring
fixed UI scaling in ImageVerifyer
Change 3007931 on 2016/06/09 by John.Billon
-Fixed cutouts not working for certain sized texture/subUV size combinations.
-Also fixed issue with subUV module not being postloaded consistently on startup.
#Jira UE-31583
Change 3008023 on 2016/06/09 by Martin.Mittring
refactor noise code in shaders
Change 3008127 on 2016/06/09 by Zabir.Hoque
Merging back hot fixes:
1. Fix DX12 crashing due to oclusion queries waiting on incorrect sync point. Integrating change from MS.
2. Immediate context should flush directly and not attempt to flush the immediate context, ie. itself.
Change 3008129 on 2016/06/09 by Daniel.Wright
Disabled r.ProfileGPU.PrintAssetSummary by default due to spam
Change 3008169 on 2016/06/09 by Rolando.Caloca
DR - Fix mobile rendering not freeing resource when using RHI thread
Change 3008429 on 2016/06/09 by Uriel.Doyon
Enabled texture streaming new metrics.
Added progress bar while texture streaming is being built.
Added debug shader validation to prevent crashes when there are uniform expression set mismatches.
Added texture streaming build to "Build All"
Change 3008436 on 2016/06/09 by Uriel.Doyon
Fixed shipping build
Change 3008833 on 2016/06/10 by Rolando.Caloca
DR - Allow RenderTargets to be easily shared via GPU to other DX or OpenGL applications
Submitted by Allar
PR #1864
#jira UE-24545
Change 3008842 on 2016/06/10 by Rolando.Caloca
DR - Remove vertex densities view mode
Change 3008857 on 2016/06/10 by John.Billon
Added a PostLoad to ParticleModuleSubUV to call postload on the SubUV animation to ensure that the animation is loaded in time for caching.
Change 3008870 on 2016/06/10 by Rolando.Caloca
DR - Rebuild hlslcc libs (missing from last merge)
Change 3008925 on 2016/06/10 by John.Billon
Fixed r.ScreenPercentage.Editor
#Jira UE-31549
Change 3009028 on 2016/06/10 by Daniel.Wright
Shadow depth refactor
* Shadow setup and render target allocation now happens in InitViews, and shadow depth rendering happens at one spot in the frame
* This provides control over where shadow depths are rendered for things like async compute, and allows easy atlasing of shadowmaps for forward shading
* The 33Mb of shadow depth buffers in FSceneRenderTargets has been removed, and shadow depth buffers are now allocated as needed
* A large amount of duplicated code to handle each shadow type has been combined
* Cleaner parallel rendering: no more view hacking for the shadow depth pass, no more shadow depths in the middle of translucency
* 'vis ShadowDepthAtlas' or 'vis WholeSceneShadowMap' must now be used to visualize the shadow depth textures
Change 3009032 on 2016/06/10 by Daniel.Wright
Fixed crash with simple forward shading in the material editor
Change 3009178 on 2016/06/10 by Rolando.Caloca
DR - Add support for multi callbacks on HlslParser, added a write to string callback
Change 3009268 on 2016/06/10 by Daniel.Wright
Warning fixes
Change 3009416 on 2016/06/10 by Martin.Mittring
moved decal rendering code in common spot for upcoming MeshDecal rendering
Change 3009433 on 2016/06/10 by John.Billon
Adding ensures for translucency lighting volume render target acesses.
#Jira UE-31578
Change 3009449 on 2016/06/10 by Daniel.Wright
Fixed whole scene point light shadow depths getting rendered redundantly
Change 3009675 on 2016/06/10 by Martin.Mittring
fixed Clang compiling
Change 3009815 on 2016/06/10 by Martin.Mittring
renamed IsUsedWithDeferredDecal to IsDeferredDecal
to be more correct
Change 3009946 on 2016/06/10 by Martin.Mittring
minor optimization
Change 3010270 on 2016/06/11 by HaarmPieter.Duiker
Update gamut transformations used when dumping EXRs to account for bug UE-29935
Change 3011423 on 2016/06/13 by Martin.Mittring
fixed default of bOutputsVelocityInBasePass
#code_review:Rolando.Caloca
#test:PC
Change 3011448 on 2016/06/13 by Martin.Mittring
minor engine code cleanup
#code_review:Olaf.Piesche
#test:PC
Change 3011991 on 2016/06/13 by Daniel.Wright
Fixed downsampled translucency crash in VR
Change 3011993 on 2016/06/13 by Daniel.Wright
Stationary Mobility for primitive components is allowed again, with the meaning 'moves rarely'
Mobility tooltips now reflect whether a primitive component or light component is being inspected
Change 3012096 on 2016/06/13 by Daniel.Wright
Missing file from cl 3011993
Change 3012546 on 2016/06/14 by John.Billon
Added r.ContactShadows.Enable CVar to allow contact shadows to be globally disabled/enabled
#Jira OR-23282
Change 3012706 on 2016/06/14 by John.Billon
Renamed r.ContactShadows.Enable to r.ContactShadows
Change 3012992 on 2016/06/14 by Rolando.Caloca
DR - vk - Fixed backbuffer/swapchain order with RHI thread enabled
- Added support for CustomPresent
Change 3013030 on 2016/06/14 by Rolando.Caloca
DR - vk - Fix dev issue
Change 3013423 on 2016/06/14 by Martin.Mittring
removed code redundancy for easier upcoming changes
#test:PC
Change 3013451 on 2016/06/14 by Martin.Mittring
removed no longer needed debug cvar
#test:PC
Change 3013643 on 2016/06/14 by Zabir.Hoque
Fix API only being inlined in the cpp and not avaialble in the .h
Change 3013696 on 2016/06/14 by Olaf.Piesche
Adding missing quality level spawn rate scaling on GPU emitters
Change 3013736 on 2016/06/14 by Daniel.Wright
Cached shadowmaps for whole scene point and spot light shadows
* Controlled by 'r.Shadow.CacheWholeSceneShadows', defaults to enabled (7ms -> 1.5ms of shadow depths on Titan for ~20 lights)
* Primitives with Static or Stationary mobility have their depths cached, as long as the light is not moving
* Primitives with Movable mobility or using World Position Offset in their materials will not have their depths cached
* Cached shadowmaps are copied each frame and then movable primitive depths composited
* Fast paths exist for when there were no static primitives (skip cached shadowmap) or movable primitives (project directly from cached shadowmap)
* 'r.Shadow.CacheWPOPrimitives' controls whether materials using WPO can be cached (default is off for correctness)
* 'r.Shadow.CachedShadowsCastFromMovablePrimitives' can be used to force off all support for movable primitives, skipping the shadowmap copies (1.5ms -> 0ms of shadow depths for ~20 lights)
Change 3014103 on 2016/06/15 by Daniel.Wright
Compile fix
Change 3014507 on 2016/06/15 by Simon.Tovey
Resurrected Niagara playground and moved to Samples/NotForLicencees
Change 3014931 on 2016/06/15 by Martin.Mittring
moved r.RenderInternals code into renderer to be able to access more low level data
#test:PC, paragon
Change 3014933 on 2016/06/15 by Martin.Mittring
nicer text
Change 3014956 on 2016/06/15 by Daniel.Wright
Fixed HLOD and mesh LODs getting hit by Lightmass ray traces that didn't originate from a mesh
Volume lighting samples and precomputed visibility cells are now only placed on LOD0 (of both mesh LODs and HLOD)
Change 3014985 on 2016/06/15 by Uriel.Doyon
Enabled Texture Build shaders on Mac
Exposed IStreamingManager::AddViewSlaveLocation in ENGINE_API
Fixed issue FStreamingManagerTexture::ConditionalUpdateStaticData which would to update some data in shipping.
Fixed r.Streaming.MipBias not affecting maximum allowed resolution, showing warnings of texture streaming overbudgets
#jira UE-30566
#jira UE-31098
Change 3014995 on 2016/06/15 by Rolando.Caloca
DR - vk - Removed RHI thread wait on acquire image
- Move Descriptor pool into context
Change 3015002 on 2016/06/15 by Rolando.Caloca
DR - Add (disabled) additional cvar for r.DumpShaderDebugWorkerCommandLine
Change 3015041 on 2016/06/15 by Martin.Mittring
fixed ImageValidator crashing when using files that exist only in ref or test folder
Change 3015309 on 2016/06/15 by Rolando.Caloca
DR - vk - Enable fence re-use on SDKs >= 1.0.16.0
Change 3015356 on 2016/06/15 by Rolando.Caloca
DR - vk - Prep for staging buffer refactor
Change 3015430 on 2016/06/15 by Martin.Mittring
minor optimization for subsurfacescatteringprofile
Change 3016097 on 2016/06/16 by Simon.Tovey
Enabling Niagara by default in the Niagara playground
Change 3016098 on 2016/06/16 by Simon.Tovey
Some misc fixup to get niagara working again
Change 3016183 on 2016/06/16 by Rolando.Caloca
DR - vk - Recreate buffer view for volatile buffers
Change 3016225 on 2016/06/16 by Marcus.Wassmer
Duplicate reflection fixes from 4.12 hotfixes.
Change 3016289 on 2016/06/16 by Chris.Bunner
Always gather MP_Normal definitions as they can be shared by other material properties.
#jira UE-31792
Change 3016294 on 2016/06/16 by Daniel.Wright
Fix for ensure accessing CVarCacheWPOPrimitives in game
Change 3016305 on 2016/06/16 by Daniel.Wright
Raised r.Shadow.CSM.MaxCascades to 10 on Epic scalability level, which it should have always been
Change 3016330 on 2016/06/16 by Daniel.Wright
Cached shadowmaps are tossed after 5s of not being used for rendering - helps in the case where you fly through a bunch of lights and never look back
Skipping shadow depth cubemap clear if there will be a cached shadowmap copy later - saves .4ms on PS4 for a close up point light
Stats for shadowmap memory used under 'stat shadowrendering'
Change 3016506 on 2016/06/16 by Daniel.Wright
Fixed crash building map in SunTemple due to null access
Change 3016703 on 2016/06/16 by Uriel.Doyon
Fixed warning due to floating point imprecision when building texture streaming
Change 3016718 on 2016/06/16 by Daniel.Wright
Volume lighting samples use adaptive sampling final gather
* Increases their build time by 2x but improves quality in difficult cases (small bright sources of bounce lighting)
Change 3016871 on 2016/06/16 by Max.Chen
Sequencer: Added support for the named "PerformanceCapture" event which like Matinee, calls GEngine->PerformanceCapture to output a screenshot when the event fires. Refactor event track/sections so that the player is passed to the trigger events evaluation.
Copy from Dev-Sequencer
#jira UE-32093
Change 3017189 on 2016/06/16 by Zabir.Hoque
Fix GBuffer format selection type-o.
#CodeReview: Marcus.Wassmer
Change 3017241 on 2016/06/16 by Martin.Mittring
optimized and cleaned up rendering in transluceny, distortion, custom mesh drawing
#code_review:Daniel.Wright, Marcus.Wassmer, Nick.Penwarden
Change 3017856 on 2016/06/17 by Rolando.Caloca
DR - Missing GL enum
Change 3017910 on 2016/06/17 by Ben.Woodhouse
- Added a Video Buffer to ensure smooth submission of frames from CEF. Without this, we can get multiple texture updates per engine frame, which causes stuttering at high framerates
- Disable hardware acceleration on Windows, since this causes severe performance issues with video rendering
Please note: To actually see 60fps video, you need to ensure the browser frame rate passed into FWebBrowserSingleton::CreateBrowserWindow is set to 60 (default is 24)
#RB:Keli.Hloedversson,Martin.Mittring
Change 3018126 on 2016/06/17 by Ben.Woodhouse
Fix build warning on Mac
#RB:David.Hill
Change 3018167 on 2016/06/17 by Chris.Bunner
Handle case when float4 is passed to TransformPosition material node.
#jira UE-24980
Change 3018246 on 2016/06/17 by Benjamin.Hyder
Submitting Preliminary ShadowRefactor TestMap
Change 3018330 on 2016/06/17 by Benjamin.Hyder
labeled ShadowRefactor map
Change 3018377 on 2016/06/17 by Chris.Bunner
Removed additional node creation when initializing a RotateAboutAxis node.
#jira UE-8034
Change 3018433 on 2016/06/17 by Rolando.Caloca
DR - Fix some clang warnings on Vulkan
Change 3018664 on 2016/06/17 by Martin.Mittring
unified some code for easier maintainance, fixed missing multiply from former change (CL 2933812)
#test:PC
#code_review:Marcus.Wassmer,Brian.Karis
Change 3019023 on 2016/06/19 by Benjamin.Hyder
Re-Labeled ShadowRefactor map
Change 3019024 on 2016/06/19 by Benjamin.Hyder
Correcting Translucent Volume (Non-Directional) settings
Change 3019026 on 2016/06/19 by Benjamin.Hyder
Correcting Lighting ShadowRefactor map
Change 3019414 on 2016/06/20 by Allan.Bentham
Refactor mobile shadows
Change 3019494 on 2016/06/20 by Gil.Gribb
Merging //UE4/Dev-Main@3018959 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3019504 on 2016/06/20 by John.Billon
-Created a blueprint node (ExportRenderTarget and ExportTexture2D) to export render targets/textures as HDR images to disk.
-Moved HDR export code(FHDRExportHelper and CubemapUnwrapUtils) to runtime from editor to allow access from blueprints.
-Created a small common interface for blueprints and the editor itself to use for exporting.
#Jira UE-31429
Change 3019561 on 2016/06/20 by Gil.Gribb
UE4 - Worked around afulness of windows scheduler. This would occasionally cause hitches on quad core machines with additional load in the tick task manager.
Change 3019616 on 2016/06/20 by Rolando.Caloca
DR - Replicate change in DevRendering to fix splotches on characters with morph targets
Change: 3019599
O - Fix flickering on heroes with morph targets
Change 3019627 on 2016/06/20 by Rolando.Caloca
DR - Doh! Compile fix
Change 3019674 on 2016/06/20 by Simon.Tovey
Ripped out the quick hacky VM debugger I wrote a while back.
Over complicated the VM and didn't do enough work to justify it.
Will revisit debugging and profiling of VM scripts in future.
Change 3019691 on 2016/06/20 by Ben.Woodhouse
Add a per-object shadow setting for directional lights (r.Shadow.PerObjectDirectionalDepthBias), which is independent of the CSM setting. Often a smaller bias is desirable on per-object shadows, where detailed self-shadowing is needed.
This change also makes the CSM naming consistent with what the setting actually does (the old setting was named r.shadow.csm, although it affects per-object shadows as well as CSMs).
#RB:Martin.Mittring, Daniel.Wright
Change 3019741 on 2016/06/20 by John.Billon
Fixed compile error on mac.
Change 3019984 on 2016/06/20 by Martin.Mittring
minor optimization
Change 3020172 on 2016/06/20 by Zachary.Wilson
Fixing mesh distance fields for engine content cube and cylinder by setting distance field resolution to 2. for UE-26783 #rb: none
Change 3020195 on 2016/06/20 by Zachary.Wilson
Fixing engine coontent sphere's distance fields for UE-26783, distance fields resolution set to 2. #rb: none
Change 3020196 on 2016/06/20 by Rolando.Caloca
DR - Appease static analysis
Change 3020231 on 2016/06/20 by Zachary.Wilson
Making basic shapes consistent distance field resolution scale. #rb: none
Change 3020468 on 2016/06/20 by David.Hill
CameraWS UE-29146
Change 3020502 on 2016/06/20 by Benjamin.Hyder
Adding AutomationMatinee Camera for RenderOutputValidation
Change 3020508 on 2016/06/20 by Benjamin.Hyder
Adding AutomationMatinee for RenderOutputValidation
Change 3020514 on 2016/06/20 by Benjamin.Hyder
Setting Autoplay for AutomationMatinee (sequence)
Change 3020561 on 2016/06/20 by Daniel.Wright
Removed outdated comment on uniform expression assert
Change 3021268 on 2016/06/21 by Daniel.Wright
Scaled sphere intersection for indirect capsule shadows
* Fixes the discontinuity when capsule axis points close to the light direction
* GPU cost is effectively the same (more expensive to compute, but tighter culling)
Change 3021325 on 2016/06/21 by Daniel.Wright
Split ShadowRendering.cpp into ShadowDepthRendering.cpp
Change 3021355 on 2016/06/21 by Daniel.Wright
Fixed RTDF shadows (broken by shadowmap caching)
Change 3021444 on 2016/06/21 by Daniel.Wright
Fixed crash due to Depth drawing policy not using the default material shader map properly
Change 3021543 on 2016/06/21 by Daniel.Wright
Fixed drawing to a Canvas after EndDrawCanvasToRenderTarget causing a crash
Fixed DrawMaterialToRenderTarget breaking the Canvas object that BeginDrawCanvasToRenderTarget returns
Change 3021749 on 2016/06/21 by Daniel.Wright
Moved RenderBasePass and dependencies into BasePassRendering.cpp
Moved RenderPrePass and dependencies into DepthRendering.cpp
Change 3021766 on 2016/06/21 by Benjamin.Hyder
Adding 150dynamiclights level to Dev-Folder
Change 3021971 on 2016/06/21 by Daniel.Wright
Removed the CPU-culled light grid which is used to implement TLM_SurfacePerPixelLighting, in preparation for a GPU-culled light grid implementation
* TLM_SurfacePerPixelLighting now behaves like TLM_Surface
Change 3022760 on 2016/06/22 by Chris.Bunner
Merge fixup.
Change 3022911 on 2016/06/22 by Rolando.Caloca
DR - Added r.D3DDumpD3DAsmFile to enable dumping the fxc disassembly when dumping shaders
Change 3023037 on 2016/06/22 by Rolando.Caloca
DR - Fix for the case of global destructors calling FlushRenderingCommands() after the RHI has been destroyed
Change 3023139 on 2016/06/22 by Daniel.Wright
Added on screen message for when VisualizeMeshDistanceFields is requested but engine scalability settings have DFAO disabled
Change 3023231 on 2016/06/22 by Daniel.Wright
Only allowing opaque per-object shadows or CSM in the mobile renderer
Change 3023415 on 2016/06/22 by Daniel.Wright
Fix crash in dx12 trying to clear stencil when there is no stencil in the depth target
Change 3024888 on 2016/06/23 by Daniel.Wright
Fixed preshadows being rendered redundantly with multiple lights
Change 3025119 on 2016/06/23 by Martin.Mittring
added MeshDecal content to RenderTest
Change 3025122 on 2016/06/23 by Martin.Mittring
enabled DBuffer for RenderTest
Change 3025153 on 2016/06/23 by Marc.Olano
Fix Spherical Particle Opacity. Particles using this stopped rendering sometime after 4.10.
Needed to use world space without shader offsets, not absolute world space.
Change 3025180 on 2016/06/23 by Marc.Olano
Use translated world space for particle centers.
Better fix for Spherical Particle Opacity problems, but with fingers in more pies. Includes rename of particle center vertex factory variables.
Change 3025265 on 2016/06/23 by David.Hill
Bilbords translucent during PIE - lighting model was incorrectly set in gbuffer
#jira UE-26165
Change 3025269 on 2016/06/23 by Ryan.Brucks
Adding new Testmap for Pixel Depth Offset velocities with Temporal AA
Change 3025345 on 2016/06/23 by Benjamin.Hyder
Submitting MeshDecal Content
Change 3025444 on 2016/06/23 by Benjamin.Hyder
updating content for MeshDecal
Change 3025491 on 2016/06/23 by Benjamin.Hyder
Updating DecalMesh Textures
Change 3025802 on 2016/06/23 by Martin.Mittring
added to readme
Change 3026475 on 2016/06/24 by Rolando.Caloca
DR - Show current state of r.RHIThread.Enable when not using param
Change 3026479 on 2016/06/24 by Rolando.Caloca
DR - Upgrade glslang to 1.0.17.0
Change 3026480 on 2016/06/24 by Rolando.Caloca
DR - Vulkan headers to 1.0.17.0
Change 3026481 on 2016/06/24 by Rolando.Caloca
DR - Vulkan wrapper for extra logging
Change 3026491 on 2016/06/24 by Rolando.Caloca
DR - Missed file
Change 3026574 on 2016/06/24 by Rolando.Caloca
DR - vk - Enabled fence reuse on 1.0.17.0
- Added more logging info
Change 3026656 on 2016/06/24 by Frank.Fella
Niagara - Prevent sequencer uobjects from being garbage collected.
Change 3026657 on 2016/06/24 by Benjamin.Hyder
Updating Rendertestmap to latest
Change 3026723 on 2016/06/24 by Rolando.Caloca
DR - Fix for ES3.1 RHIs
Change 3026784 on 2016/06/24 by Martin.Mittring
New feature: Mesh Decals / Material layers (Chris.Bunner is the goto person on MeshDecals from now on)
Change 3026866 on 2016/06/24 by Olaf.Piesche
#jira OR-18363
#jira UE-27780
fix distortion in particle macro uvs
[CL 3028922 by Gil Gribb in Main branch]
2016-06-27 13:42:20 -04:00
|
|
|
if (bSuccess)
|
2015-10-28 08:58:16 -04:00
|
|
|
{
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3028916)
#lockdown nick.penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3006483 on 2016/06/08 by Simon.Tovey
Fix for UE-31653
Instance params from the Spawn, Required and TypeData modules were not being autopopulated.
Change 3006514 on 2016/06/08 by Zabir.Hoque
MIGRATING FIX @ Request
Off by 1 error on reflection roughness calculation affecting 4.12. When I hoisted the max mip index i did a -1 on both sides(c++ & hlsl). This is the simplest hotfix. In 4.13 I'll remove the shader instruction and only do the "-1" in c++ this 1 less shader instruction.
#CodeReview: Marcus.Wassmer, Daniel.Wright
Change 3006605 on 2016/06/08 by Rolando.Caloca
DR - vk - Remove a bunch of unused code, clean up some todos
Change 3006969 on 2016/06/08 by HaarmPieter.Duiker
Add #ifdefs around inverse tonemapping to avoid performance hit in normal use
Change 3007240 on 2016/06/09 by Chris.Bunner
Made a pass at fixing global shader compile warnings and errors.
Change 3007242 on 2016/06/09 by Chris.Bunner
Don't force unlit mode when re-loading a map.
#jira UE-31247
Change 3007243 on 2016/06/09 by Chris.Bunner
Cache InvalidLightmapSettings material for instanced meshes.
#jira UE-31182
Change 3007258 on 2016/06/09 by Chris.Bunner
Fixed refractive depth bias material parameter.
Change 3007466 on 2016/06/09 by Rolando.Caloca
DR - Use vulkan debug marker extension directly from header
Change 3007504 on 2016/06/09 by Martin.Mittring
added refresh button to ImageVerifier
Change 3007528 on 2016/06/09 by Martin.Mittring
ALU optimization to SSR, minor perf difference on NVTitan, needs to to be profiled on lower end
make render more deterministic
Change 3007551 on 2016/06/09 by Chris.Bunner
Reverted constant type change in previous commit.
Change 3007559 on 2016/06/09 by Martin.Mittring
updated ImageValidator
Change 3007584 on 2016/06/09 by Rolando.Caloca
DR - Fix case when not running under RD
Change 3007668 on 2016/06/09 by Rolando.Caloca
DR - vk - Split layers/extensions by required/optional
Change 3007820 on 2016/06/09 by Rolando.Caloca
DR - Android compile fix
Change 3007926 on 2016/06/09 by Martin.Mittring
fixed UI scaling in ImageVerifyer
Change 3007931 on 2016/06/09 by John.Billon
-Fixed cutouts not working for certain sized texture/subUV size combinations.
-Also fixed issue with subUV module not being postloaded consistently on startup.
#Jira UE-31583
Change 3008023 on 2016/06/09 by Martin.Mittring
refactor noise code in shaders
Change 3008127 on 2016/06/09 by Zabir.Hoque
Merging back hot fixes:
1. Fix DX12 crashing due to oclusion queries waiting on incorrect sync point. Integrating change from MS.
2. Immediate context should flush directly and not attempt to flush the immediate context, ie. itself.
Change 3008129 on 2016/06/09 by Daniel.Wright
Disabled r.ProfileGPU.PrintAssetSummary by default due to spam
Change 3008169 on 2016/06/09 by Rolando.Caloca
DR - Fix mobile rendering not freeing resource when using RHI thread
Change 3008429 on 2016/06/09 by Uriel.Doyon
Enabled texture streaming new metrics.
Added progress bar while texture streaming is being built.
Added debug shader validation to prevent crashes when there are uniform expression set mismatches.
Added texture streaming build to "Build All"
Change 3008436 on 2016/06/09 by Uriel.Doyon
Fixed shipping build
Change 3008833 on 2016/06/10 by Rolando.Caloca
DR - Allow RenderTargets to be easily shared via GPU to other DX or OpenGL applications
Submitted by Allar
PR #1864
#jira UE-24545
Change 3008842 on 2016/06/10 by Rolando.Caloca
DR - Remove vertex densities view mode
Change 3008857 on 2016/06/10 by John.Billon
Added a PostLoad to ParticleModuleSubUV to call postload on the SubUV animation to ensure that the animation is loaded in time for caching.
Change 3008870 on 2016/06/10 by Rolando.Caloca
DR - Rebuild hlslcc libs (missing from last merge)
Change 3008925 on 2016/06/10 by John.Billon
Fixed r.ScreenPercentage.Editor
#Jira UE-31549
Change 3009028 on 2016/06/10 by Daniel.Wright
Shadow depth refactor
* Shadow setup and render target allocation now happens in InitViews, and shadow depth rendering happens at one spot in the frame
* This provides control over where shadow depths are rendered for things like async compute, and allows easy atlasing of shadowmaps for forward shading
* The 33Mb of shadow depth buffers in FSceneRenderTargets has been removed, and shadow depth buffers are now allocated as needed
* A large amount of duplicated code to handle each shadow type has been combined
* Cleaner parallel rendering: no more view hacking for the shadow depth pass, no more shadow depths in the middle of translucency
* 'vis ShadowDepthAtlas' or 'vis WholeSceneShadowMap' must now be used to visualize the shadow depth textures
Change 3009032 on 2016/06/10 by Daniel.Wright
Fixed crash with simple forward shading in the material editor
Change 3009178 on 2016/06/10 by Rolando.Caloca
DR - Add support for multi callbacks on HlslParser, added a write to string callback
Change 3009268 on 2016/06/10 by Daniel.Wright
Warning fixes
Change 3009416 on 2016/06/10 by Martin.Mittring
moved decal rendering code in common spot for upcoming MeshDecal rendering
Change 3009433 on 2016/06/10 by John.Billon
Adding ensures for translucency lighting volume render target acesses.
#Jira UE-31578
Change 3009449 on 2016/06/10 by Daniel.Wright
Fixed whole scene point light shadow depths getting rendered redundantly
Change 3009675 on 2016/06/10 by Martin.Mittring
fixed Clang compiling
Change 3009815 on 2016/06/10 by Martin.Mittring
renamed IsUsedWithDeferredDecal to IsDeferredDecal
to be more correct
Change 3009946 on 2016/06/10 by Martin.Mittring
minor optimization
Change 3010270 on 2016/06/11 by HaarmPieter.Duiker
Update gamut transformations used when dumping EXRs to account for bug UE-29935
Change 3011423 on 2016/06/13 by Martin.Mittring
fixed default of bOutputsVelocityInBasePass
#code_review:Rolando.Caloca
#test:PC
Change 3011448 on 2016/06/13 by Martin.Mittring
minor engine code cleanup
#code_review:Olaf.Piesche
#test:PC
Change 3011991 on 2016/06/13 by Daniel.Wright
Fixed downsampled translucency crash in VR
Change 3011993 on 2016/06/13 by Daniel.Wright
Stationary Mobility for primitive components is allowed again, with the meaning 'moves rarely'
Mobility tooltips now reflect whether a primitive component or light component is being inspected
Change 3012096 on 2016/06/13 by Daniel.Wright
Missing file from cl 3011993
Change 3012546 on 2016/06/14 by John.Billon
Added r.ContactShadows.Enable CVar to allow contact shadows to be globally disabled/enabled
#Jira OR-23282
Change 3012706 on 2016/06/14 by John.Billon
Renamed r.ContactShadows.Enable to r.ContactShadows
Change 3012992 on 2016/06/14 by Rolando.Caloca
DR - vk - Fixed backbuffer/swapchain order with RHI thread enabled
- Added support for CustomPresent
Change 3013030 on 2016/06/14 by Rolando.Caloca
DR - vk - Fix dev issue
Change 3013423 on 2016/06/14 by Martin.Mittring
removed code redundancy for easier upcoming changes
#test:PC
Change 3013451 on 2016/06/14 by Martin.Mittring
removed no longer needed debug cvar
#test:PC
Change 3013643 on 2016/06/14 by Zabir.Hoque
Fix API only being inlined in the cpp and not avaialble in the .h
Change 3013696 on 2016/06/14 by Olaf.Piesche
Adding missing quality level spawn rate scaling on GPU emitters
Change 3013736 on 2016/06/14 by Daniel.Wright
Cached shadowmaps for whole scene point and spot light shadows
* Controlled by 'r.Shadow.CacheWholeSceneShadows', defaults to enabled (7ms -> 1.5ms of shadow depths on Titan for ~20 lights)
* Primitives with Static or Stationary mobility have their depths cached, as long as the light is not moving
* Primitives with Movable mobility or using World Position Offset in their materials will not have their depths cached
* Cached shadowmaps are copied each frame and then movable primitive depths composited
* Fast paths exist for when there were no static primitives (skip cached shadowmap) or movable primitives (project directly from cached shadowmap)
* 'r.Shadow.CacheWPOPrimitives' controls whether materials using WPO can be cached (default is off for correctness)
* 'r.Shadow.CachedShadowsCastFromMovablePrimitives' can be used to force off all support for movable primitives, skipping the shadowmap copies (1.5ms -> 0ms of shadow depths for ~20 lights)
Change 3014103 on 2016/06/15 by Daniel.Wright
Compile fix
Change 3014507 on 2016/06/15 by Simon.Tovey
Resurrected Niagara playground and moved to Samples/NotForLicencees
Change 3014931 on 2016/06/15 by Martin.Mittring
moved r.RenderInternals code into renderer to be able to access more low level data
#test:PC, paragon
Change 3014933 on 2016/06/15 by Martin.Mittring
nicer text
Change 3014956 on 2016/06/15 by Daniel.Wright
Fixed HLOD and mesh LODs getting hit by Lightmass ray traces that didn't originate from a mesh
Volume lighting samples and precomputed visibility cells are now only placed on LOD0 (of both mesh LODs and HLOD)
Change 3014985 on 2016/06/15 by Uriel.Doyon
Enabled Texture Build shaders on Mac
Exposed IStreamingManager::AddViewSlaveLocation in ENGINE_API
Fixed issue FStreamingManagerTexture::ConditionalUpdateStaticData which would to update some data in shipping.
Fixed r.Streaming.MipBias not affecting maximum allowed resolution, showing warnings of texture streaming overbudgets
#jira UE-30566
#jira UE-31098
Change 3014995 on 2016/06/15 by Rolando.Caloca
DR - vk - Removed RHI thread wait on acquire image
- Move Descriptor pool into context
Change 3015002 on 2016/06/15 by Rolando.Caloca
DR - Add (disabled) additional cvar for r.DumpShaderDebugWorkerCommandLine
Change 3015041 on 2016/06/15 by Martin.Mittring
fixed ImageValidator crashing when using files that exist only in ref or test folder
Change 3015309 on 2016/06/15 by Rolando.Caloca
DR - vk - Enable fence re-use on SDKs >= 1.0.16.0
Change 3015356 on 2016/06/15 by Rolando.Caloca
DR - vk - Prep for staging buffer refactor
Change 3015430 on 2016/06/15 by Martin.Mittring
minor optimization for subsurfacescatteringprofile
Change 3016097 on 2016/06/16 by Simon.Tovey
Enabling Niagara by default in the Niagara playground
Change 3016098 on 2016/06/16 by Simon.Tovey
Some misc fixup to get niagara working again
Change 3016183 on 2016/06/16 by Rolando.Caloca
DR - vk - Recreate buffer view for volatile buffers
Change 3016225 on 2016/06/16 by Marcus.Wassmer
Duplicate reflection fixes from 4.12 hotfixes.
Change 3016289 on 2016/06/16 by Chris.Bunner
Always gather MP_Normal definitions as they can be shared by other material properties.
#jira UE-31792
Change 3016294 on 2016/06/16 by Daniel.Wright
Fix for ensure accessing CVarCacheWPOPrimitives in game
Change 3016305 on 2016/06/16 by Daniel.Wright
Raised r.Shadow.CSM.MaxCascades to 10 on Epic scalability level, which it should have always been
Change 3016330 on 2016/06/16 by Daniel.Wright
Cached shadowmaps are tossed after 5s of not being used for rendering - helps in the case where you fly through a bunch of lights and never look back
Skipping shadow depth cubemap clear if there will be a cached shadowmap copy later - saves .4ms on PS4 for a close up point light
Stats for shadowmap memory used under 'stat shadowrendering'
Change 3016506 on 2016/06/16 by Daniel.Wright
Fixed crash building map in SunTemple due to null access
Change 3016703 on 2016/06/16 by Uriel.Doyon
Fixed warning due to floating point imprecision when building texture streaming
Change 3016718 on 2016/06/16 by Daniel.Wright
Volume lighting samples use adaptive sampling final gather
* Increases their build time by 2x but improves quality in difficult cases (small bright sources of bounce lighting)
Change 3016871 on 2016/06/16 by Max.Chen
Sequencer: Added support for the named "PerformanceCapture" event which like Matinee, calls GEngine->PerformanceCapture to output a screenshot when the event fires. Refactor event track/sections so that the player is passed to the trigger events evaluation.
Copy from Dev-Sequencer
#jira UE-32093
Change 3017189 on 2016/06/16 by Zabir.Hoque
Fix GBuffer format selection type-o.
#CodeReview: Marcus.Wassmer
Change 3017241 on 2016/06/16 by Martin.Mittring
optimized and cleaned up rendering in transluceny, distortion, custom mesh drawing
#code_review:Daniel.Wright, Marcus.Wassmer, Nick.Penwarden
Change 3017856 on 2016/06/17 by Rolando.Caloca
DR - Missing GL enum
Change 3017910 on 2016/06/17 by Ben.Woodhouse
- Added a Video Buffer to ensure smooth submission of frames from CEF. Without this, we can get multiple texture updates per engine frame, which causes stuttering at high framerates
- Disable hardware acceleration on Windows, since this causes severe performance issues with video rendering
Please note: To actually see 60fps video, you need to ensure the browser frame rate passed into FWebBrowserSingleton::CreateBrowserWindow is set to 60 (default is 24)
#RB:Keli.Hloedversson,Martin.Mittring
Change 3018126 on 2016/06/17 by Ben.Woodhouse
Fix build warning on Mac
#RB:David.Hill
Change 3018167 on 2016/06/17 by Chris.Bunner
Handle case when float4 is passed to TransformPosition material node.
#jira UE-24980
Change 3018246 on 2016/06/17 by Benjamin.Hyder
Submitting Preliminary ShadowRefactor TestMap
Change 3018330 on 2016/06/17 by Benjamin.Hyder
labeled ShadowRefactor map
Change 3018377 on 2016/06/17 by Chris.Bunner
Removed additional node creation when initializing a RotateAboutAxis node.
#jira UE-8034
Change 3018433 on 2016/06/17 by Rolando.Caloca
DR - Fix some clang warnings on Vulkan
Change 3018664 on 2016/06/17 by Martin.Mittring
unified some code for easier maintainance, fixed missing multiply from former change (CL 2933812)
#test:PC
#code_review:Marcus.Wassmer,Brian.Karis
Change 3019023 on 2016/06/19 by Benjamin.Hyder
Re-Labeled ShadowRefactor map
Change 3019024 on 2016/06/19 by Benjamin.Hyder
Correcting Translucent Volume (Non-Directional) settings
Change 3019026 on 2016/06/19 by Benjamin.Hyder
Correcting Lighting ShadowRefactor map
Change 3019414 on 2016/06/20 by Allan.Bentham
Refactor mobile shadows
Change 3019494 on 2016/06/20 by Gil.Gribb
Merging //UE4/Dev-Main@3018959 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3019504 on 2016/06/20 by John.Billon
-Created a blueprint node (ExportRenderTarget and ExportTexture2D) to export render targets/textures as HDR images to disk.
-Moved HDR export code(FHDRExportHelper and CubemapUnwrapUtils) to runtime from editor to allow access from blueprints.
-Created a small common interface for blueprints and the editor itself to use for exporting.
#Jira UE-31429
Change 3019561 on 2016/06/20 by Gil.Gribb
UE4 - Worked around afulness of windows scheduler. This would occasionally cause hitches on quad core machines with additional load in the tick task manager.
Change 3019616 on 2016/06/20 by Rolando.Caloca
DR - Replicate change in DevRendering to fix splotches on characters with morph targets
Change: 3019599
O - Fix flickering on heroes with morph targets
Change 3019627 on 2016/06/20 by Rolando.Caloca
DR - Doh! Compile fix
Change 3019674 on 2016/06/20 by Simon.Tovey
Ripped out the quick hacky VM debugger I wrote a while back.
Over complicated the VM and didn't do enough work to justify it.
Will revisit debugging and profiling of VM scripts in future.
Change 3019691 on 2016/06/20 by Ben.Woodhouse
Add a per-object shadow setting for directional lights (r.Shadow.PerObjectDirectionalDepthBias), which is independent of the CSM setting. Often a smaller bias is desirable on per-object shadows, where detailed self-shadowing is needed.
This change also makes the CSM naming consistent with what the setting actually does (the old setting was named r.shadow.csm, although it affects per-object shadows as well as CSMs).
#RB:Martin.Mittring, Daniel.Wright
Change 3019741 on 2016/06/20 by John.Billon
Fixed compile error on mac.
Change 3019984 on 2016/06/20 by Martin.Mittring
minor optimization
Change 3020172 on 2016/06/20 by Zachary.Wilson
Fixing mesh distance fields for engine content cube and cylinder by setting distance field resolution to 2. for UE-26783 #rb: none
Change 3020195 on 2016/06/20 by Zachary.Wilson
Fixing engine coontent sphere's distance fields for UE-26783, distance fields resolution set to 2. #rb: none
Change 3020196 on 2016/06/20 by Rolando.Caloca
DR - Appease static analysis
Change 3020231 on 2016/06/20 by Zachary.Wilson
Making basic shapes consistent distance field resolution scale. #rb: none
Change 3020468 on 2016/06/20 by David.Hill
CameraWS UE-29146
Change 3020502 on 2016/06/20 by Benjamin.Hyder
Adding AutomationMatinee Camera for RenderOutputValidation
Change 3020508 on 2016/06/20 by Benjamin.Hyder
Adding AutomationMatinee for RenderOutputValidation
Change 3020514 on 2016/06/20 by Benjamin.Hyder
Setting Autoplay for AutomationMatinee (sequence)
Change 3020561 on 2016/06/20 by Daniel.Wright
Removed outdated comment on uniform expression assert
Change 3021268 on 2016/06/21 by Daniel.Wright
Scaled sphere intersection for indirect capsule shadows
* Fixes the discontinuity when capsule axis points close to the light direction
* GPU cost is effectively the same (more expensive to compute, but tighter culling)
Change 3021325 on 2016/06/21 by Daniel.Wright
Split ShadowRendering.cpp into ShadowDepthRendering.cpp
Change 3021355 on 2016/06/21 by Daniel.Wright
Fixed RTDF shadows (broken by shadowmap caching)
Change 3021444 on 2016/06/21 by Daniel.Wright
Fixed crash due to Depth drawing policy not using the default material shader map properly
Change 3021543 on 2016/06/21 by Daniel.Wright
Fixed drawing to a Canvas after EndDrawCanvasToRenderTarget causing a crash
Fixed DrawMaterialToRenderTarget breaking the Canvas object that BeginDrawCanvasToRenderTarget returns
Change 3021749 on 2016/06/21 by Daniel.Wright
Moved RenderBasePass and dependencies into BasePassRendering.cpp
Moved RenderPrePass and dependencies into DepthRendering.cpp
Change 3021766 on 2016/06/21 by Benjamin.Hyder
Adding 150dynamiclights level to Dev-Folder
Change 3021971 on 2016/06/21 by Daniel.Wright
Removed the CPU-culled light grid which is used to implement TLM_SurfacePerPixelLighting, in preparation for a GPU-culled light grid implementation
* TLM_SurfacePerPixelLighting now behaves like TLM_Surface
Change 3022760 on 2016/06/22 by Chris.Bunner
Merge fixup.
Change 3022911 on 2016/06/22 by Rolando.Caloca
DR - Added r.D3DDumpD3DAsmFile to enable dumping the fxc disassembly when dumping shaders
Change 3023037 on 2016/06/22 by Rolando.Caloca
DR - Fix for the case of global destructors calling FlushRenderingCommands() after the RHI has been destroyed
Change 3023139 on 2016/06/22 by Daniel.Wright
Added on screen message for when VisualizeMeshDistanceFields is requested but engine scalability settings have DFAO disabled
Change 3023231 on 2016/06/22 by Daniel.Wright
Only allowing opaque per-object shadows or CSM in the mobile renderer
Change 3023415 on 2016/06/22 by Daniel.Wright
Fix crash in dx12 trying to clear stencil when there is no stencil in the depth target
Change 3024888 on 2016/06/23 by Daniel.Wright
Fixed preshadows being rendered redundantly with multiple lights
Change 3025119 on 2016/06/23 by Martin.Mittring
added MeshDecal content to RenderTest
Change 3025122 on 2016/06/23 by Martin.Mittring
enabled DBuffer for RenderTest
Change 3025153 on 2016/06/23 by Marc.Olano
Fix Spherical Particle Opacity. Particles using this stopped rendering sometime after 4.10.
Needed to use world space without shader offsets, not absolute world space.
Change 3025180 on 2016/06/23 by Marc.Olano
Use translated world space for particle centers.
Better fix for Spherical Particle Opacity problems, but with fingers in more pies. Includes rename of particle center vertex factory variables.
Change 3025265 on 2016/06/23 by David.Hill
Bilbords translucent during PIE - lighting model was incorrectly set in gbuffer
#jira UE-26165
Change 3025269 on 2016/06/23 by Ryan.Brucks
Adding new Testmap for Pixel Depth Offset velocities with Temporal AA
Change 3025345 on 2016/06/23 by Benjamin.Hyder
Submitting MeshDecal Content
Change 3025444 on 2016/06/23 by Benjamin.Hyder
updating content for MeshDecal
Change 3025491 on 2016/06/23 by Benjamin.Hyder
Updating DecalMesh Textures
Change 3025802 on 2016/06/23 by Martin.Mittring
added to readme
Change 3026475 on 2016/06/24 by Rolando.Caloca
DR - Show current state of r.RHIThread.Enable when not using param
Change 3026479 on 2016/06/24 by Rolando.Caloca
DR - Upgrade glslang to 1.0.17.0
Change 3026480 on 2016/06/24 by Rolando.Caloca
DR - Vulkan headers to 1.0.17.0
Change 3026481 on 2016/06/24 by Rolando.Caloca
DR - Vulkan wrapper for extra logging
Change 3026491 on 2016/06/24 by Rolando.Caloca
DR - Missed file
Change 3026574 on 2016/06/24 by Rolando.Caloca
DR - vk - Enabled fence reuse on 1.0.17.0
- Added more logging info
Change 3026656 on 2016/06/24 by Frank.Fella
Niagara - Prevent sequencer uobjects from being garbage collected.
Change 3026657 on 2016/06/24 by Benjamin.Hyder
Updating Rendertestmap to latest
Change 3026723 on 2016/06/24 by Rolando.Caloca
DR - Fix for ES3.1 RHIs
Change 3026784 on 2016/06/24 by Martin.Mittring
New feature: Mesh Decals / Material layers (Chris.Bunner is the goto person on MeshDecals from now on)
Change 3026866 on 2016/06/24 by Olaf.Piesche
#jira OR-18363
#jira UE-27780
fix distortion in particle macro uvs
[CL 3028922 by Gil Gribb in Main branch]
2016-06-27 13:42:20 -04:00
|
|
|
for (int32 Index = 0; Index < Callbacks.Num(); ++Index)
|
|
|
|
|
{
|
|
|
|
|
Callbacks[Index](Index < CallbacksData.Num() ? CallbacksData[Index] : nullptr, &Allocator, Nodes);
|
|
|
|
|
}
|
2015-10-28 08:58:16 -04:00
|
|
|
}
|
|
|
|
|
|
2014-11-03 11:36:09 -05:00
|
|
|
return bSuccess;
|
|
|
|
|
}
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3028916)
#lockdown nick.penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3006483 on 2016/06/08 by Simon.Tovey
Fix for UE-31653
Instance params from the Spawn, Required and TypeData modules were not being autopopulated.
Change 3006514 on 2016/06/08 by Zabir.Hoque
MIGRATING FIX @ Request
Off by 1 error on reflection roughness calculation affecting 4.12. When I hoisted the max mip index i did a -1 on both sides(c++ & hlsl). This is the simplest hotfix. In 4.13 I'll remove the shader instruction and only do the "-1" in c++ this 1 less shader instruction.
#CodeReview: Marcus.Wassmer, Daniel.Wright
Change 3006605 on 2016/06/08 by Rolando.Caloca
DR - vk - Remove a bunch of unused code, clean up some todos
Change 3006969 on 2016/06/08 by HaarmPieter.Duiker
Add #ifdefs around inverse tonemapping to avoid performance hit in normal use
Change 3007240 on 2016/06/09 by Chris.Bunner
Made a pass at fixing global shader compile warnings and errors.
Change 3007242 on 2016/06/09 by Chris.Bunner
Don't force unlit mode when re-loading a map.
#jira UE-31247
Change 3007243 on 2016/06/09 by Chris.Bunner
Cache InvalidLightmapSettings material for instanced meshes.
#jira UE-31182
Change 3007258 on 2016/06/09 by Chris.Bunner
Fixed refractive depth bias material parameter.
Change 3007466 on 2016/06/09 by Rolando.Caloca
DR - Use vulkan debug marker extension directly from header
Change 3007504 on 2016/06/09 by Martin.Mittring
added refresh button to ImageVerifier
Change 3007528 on 2016/06/09 by Martin.Mittring
ALU optimization to SSR, minor perf difference on NVTitan, needs to to be profiled on lower end
make render more deterministic
Change 3007551 on 2016/06/09 by Chris.Bunner
Reverted constant type change in previous commit.
Change 3007559 on 2016/06/09 by Martin.Mittring
updated ImageValidator
Change 3007584 on 2016/06/09 by Rolando.Caloca
DR - Fix case when not running under RD
Change 3007668 on 2016/06/09 by Rolando.Caloca
DR - vk - Split layers/extensions by required/optional
Change 3007820 on 2016/06/09 by Rolando.Caloca
DR - Android compile fix
Change 3007926 on 2016/06/09 by Martin.Mittring
fixed UI scaling in ImageVerifyer
Change 3007931 on 2016/06/09 by John.Billon
-Fixed cutouts not working for certain sized texture/subUV size combinations.
-Also fixed issue with subUV module not being postloaded consistently on startup.
#Jira UE-31583
Change 3008023 on 2016/06/09 by Martin.Mittring
refactor noise code in shaders
Change 3008127 on 2016/06/09 by Zabir.Hoque
Merging back hot fixes:
1. Fix DX12 crashing due to oclusion queries waiting on incorrect sync point. Integrating change from MS.
2. Immediate context should flush directly and not attempt to flush the immediate context, ie. itself.
Change 3008129 on 2016/06/09 by Daniel.Wright
Disabled r.ProfileGPU.PrintAssetSummary by default due to spam
Change 3008169 on 2016/06/09 by Rolando.Caloca
DR - Fix mobile rendering not freeing resource when using RHI thread
Change 3008429 on 2016/06/09 by Uriel.Doyon
Enabled texture streaming new metrics.
Added progress bar while texture streaming is being built.
Added debug shader validation to prevent crashes when there are uniform expression set mismatches.
Added texture streaming build to "Build All"
Change 3008436 on 2016/06/09 by Uriel.Doyon
Fixed shipping build
Change 3008833 on 2016/06/10 by Rolando.Caloca
DR - Allow RenderTargets to be easily shared via GPU to other DX or OpenGL applications
Submitted by Allar
PR #1864
#jira UE-24545
Change 3008842 on 2016/06/10 by Rolando.Caloca
DR - Remove vertex densities view mode
Change 3008857 on 2016/06/10 by John.Billon
Added a PostLoad to ParticleModuleSubUV to call postload on the SubUV animation to ensure that the animation is loaded in time for caching.
Change 3008870 on 2016/06/10 by Rolando.Caloca
DR - Rebuild hlslcc libs (missing from last merge)
Change 3008925 on 2016/06/10 by John.Billon
Fixed r.ScreenPercentage.Editor
#Jira UE-31549
Change 3009028 on 2016/06/10 by Daniel.Wright
Shadow depth refactor
* Shadow setup and render target allocation now happens in InitViews, and shadow depth rendering happens at one spot in the frame
* This provides control over where shadow depths are rendered for things like async compute, and allows easy atlasing of shadowmaps for forward shading
* The 33Mb of shadow depth buffers in FSceneRenderTargets has been removed, and shadow depth buffers are now allocated as needed
* A large amount of duplicated code to handle each shadow type has been combined
* Cleaner parallel rendering: no more view hacking for the shadow depth pass, no more shadow depths in the middle of translucency
* 'vis ShadowDepthAtlas' or 'vis WholeSceneShadowMap' must now be used to visualize the shadow depth textures
Change 3009032 on 2016/06/10 by Daniel.Wright
Fixed crash with simple forward shading in the material editor
Change 3009178 on 2016/06/10 by Rolando.Caloca
DR - Add support for multi callbacks on HlslParser, added a write to string callback
Change 3009268 on 2016/06/10 by Daniel.Wright
Warning fixes
Change 3009416 on 2016/06/10 by Martin.Mittring
moved decal rendering code in common spot for upcoming MeshDecal rendering
Change 3009433 on 2016/06/10 by John.Billon
Adding ensures for translucency lighting volume render target acesses.
#Jira UE-31578
Change 3009449 on 2016/06/10 by Daniel.Wright
Fixed whole scene point light shadow depths getting rendered redundantly
Change 3009675 on 2016/06/10 by Martin.Mittring
fixed Clang compiling
Change 3009815 on 2016/06/10 by Martin.Mittring
renamed IsUsedWithDeferredDecal to IsDeferredDecal
to be more correct
Change 3009946 on 2016/06/10 by Martin.Mittring
minor optimization
Change 3010270 on 2016/06/11 by HaarmPieter.Duiker
Update gamut transformations used when dumping EXRs to account for bug UE-29935
Change 3011423 on 2016/06/13 by Martin.Mittring
fixed default of bOutputsVelocityInBasePass
#code_review:Rolando.Caloca
#test:PC
Change 3011448 on 2016/06/13 by Martin.Mittring
minor engine code cleanup
#code_review:Olaf.Piesche
#test:PC
Change 3011991 on 2016/06/13 by Daniel.Wright
Fixed downsampled translucency crash in VR
Change 3011993 on 2016/06/13 by Daniel.Wright
Stationary Mobility for primitive components is allowed again, with the meaning 'moves rarely'
Mobility tooltips now reflect whether a primitive component or light component is being inspected
Change 3012096 on 2016/06/13 by Daniel.Wright
Missing file from cl 3011993
Change 3012546 on 2016/06/14 by John.Billon
Added r.ContactShadows.Enable CVar to allow contact shadows to be globally disabled/enabled
#Jira OR-23282
Change 3012706 on 2016/06/14 by John.Billon
Renamed r.ContactShadows.Enable to r.ContactShadows
Change 3012992 on 2016/06/14 by Rolando.Caloca
DR - vk - Fixed backbuffer/swapchain order with RHI thread enabled
- Added support for CustomPresent
Change 3013030 on 2016/06/14 by Rolando.Caloca
DR - vk - Fix dev issue
Change 3013423 on 2016/06/14 by Martin.Mittring
removed code redundancy for easier upcoming changes
#test:PC
Change 3013451 on 2016/06/14 by Martin.Mittring
removed no longer needed debug cvar
#test:PC
Change 3013643 on 2016/06/14 by Zabir.Hoque
Fix API only being inlined in the cpp and not avaialble in the .h
Change 3013696 on 2016/06/14 by Olaf.Piesche
Adding missing quality level spawn rate scaling on GPU emitters
Change 3013736 on 2016/06/14 by Daniel.Wright
Cached shadowmaps for whole scene point and spot light shadows
* Controlled by 'r.Shadow.CacheWholeSceneShadows', defaults to enabled (7ms -> 1.5ms of shadow depths on Titan for ~20 lights)
* Primitives with Static or Stationary mobility have their depths cached, as long as the light is not moving
* Primitives with Movable mobility or using World Position Offset in their materials will not have their depths cached
* Cached shadowmaps are copied each frame and then movable primitive depths composited
* Fast paths exist for when there were no static primitives (skip cached shadowmap) or movable primitives (project directly from cached shadowmap)
* 'r.Shadow.CacheWPOPrimitives' controls whether materials using WPO can be cached (default is off for correctness)
* 'r.Shadow.CachedShadowsCastFromMovablePrimitives' can be used to force off all support for movable primitives, skipping the shadowmap copies (1.5ms -> 0ms of shadow depths for ~20 lights)
Change 3014103 on 2016/06/15 by Daniel.Wright
Compile fix
Change 3014507 on 2016/06/15 by Simon.Tovey
Resurrected Niagara playground and moved to Samples/NotForLicencees
Change 3014931 on 2016/06/15 by Martin.Mittring
moved r.RenderInternals code into renderer to be able to access more low level data
#test:PC, paragon
Change 3014933 on 2016/06/15 by Martin.Mittring
nicer text
Change 3014956 on 2016/06/15 by Daniel.Wright
Fixed HLOD and mesh LODs getting hit by Lightmass ray traces that didn't originate from a mesh
Volume lighting samples and precomputed visibility cells are now only placed on LOD0 (of both mesh LODs and HLOD)
Change 3014985 on 2016/06/15 by Uriel.Doyon
Enabled Texture Build shaders on Mac
Exposed IStreamingManager::AddViewSlaveLocation in ENGINE_API
Fixed issue FStreamingManagerTexture::ConditionalUpdateStaticData which would to update some data in shipping.
Fixed r.Streaming.MipBias not affecting maximum allowed resolution, showing warnings of texture streaming overbudgets
#jira UE-30566
#jira UE-31098
Change 3014995 on 2016/06/15 by Rolando.Caloca
DR - vk - Removed RHI thread wait on acquire image
- Move Descriptor pool into context
Change 3015002 on 2016/06/15 by Rolando.Caloca
DR - Add (disabled) additional cvar for r.DumpShaderDebugWorkerCommandLine
Change 3015041 on 2016/06/15 by Martin.Mittring
fixed ImageValidator crashing when using files that exist only in ref or test folder
Change 3015309 on 2016/06/15 by Rolando.Caloca
DR - vk - Enable fence re-use on SDKs >= 1.0.16.0
Change 3015356 on 2016/06/15 by Rolando.Caloca
DR - vk - Prep for staging buffer refactor
Change 3015430 on 2016/06/15 by Martin.Mittring
minor optimization for subsurfacescatteringprofile
Change 3016097 on 2016/06/16 by Simon.Tovey
Enabling Niagara by default in the Niagara playground
Change 3016098 on 2016/06/16 by Simon.Tovey
Some misc fixup to get niagara working again
Change 3016183 on 2016/06/16 by Rolando.Caloca
DR - vk - Recreate buffer view for volatile buffers
Change 3016225 on 2016/06/16 by Marcus.Wassmer
Duplicate reflection fixes from 4.12 hotfixes.
Change 3016289 on 2016/06/16 by Chris.Bunner
Always gather MP_Normal definitions as they can be shared by other material properties.
#jira UE-31792
Change 3016294 on 2016/06/16 by Daniel.Wright
Fix for ensure accessing CVarCacheWPOPrimitives in game
Change 3016305 on 2016/06/16 by Daniel.Wright
Raised r.Shadow.CSM.MaxCascades to 10 on Epic scalability level, which it should have always been
Change 3016330 on 2016/06/16 by Daniel.Wright
Cached shadowmaps are tossed after 5s of not being used for rendering - helps in the case where you fly through a bunch of lights and never look back
Skipping shadow depth cubemap clear if there will be a cached shadowmap copy later - saves .4ms on PS4 for a close up point light
Stats for shadowmap memory used under 'stat shadowrendering'
Change 3016506 on 2016/06/16 by Daniel.Wright
Fixed crash building map in SunTemple due to null access
Change 3016703 on 2016/06/16 by Uriel.Doyon
Fixed warning due to floating point imprecision when building texture streaming
Change 3016718 on 2016/06/16 by Daniel.Wright
Volume lighting samples use adaptive sampling final gather
* Increases their build time by 2x but improves quality in difficult cases (small bright sources of bounce lighting)
Change 3016871 on 2016/06/16 by Max.Chen
Sequencer: Added support for the named "PerformanceCapture" event which like Matinee, calls GEngine->PerformanceCapture to output a screenshot when the event fires. Refactor event track/sections so that the player is passed to the trigger events evaluation.
Copy from Dev-Sequencer
#jira UE-32093
Change 3017189 on 2016/06/16 by Zabir.Hoque
Fix GBuffer format selection type-o.
#CodeReview: Marcus.Wassmer
Change 3017241 on 2016/06/16 by Martin.Mittring
optimized and cleaned up rendering in transluceny, distortion, custom mesh drawing
#code_review:Daniel.Wright, Marcus.Wassmer, Nick.Penwarden
Change 3017856 on 2016/06/17 by Rolando.Caloca
DR - Missing GL enum
Change 3017910 on 2016/06/17 by Ben.Woodhouse
- Added a Video Buffer to ensure smooth submission of frames from CEF. Without this, we can get multiple texture updates per engine frame, which causes stuttering at high framerates
- Disable hardware acceleration on Windows, since this causes severe performance issues with video rendering
Please note: To actually see 60fps video, you need to ensure the browser frame rate passed into FWebBrowserSingleton::CreateBrowserWindow is set to 60 (default is 24)
#RB:Keli.Hloedversson,Martin.Mittring
Change 3018126 on 2016/06/17 by Ben.Woodhouse
Fix build warning on Mac
#RB:David.Hill
Change 3018167 on 2016/06/17 by Chris.Bunner
Handle case when float4 is passed to TransformPosition material node.
#jira UE-24980
Change 3018246 on 2016/06/17 by Benjamin.Hyder
Submitting Preliminary ShadowRefactor TestMap
Change 3018330 on 2016/06/17 by Benjamin.Hyder
labeled ShadowRefactor map
Change 3018377 on 2016/06/17 by Chris.Bunner
Removed additional node creation when initializing a RotateAboutAxis node.
#jira UE-8034
Change 3018433 on 2016/06/17 by Rolando.Caloca
DR - Fix some clang warnings on Vulkan
Change 3018664 on 2016/06/17 by Martin.Mittring
unified some code for easier maintainance, fixed missing multiply from former change (CL 2933812)
#test:PC
#code_review:Marcus.Wassmer,Brian.Karis
Change 3019023 on 2016/06/19 by Benjamin.Hyder
Re-Labeled ShadowRefactor map
Change 3019024 on 2016/06/19 by Benjamin.Hyder
Correcting Translucent Volume (Non-Directional) settings
Change 3019026 on 2016/06/19 by Benjamin.Hyder
Correcting Lighting ShadowRefactor map
Change 3019414 on 2016/06/20 by Allan.Bentham
Refactor mobile shadows
Change 3019494 on 2016/06/20 by Gil.Gribb
Merging //UE4/Dev-Main@3018959 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3019504 on 2016/06/20 by John.Billon
-Created a blueprint node (ExportRenderTarget and ExportTexture2D) to export render targets/textures as HDR images to disk.
-Moved HDR export code(FHDRExportHelper and CubemapUnwrapUtils) to runtime from editor to allow access from blueprints.
-Created a small common interface for blueprints and the editor itself to use for exporting.
#Jira UE-31429
Change 3019561 on 2016/06/20 by Gil.Gribb
UE4 - Worked around afulness of windows scheduler. This would occasionally cause hitches on quad core machines with additional load in the tick task manager.
Change 3019616 on 2016/06/20 by Rolando.Caloca
DR - Replicate change in DevRendering to fix splotches on characters with morph targets
Change: 3019599
O - Fix flickering on heroes with morph targets
Change 3019627 on 2016/06/20 by Rolando.Caloca
DR - Doh! Compile fix
Change 3019674 on 2016/06/20 by Simon.Tovey
Ripped out the quick hacky VM debugger I wrote a while back.
Over complicated the VM and didn't do enough work to justify it.
Will revisit debugging and profiling of VM scripts in future.
Change 3019691 on 2016/06/20 by Ben.Woodhouse
Add a per-object shadow setting for directional lights (r.Shadow.PerObjectDirectionalDepthBias), which is independent of the CSM setting. Often a smaller bias is desirable on per-object shadows, where detailed self-shadowing is needed.
This change also makes the CSM naming consistent with what the setting actually does (the old setting was named r.shadow.csm, although it affects per-object shadows as well as CSMs).
#RB:Martin.Mittring, Daniel.Wright
Change 3019741 on 2016/06/20 by John.Billon
Fixed compile error on mac.
Change 3019984 on 2016/06/20 by Martin.Mittring
minor optimization
Change 3020172 on 2016/06/20 by Zachary.Wilson
Fixing mesh distance fields for engine content cube and cylinder by setting distance field resolution to 2. for UE-26783 #rb: none
Change 3020195 on 2016/06/20 by Zachary.Wilson
Fixing engine coontent sphere's distance fields for UE-26783, distance fields resolution set to 2. #rb: none
Change 3020196 on 2016/06/20 by Rolando.Caloca
DR - Appease static analysis
Change 3020231 on 2016/06/20 by Zachary.Wilson
Making basic shapes consistent distance field resolution scale. #rb: none
Change 3020468 on 2016/06/20 by David.Hill
CameraWS UE-29146
Change 3020502 on 2016/06/20 by Benjamin.Hyder
Adding AutomationMatinee Camera for RenderOutputValidation
Change 3020508 on 2016/06/20 by Benjamin.Hyder
Adding AutomationMatinee for RenderOutputValidation
Change 3020514 on 2016/06/20 by Benjamin.Hyder
Setting Autoplay for AutomationMatinee (sequence)
Change 3020561 on 2016/06/20 by Daniel.Wright
Removed outdated comment on uniform expression assert
Change 3021268 on 2016/06/21 by Daniel.Wright
Scaled sphere intersection for indirect capsule shadows
* Fixes the discontinuity when capsule axis points close to the light direction
* GPU cost is effectively the same (more expensive to compute, but tighter culling)
Change 3021325 on 2016/06/21 by Daniel.Wright
Split ShadowRendering.cpp into ShadowDepthRendering.cpp
Change 3021355 on 2016/06/21 by Daniel.Wright
Fixed RTDF shadows (broken by shadowmap caching)
Change 3021444 on 2016/06/21 by Daniel.Wright
Fixed crash due to Depth drawing policy not using the default material shader map properly
Change 3021543 on 2016/06/21 by Daniel.Wright
Fixed drawing to a Canvas after EndDrawCanvasToRenderTarget causing a crash
Fixed DrawMaterialToRenderTarget breaking the Canvas object that BeginDrawCanvasToRenderTarget returns
Change 3021749 on 2016/06/21 by Daniel.Wright
Moved RenderBasePass and dependencies into BasePassRendering.cpp
Moved RenderPrePass and dependencies into DepthRendering.cpp
Change 3021766 on 2016/06/21 by Benjamin.Hyder
Adding 150dynamiclights level to Dev-Folder
Change 3021971 on 2016/06/21 by Daniel.Wright
Removed the CPU-culled light grid which is used to implement TLM_SurfacePerPixelLighting, in preparation for a GPU-culled light grid implementation
* TLM_SurfacePerPixelLighting now behaves like TLM_Surface
Change 3022760 on 2016/06/22 by Chris.Bunner
Merge fixup.
Change 3022911 on 2016/06/22 by Rolando.Caloca
DR - Added r.D3DDumpD3DAsmFile to enable dumping the fxc disassembly when dumping shaders
Change 3023037 on 2016/06/22 by Rolando.Caloca
DR - Fix for the case of global destructors calling FlushRenderingCommands() after the RHI has been destroyed
Change 3023139 on 2016/06/22 by Daniel.Wright
Added on screen message for when VisualizeMeshDistanceFields is requested but engine scalability settings have DFAO disabled
Change 3023231 on 2016/06/22 by Daniel.Wright
Only allowing opaque per-object shadows or CSM in the mobile renderer
Change 3023415 on 2016/06/22 by Daniel.Wright
Fix crash in dx12 trying to clear stencil when there is no stencil in the depth target
Change 3024888 on 2016/06/23 by Daniel.Wright
Fixed preshadows being rendered redundantly with multiple lights
Change 3025119 on 2016/06/23 by Martin.Mittring
added MeshDecal content to RenderTest
Change 3025122 on 2016/06/23 by Martin.Mittring
enabled DBuffer for RenderTest
Change 3025153 on 2016/06/23 by Marc.Olano
Fix Spherical Particle Opacity. Particles using this stopped rendering sometime after 4.10.
Needed to use world space without shader offsets, not absolute world space.
Change 3025180 on 2016/06/23 by Marc.Olano
Use translated world space for particle centers.
Better fix for Spherical Particle Opacity problems, but with fingers in more pies. Includes rename of particle center vertex factory variables.
Change 3025265 on 2016/06/23 by David.Hill
Bilbords translucent during PIE - lighting model was incorrectly set in gbuffer
#jira UE-26165
Change 3025269 on 2016/06/23 by Ryan.Brucks
Adding new Testmap for Pixel Depth Offset velocities with Temporal AA
Change 3025345 on 2016/06/23 by Benjamin.Hyder
Submitting MeshDecal Content
Change 3025444 on 2016/06/23 by Benjamin.Hyder
updating content for MeshDecal
Change 3025491 on 2016/06/23 by Benjamin.Hyder
Updating DecalMesh Textures
Change 3025802 on 2016/06/23 by Martin.Mittring
added to readme
Change 3026475 on 2016/06/24 by Rolando.Caloca
DR - Show current state of r.RHIThread.Enable when not using param
Change 3026479 on 2016/06/24 by Rolando.Caloca
DR - Upgrade glslang to 1.0.17.0
Change 3026480 on 2016/06/24 by Rolando.Caloca
DR - Vulkan headers to 1.0.17.0
Change 3026481 on 2016/06/24 by Rolando.Caloca
DR - Vulkan wrapper for extra logging
Change 3026491 on 2016/06/24 by Rolando.Caloca
DR - Missed file
Change 3026574 on 2016/06/24 by Rolando.Caloca
DR - vk - Enabled fence reuse on 1.0.17.0
- Added more logging info
Change 3026656 on 2016/06/24 by Frank.Fella
Niagara - Prevent sequencer uobjects from being garbage collected.
Change 3026657 on 2016/06/24 by Benjamin.Hyder
Updating Rendertestmap to latest
Change 3026723 on 2016/06/24 by Rolando.Caloca
DR - Fix for ES3.1 RHIs
Change 3026784 on 2016/06/24 by Martin.Mittring
New feature: Mesh Decals / Material layers (Chris.Bunner is the goto person on MeshDecals from now on)
Change 3026866 on 2016/06/24 by Olaf.Piesche
#jira OR-18363
#jira UE-27780
fix distortion in particle macro uvs
[CL 3028922 by Gil Gribb in Main branch]
2016-06-27 13:42:20 -04:00
|
|
|
|
|
|
|
|
bool Parse(const FString& Input, const FString& Filename, FCompilerMessages& OutCompilerMessages, TCallback* Callback, void* CallbackData)
|
|
|
|
|
{
|
|
|
|
|
TArray<TCallback*> Callbacks;
|
|
|
|
|
TArray<void*> CallbacksData;
|
|
|
|
|
if (Callback)
|
|
|
|
|
{
|
|
|
|
|
Callbacks.Add(Callback);
|
|
|
|
|
CallbacksData.Add(CallbackData);
|
|
|
|
|
}
|
|
|
|
|
return Parse(Input, Filename, OutCompilerMessages, Callbacks, CallbacksData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WriteNodesToString(void* OutFStringPointer, CrossCompiler::FLinearAllocator* Allocator, CrossCompiler::TLinearArray<CrossCompiler::AST::FNode*>& ASTNodes)
|
|
|
|
|
{
|
|
|
|
|
check(OutFStringPointer);
|
|
|
|
|
FString& OutGeneratedCode = *(FString*)OutFStringPointer;
|
|
|
|
|
CrossCompiler::AST::FASTWriter Writer(OutGeneratedCode);
|
|
|
|
|
for (auto* Node : ASTNodes)
|
|
|
|
|
{
|
|
|
|
|
Node->Write(Writer);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-03 11:36:09 -05:00
|
|
|
}
|
|
|
|
|
}
|