Optimizer - Fixed input handling
This commit is contained in:
parent
d3b1883693
commit
965496b231
3 changed files with 21 additions and 11 deletions
|
@ -66,10 +66,10 @@ void T_OptData::findInputDecls(
|
||||||
visitor.visit( program.root , [this]( A_Node& node , const bool exit ) {
|
visitor.visit( program.root , [this]( A_Node& node , const bool exit ) {
|
||||||
if ( exit && node.type( ) == A_Node::OP_INPUT ) {
|
if ( exit && node.type( ) == A_Node::OP_INPUT ) {
|
||||||
auto& input{ (T_InputInstrNode&) node };
|
auto& input{ (T_InputInstrNode&) node };
|
||||||
auto* da{ inputDecls->get( input.id( ) ) };
|
auto* da{ inputDecls.get( input.id( ) ) };
|
||||||
if ( !da ) {
|
if ( !da ) {
|
||||||
inputDecls->add( input.id( ) , T_Array< T_InputDecl >{ } );
|
inputDecls.add( input.id( ) , T_Array< T_InputDecl >{ } );
|
||||||
da = inputDecls->get( input.id( ) );
|
da = inputDecls.get( input.id( ) );
|
||||||
}
|
}
|
||||||
da->add( T_InputDecl{ input.location( ) , input.defValue( ) } );
|
da->add( T_InputDecl{ input.location( ) , input.defValue( ) } );
|
||||||
}
|
}
|
||||||
|
@ -1275,8 +1275,7 @@ P_ExpressionNode T_ConstantFolder_::doInputExpr(
|
||||||
return NewOwned< T_ConstantExprNode >( node.parent( ) , *cval );
|
return NewOwned< T_ConstantExprNode >( node.parent( ) , *cval );
|
||||||
}
|
}
|
||||||
|
|
||||||
assert( oData.inputDecls );
|
auto const* const dva{ oData.inputDecls.get( node.id( ) ) };
|
||||||
auto const* const dva{ oData.inputDecls->get( node.id( ) ) };
|
|
||||||
assert( dva );
|
assert( dva );
|
||||||
if ( dva->size( ) == 1 ) {
|
if ( dva->size( ) == 1 ) {
|
||||||
// If there's only one default value, that's a constant.
|
// If there's only one default value, that's a constant.
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct T_OptData
|
||||||
ebcl::T_SRDLocation location;
|
ebcl::T_SRDLocation location;
|
||||||
float value;
|
float value;
|
||||||
};
|
};
|
||||||
T_Optional< T_KeyValueTable< T_String , T_Array< T_InputDecl > > > inputDecls;
|
T_KeyValueTable< T_String , T_Array< T_InputDecl > > inputDecls;
|
||||||
|
|
||||||
void findInputDecls( T_OpsParserOutput& program ) noexcept;
|
void findInputDecls( T_OpsParserOutput& program ) noexcept;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(cfg "Optimized"
|
(cfg "OptimizedFixed"
|
||||||
(resolutions
|
(resolutions
|
||||||
(1280 720)
|
(1280 720)
|
||||||
(1920 1080)
|
(1920 1080)
|
||||||
|
@ -6,6 +6,20 @@
|
||||||
(optimizer on
|
(optimizer on
|
||||||
(constant-folding on
|
(constant-folding on
|
||||||
(fixed-resolution on)
|
(fixed-resolution on)
|
||||||
|
(inputs on)
|
||||||
|
)
|
||||||
|
(constant-propagation on)
|
||||||
|
(dead-code-elimination on)
|
||||||
|
(function-inlining on)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(cfg "OptimizedDynamic"
|
||||||
|
(resolutions chooser)
|
||||||
|
(optimizer on
|
||||||
|
(constant-folding on
|
||||||
|
(fixed-resolution off)
|
||||||
|
(inputs on)
|
||||||
)
|
)
|
||||||
(constant-propagation on)
|
(constant-propagation on)
|
||||||
(dead-code-elimination on)
|
(dead-code-elimination on)
|
||||||
|
@ -14,9 +28,6 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(cfg "Basic"
|
(cfg "Basic"
|
||||||
(resolutions
|
(resolutions chooser)
|
||||||
(1280 720)
|
|
||||||
(1920 1080)
|
|
||||||
)
|
|
||||||
(optimizer off)
|
(optimizer off)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue