Parser - Overrides stored in the AST

This commit is contained in:
Emmanuel BENOîT 2017-11-17 20:33:56 +01:00
parent 3a59078323
commit 12f580d384
6 changed files with 39 additions and 2 deletions

2
ebcl

@ -1 +1 @@
Subproject commit 1ce16d63cbed4b152cd113121ecb06fb8358b9f1
Subproject commit 5db261909a4883faf80a89a3211a11c9c5dfd7f0

View file

@ -1,5 +1,6 @@
#include "externals.hh"
#include "opast.hh"
#include "sync.hh"
#include <ebcl/Algorithms.hh>
using namespace ebcl;
@ -102,7 +103,7 @@ A_Node* opast::ASTVisitorBrowser(
case A_Node::OP_PROGRAM: case A_Node::OP_PIPELINE:
case A_Node::OP_INPUT: case A_Node::OP_FULLSCREEN:
case A_Node::OP_ODBG: case A_Node::OP_LOCALS:
case A_Node::OP_MAINOUT:
case A_Node::OP_MAINOUT: case A_Node::OP_OVERRIDES:
//
case A_Node::OP_USE_FRAMEBUFFER: case A_Node::OP_USE_PIPELINE:
case A_Node::OP_USE_PROGRAM: case A_Node::OP_USE_TEXTURE:

View file

@ -4,6 +4,8 @@
#include <ebcl/Sets.hh>
struct T_SyncOverrideSection;
namespace opast {
@ -31,6 +33,7 @@ class A_Node
OP_LOCALS , // Declare local variables
OP_MAINOUT , // Select the output buffer
OP_ODBG , // Output debugging
OP_OVERRIDES , // Register input overrides
OP_PIPELINE , // Shader pipeline declaration
OP_PROFILE , // Profiling block
OP_PROGRAM , // Shader program declaration
@ -949,6 +952,24 @@ class T_OutputDebugInstrNode : public A_InstructionNode
{ return locDescription_; }
};
// User interface overrides for inputs
class T_OverridesInstrNode : public A_InstructionNode
{
private:
T_OwnPtr< T_SyncOverrideSection > overrides_;
public:
T_OverridesInstrNode(
T_InstrListNode& parent ,
T_OwnPtr< T_SyncOverrideSection > overrides ) noexcept
: A_InstructionNode( OP_OVERRIDES , parent , E_InstrRestriction::FRAME ) ,
overrides_( std::move( overrides ) )
{ }
T_SyncOverrideSection& root( ) const noexcept
{ return *overrides_; }
};
// Profiling instruction
class T_ProfileInstrNode : public A_InstructionNode
{

View file

@ -1394,7 +1394,12 @@ M_INSTR_( Overrides )
errors.addNew( "too many errors in UI overrides list" ,
input[ 0 ].location( ) );
}
return;
}
auto& instr{ instructions.add< T_OverridesInstrNode >(
ovParser.getData< T_SharedPtr< T_SyncOverrideSection > >( ).makeOwned( ) ) };
instr.location( ) = input[ 0 ].location( );
}
/*----------------------------------------------------------------------------*/

View file

@ -171,6 +171,7 @@ class A_SyncOverride
private:
const T_String type_;
bool enabled_{ false };
ebcl::T_SRDLocation location_;
protected:
ebcl::T_Buffer< char > title_;
@ -197,6 +198,11 @@ class A_SyncOverride
bool enabled( ) const noexcept
{ return enabled_; }
ebcl::T_SRDLocation& location( ) noexcept
{ return location_; }
ebcl::T_SRDLocation const& location( ) const noexcept
{ return location_; }
// Connect the required inputs to the sync manager. Called once
// the inputs have been added.
virtual void setup( ) noexcept;

View file

@ -50,6 +50,7 @@ bool EnterFloat1_( T_SRDParserData const& data )
auto const& input( *( data.input ) );
SP_Float ptr{ NewShared< T_Float >(
input[ 1 ].stringValue( ) , input[ 2 ].stringValue( ) ) };
ptr->location( ) = input[ 0 ].location( );
*( data.targetData ) = std::move( ptr );
return true;
}
@ -60,6 +61,7 @@ bool EnterFloat2_( T_SRDParserData const& data )
SP_Float ptr{ NewShared< T_Float2 >(
input[ 1 ].stringValue( ) , input[ 2 ].stringValue( ) ,
input[ 3 ].stringValue( ) ) };
ptr->location( ) = input[ 0 ].location( );
*( data.targetData ) = std::move( ptr );
return true;
}
@ -70,6 +72,7 @@ bool EnterFloat3_( T_SRDParserData const& data )
SP_Float ptr{ NewShared< T_Float3 >(
input[ 1 ].stringValue( ) , input[ 2 ].stringValue( ) ,
input[ 3 ].stringValue( ) , input[ 4 ].stringValue( ) ) };
ptr->location( ) = input[ 0 ].location( );
*( data.targetData ) = std::move( ptr );
return true;
}
@ -81,6 +84,7 @@ bool EnterFloat4_( T_SRDParserData const& data )
input[ 1 ].stringValue( ) , input[ 2 ].stringValue( ) ,
input[ 3 ].stringValue( ) , input[ 4 ].stringValue( ) ,
input[ 5 ].stringValue( ) ) };
ptr->location( ) = input[ 0 ].location( );
*( data.targetData ) = std::move( ptr );
return true;
}