Parser - main-output instruction

This commit is contained in:
Emmanuel BENOîT 2017-11-10 21:56:28 +01:00
parent 1ee448a4c0
commit a455f2ad40
4 changed files with 24 additions and 1 deletions

View file

@ -43,7 +43,7 @@ syn keyword srdKWDefAsset program pipeline input framebuffer texture sampler
syn keyword srdKWDebug profiling odbg ui-overrides
syn keyword srdKWState use-texture use-framebuffer use-program use-pipeline
syn keyword srdKWState uniforms uniforms-i viewport
syn keyword srdKWState uniforms uniforms-i viewport main-output
syn keyword srdKWDraw fullscreen

View file

@ -102,6 +102,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_USE_FRAMEBUFFER: case A_Node::OP_USE_PIPELINE:
case A_Node::OP_USE_PROGRAM: case A_Node::OP_USE_TEXTURE:

View file

@ -26,6 +26,7 @@ class A_Node
OP_FULLSCREEN , // Draw a fullscreen quad
OP_INPUT , // Input declaration
OP_LOCALS , // Declare local variables
OP_MAINOUT , // Select the output buffer
OP_ODBG , // Output debugging
OP_PIPELINE , // Shader pipeline declaration
OP_PROFILE , // Profiling block
@ -511,6 +512,15 @@ class T_LocalsInstrNode : public A_InstructionNode
{ return varLocs_[ index ]; }
};
// Main output selection
class T_MainOutputInstrNode : public A_InstructionNode
{
public:
T_MainOutputInstrNode( T_InstrListNode& parent ) noexcept
: A_InstructionNode( OP_MAINOUT , parent , E_InstrRestriction::INIT )
{ }
};
// Output debugging
class T_OutputDebugInstrNode : public A_InstructionNode
{

View file

@ -19,6 +19,7 @@ struct T_ParserImpl_
IF ,
INPUT ,
LOCALS ,
MAINOUT ,
ODBG ,
PIPELINE ,
PROFILE ,
@ -47,6 +48,7 @@ struct T_ParserImpl_
add( "if" , E_InstrType::IF );
add( "input" , E_InstrType::INPUT );
add( "locals" , E_InstrType::LOCALS );
add( "main-output" , E_InstrType::MAINOUT );
add( "odbg" , E_InstrType::ODBG );
add( "pipeline" , E_InstrType::PIPELINE );
add( "profiling" , E_InstrType::PROFILE );
@ -505,7 +507,17 @@ void T_ParserImpl_::parseInstructions(
M_CASE_( USE_TEXTURE , UseTexture );
M_CASE_( VIEWPORT , Viewport );
case E_InstrType::MAINOUT:
if ( ilist.size( ) != 1 ) {
errors.addNew( "too many arguments" , iname.location( ) );
}
instructions.add< T_MainOutputInstrNode >( ).location( ) = iname.location( );
break;
case E_InstrType::FULLSCREEN:
if ( ilist.size( ) != 1 ) {
errors.addNew( "too many arguments" , iname.location( ) );
}
instructions.add< T_FullscreenInstrNode >( ).location( ) = iname.location( );
break;
}