Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 29 additions & 22 deletions source/GlslCommon/GenerateGlslStatements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1531,37 +1531,32 @@
static bool isScopeBeginStatement( StatementType value )
{
return value == glsl::StatementType::eNone
|| value == glsl::StatementType::eStructureDecl
|| value == glsl::StatementType::eStructureMemberDecl
|| value == glsl::StatementType::eFunctionDecl
|| value == glsl::StatementType::eVariableDecl
|| value == glsl::StatementType::eVariableBlockDecl
|| value == glsl::StatementType::eBuiltinVariableDecl
|| value == glsl::StatementType::eScopeLine
|| value == glsl::StatementType::eStructureScopeEnd
|| value == glsl::StatementType::eFunctionScopeEnd
|| value == glsl::StatementType::eLexicalScopeEnd
|| value == glsl::StatementType::eControlBegin
|| value == glsl::StatementType::eControlEnd;
|| value == glsl::StatementType::eStructureScopeBegin
|| value == glsl::StatementType::eFunctionScopeBegin
|| value == glsl::StatementType::eLexicalScopeBegin
|| value == glsl::StatementType::eControlBegin;
}

static bool isScopeEndStatement( StatementType value )
{
return value == glsl::StatementType::eNone
|| value == glsl::StatementType::eStructureDecl
|| value == glsl::StatementType::eStructureMemberDecl
|| value == glsl::StatementType::eFunctionDecl
|| value == glsl::StatementType::eVariableDecl
|| value == glsl::StatementType::eVariableBlockDecl
|| value == glsl::StatementType::eBuiltinVariableDecl
|| value == glsl::StatementType::eScopeLine
|| value == glsl::StatementType::eStructureScopeBegin
|| value == glsl::StatementType::eFunctionScopeBegin
|| value == glsl::StatementType::eLexicalScopeBegin
|| value == glsl::StatementType::eControlBegin;
|| value == glsl::StatementType::eStructureScopeEnd
|| value == glsl::StatementType::eFunctionScopeEnd
|| value == glsl::StatementType::eLexicalScopeEnd
|| value == glsl::StatementType::eControlEnd;
}

static bool isScopeDeclStatement( StatementType value )

Check failure on line 1559 in source/GlslCommon/GenerateGlslStatements.cpp

View workflow job for this annotation

GitHub Actions / build-linux-clang (ubuntu-latest, x64-linux, clang, Release)

unused function 'isScopeDeclStatement' [-Werror,-Wunused-function]

Check failure on line 1559 in source/GlslCommon/GenerateGlslStatements.cpp

View workflow job for this annotation

GitHub Actions / build-macos (macos-latest, x64-osx, clang, Release)

unused function 'isScopeDeclStatement' [-Werror,-Wunused-function]
{
return value == glsl::StatementType::eNone
|| value == glsl::StatementType::eScopeLine
Expand All @@ -1578,12 +1573,19 @@
|| value == glsl::StatementType::eControlEnd;
}

static void addLineEnd( Statements & result
, uint32_t & line )
{
result.source += "\n";
++line;
}

static void doAddStatement( std::string text
, Statements & result
, uint32_t & line )
{
result.source += std::move( text ) + "\n";
++line;
result.source += std::move( text );
addLineEnd( result, line );
}
}

Expand Down Expand Up @@ -2549,27 +2551,31 @@
, ast::stmt::Stmt const * scope = nullptr )
{
if ( ( helpers::isScopeEndStatement( m_lastStmtType )
&& !helpers::isScopeEndStatement( type ) )
|| ( helpers::isScopeDeclStatement( type )
&& !helpers::isScopeBeginStatement( m_lastStmtType ) ) )
&& !helpers::isScopeEndStatement( type )
&& text != "else" )
|| ( !helpers::isScopeBeginStatement( m_lastStmtType )
&& helpers::isScopeBeginStatement( type )
&& m_lastStmtType != StatementType::eFunctionDecl
&& m_lastStmtType != StatementType::eStructureDecl
&& m_lastStmtType != StatementType::eVariableBlockDecl
&& text != "else" ) )
{
++m_currentLine;
m_result.source += "\n";
helpers::addLineEnd( m_result, m_currentLine );
}

Statement current;
current.type = type;
current.stmt = &stmt;
auto length = uint32_t( text.size() );
m_result.source += m_indents.back() + std::move( text ) + "\n";
m_result.source += m_indents.back() + std::move( text );
current.source.lines.start = m_currentLine;
current.source.columns.start = uint32_t( m_indents.back().size() );
current.source.columns.end = current.source.columns.start + length;
current.source.scope = scope ? scope : getCurrentScope();
current.exprs = std::move( exprs );
m_result.statements.push_back( std::move( current ) );

++m_currentLine;
helpers::addLineEnd( m_result, m_currentLine );
m_lastStmtType = type;
}

Expand Down Expand Up @@ -3254,6 +3260,7 @@
decl += m_indents.back() + "\tfloat gl_ClipDistance[];\n";
decl += m_indents.back() + "\tfloat gl_CullDistance[];\n";
decl += m_indents.back() + "}";
m_currentLine += m_currentLine += 6u;

switch ( stmt->getSource() )
{
Expand Down
Loading