Diligent Engine  v.2.4.g
Namespaces | Macros | Functions
HLSL2GLSLConverterImpl.cpp File Reference
#include "pch.h"
#include <unordered_set>
#include <string>
#include "HLSL2GLSLConverterImpl.hpp"
#include "GraphicsAccessories.hpp"
#include "DataBlobImpl.hpp"
#include "StringDataBlobImpl.hpp"
#include "StringTools.hpp"
#include "EngineMemory.h"
#include "GLSLDefinitions_inc.h"

Namespaces

 Diligent
 The library uses Direct3D-style math:
 

Macros

#define DEFINE_KEYWORD(keyword)   m_HLSLKeywords.insert(std::make_pair(#keyword, TokenInfo(TokenType::kw_##keyword, #keyword)));
 
#define DEFINE_GET_DIM_STUB(Name, Obj, NumArgs)   m_GLSLStubs.emplace(make_pair(FunctionStubHashKey(Pref + Obj + Suff, "GetDimensions", NumArgs), GLSLStubInfo(Name, "")))
 
#define DEFINE_STUB(Name, Obj, Func, NumArgs)   m_GLSLStubs.emplace(make_pair(FunctionStubHashKey(Obj, Func, NumArgs), GLSLStubInfo(Name, Swizzle)))
 
#define DEFINE_ATOMIC_OP_STUBS(Op)
 
#define DEFINE_VARIABLE(ShaderInd, IsOut, Semantic, Variable)   m_HLSLSemanticToGLSLVar[ShaderInd][IsOut].emplace(make_pair(HashMapStringKey(Semantic), Variable))
 
#define VERIFY_PARSER_STATE(Token, Condition, ...)
 
#define COPY_SYMBOL()
 
#define CHECK_END(...)
 
#define BRACKET_CASE(Symbol, TokenType, Action)
 
#define CHECK_EOF()   VERIFY_PARSER_STATE(Token, Token != m_Tokens.end(), "Unexpected EOF in ", TexDeclToken->Literal, " declaration")
 

Functions

bool Diligent::IsWhitespace (Char Symbol)
 
bool Diligent::IsNewLine (Char Symbol)
 
bool Diligent::IsDelimiter (Char Symbol)
 
bool Diligent::IsStatementSeparator (Char Symbol)
 
bool Diligent::SkipDelimeters (const String &Input, String::const_iterator &SrcChar)
 
template<typename IteratorType >
bool Diligent::SkipDelimetersAndComments (const String &Input, IteratorType &SrcChar)
 
bool Diligent::SkipIdentifier (const String &Input, String::const_iterator &SrcChar)
 
String Diligent::CompressNewLines (const String &Str)
 
template<typename IterType >
bool Diligent::SkipPrefix (const Char *RefStr, IterType &begin, IterType end)
 
void Diligent::ReadNumericConstant (const String &Source, String::const_iterator &Pos, String &Output)
 
void Diligent::ParseImageFormat (const String &Comment, String &ImageFormat)
 
void Diligent::InitVariable (const String &Name, const String &InitValue, std::stringstream &OutSS)
 
void Diligent::DefineInterfaceVar (int location, const char *inout, const String &ParamType, const String &ParamName, std::stringstream &OutSS)
 
void Diligent::ParseAttributesInComment (const String &Comment, std::unordered_map< HashMapStringKey, String, HashMapStringKey::Hasher > &Attributes)
 

Macro Definition Documentation

◆ BRACKET_CASE

#define BRACKET_CASE (   Symbol,
  TokenType,
  Action 
)
Value:
case Symbol: \
NewToken.Type = TokenType; \
NewToken.Literal.push_back(*(SrcPos++)); \
Action; \
break;

◆ CHECK_END

#define CHECK_END (   ...)
Value:
do \
{ \
if (SrcPos == Source.end()) \
{ \
LOG_ERROR_MESSAGE(__VA_ARGS__); \
break; \
} \
} while (false)

◆ CHECK_EOF

#define CHECK_EOF ( )    VERIFY_PARSER_STATE(Token, Token != m_Tokens.end(), "Unexpected EOF in ", TexDeclToken->Literal, " declaration")

◆ COPY_SYMBOL

#define COPY_SYMBOL ( )
Value:
{ \
Output.push_back(*(Pos++)); \
if (Pos == Source.end()) return; \
}

◆ DEFINE_ATOMIC_OP_STUBS

#define DEFINE_ATOMIC_OP_STUBS (   Op)
Value:
DEFINE_STUB("Interlocked" Op "SharedVar_2", "shared_var", "Interlocked" Op, 2); \
DEFINE_STUB("Interlocked" Op "SharedVar_3", "shared_var", "Interlocked" Op, 3); \
DEFINE_STUB("Interlocked" Op "Image_2", "image", "Interlocked" Op, 2); \
DEFINE_STUB("Interlocked" Op "Image_3", "image", "Interlocked" Op, 3); \
m_AtomicOperations.insert(HashMapStringKey("Interlocked" Op));

◆ DEFINE_GET_DIM_STUB

#define DEFINE_GET_DIM_STUB (   Name,
  Obj,
  NumArgs 
)    m_GLSLStubs.emplace(make_pair(FunctionStubHashKey(Pref + Obj + Suff, "GetDimensions", NumArgs), GLSLStubInfo(Name, "")))

◆ DEFINE_KEYWORD

#define DEFINE_KEYWORD (   keyword)    m_HLSLKeywords.insert(std::make_pair(#keyword, TokenInfo(TokenType::kw_##keyword, #keyword)));

◆ DEFINE_STUB

#define DEFINE_STUB (   Name,
  Obj,
  Func,
  NumArgs 
)    m_GLSLStubs.emplace(make_pair(FunctionStubHashKey(Obj, Func, NumArgs), GLSLStubInfo(Name, Swizzle)))

◆ DEFINE_VARIABLE

#define DEFINE_VARIABLE (   ShaderInd,
  IsOut,
  Semantic,
  Variable 
)    m_HLSLSemanticToGLSLVar[ShaderInd][IsOut].emplace(make_pair(HashMapStringKey(Semantic), Variable))

◆ VERIFY_PARSER_STATE

#define VERIFY_PARSER_STATE (   Token,
  Condition,
  ... 
)
Value:
do \
{ \
if (!(Condition)) \
{ \
auto err = FormatString(__VA_ARGS__); \
LOG_ERROR_AND_THROW(err, "\n", PrintTokenContext(Token, 4)); \
} \
} while (false)
DEFINE_STUB
#define DEFINE_STUB(Name, Obj, Func, NumArgs)
Diligent::FormatString
std::string FormatString(const RestArgsType &... Args)
Definition: FormatString.hpp:55