Main script runs
Fixed a few more bugs, and now the main script runs without crashing. It fails to produce any output, however.
This commit is contained in:
parent
3de255aad0
commit
210be3a852
5 changed files with 52 additions and 18 deletions
|
@ -29,6 +29,8 @@ enum E_OpType
|
||||||
OP_CONST ,
|
OP_CONST ,
|
||||||
OP_OFFSET ,
|
OP_OFFSET ,
|
||||||
//
|
//
|
||||||
|
OP_GET_INPUT ,
|
||||||
|
//
|
||||||
OP_FP_LOAD ,
|
OP_FP_LOAD ,
|
||||||
OP_FP_STORE ,
|
OP_FP_STORE ,
|
||||||
OP_FP_SLOAD ,
|
OP_FP_SLOAD ,
|
||||||
|
|
20
demo.cc
20
demo.cc
|
@ -83,6 +83,15 @@ void T_Demo::render( )
|
||||||
}
|
}
|
||||||
playingPrevious = playing;
|
playingPrevious = playing;
|
||||||
|
|
||||||
|
if ( context && !context->aborted ) {
|
||||||
|
try {
|
||||||
|
context->run( ops::T_OpContext::R_RENDER , sync.time( ) , width , height );
|
||||||
|
} catch ( ops::X_OpFailure const& fail ) {
|
||||||
|
printf( "FAILED TO RUN FRAME!\n\t%s\n" , fail.what( ) );
|
||||||
|
context->aborted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
raymarcher->render( );
|
raymarcher->render( );
|
||||||
dof->render( );
|
dof->render( );
|
||||||
|
@ -200,5 +209,16 @@ void T_Demo::runInit( )
|
||||||
context->run( ops::T_OpContext::R_INIT , 0 , width , height );
|
context->run( ops::T_OpContext::R_INIT , 0 , width , height );
|
||||||
} catch ( ops::X_OpFailure const& fail ) {
|
} catch ( ops::X_OpFailure const& fail ) {
|
||||||
printf( "FAILED TO RUN INIT!\n\t%s\n" , fail.what( ) );
|
printf( "FAILED TO RUN INIT!\n\t%s\n" , fail.what( ) );
|
||||||
|
context->aborted = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Globals::Sync( ).clearInputs( );
|
||||||
|
const auto n( context->initialInputs.size( ) );
|
||||||
|
assert( n == program->inputs.size( ) );
|
||||||
|
for ( auto i = 0u ; i < n ; i ++ ) {
|
||||||
|
Globals::Sync( ).addInput( program->inputs[ i ] ,
|
||||||
|
context->initialInputs[ i ] );
|
||||||
|
}
|
||||||
|
Globals::Sync( ).updateCurveCaches( );
|
||||||
}
|
}
|
||||||
|
|
6
demo.srd
6
demo.srd
|
@ -98,7 +98,7 @@
|
||||||
(get-input raymarcher-max-dist)
|
(get-input raymarcher-max-dist)
|
||||||
)
|
)
|
||||||
(uniforms prg-scene-p1 7 (get-input fog))
|
(uniforms prg-scene-p1 7 (get-input fog))
|
||||||
(uniforms prg-scene-p1 8 (get-input raymarcher-correction))
|
(uniforms-i prg-scene-p1 8 (get-input raymarcher-correction))
|
||||||
(use-pipeline pl-scene-p1)
|
(use-pipeline pl-scene-p1)
|
||||||
(use-framebuffer rt-scene)
|
(use-framebuffer rt-scene)
|
||||||
(viewport 0 0 $vp-width $vp-height)
|
(viewport 0 0 $vp-width $vp-height)
|
||||||
|
@ -299,7 +299,7 @@
|
||||||
(use-framebuffer target)
|
(use-framebuffer target)
|
||||||
(use-texture 0 tx-bloom1 smp-bloom-blur)
|
(use-texture 0 tx-bloom1 smp-bloom-blur)
|
||||||
(uniforms prg-bloom-downsample 1 $w $h)
|
(uniforms prg-bloom-downsample 1 $w $h)
|
||||||
(uniforms prg-bloom-downsample 2 (sub $level 1))
|
(uniforms-i prg-bloom-downsample 2 (sub $level 1))
|
||||||
(viewport 0 0 $w $h)
|
(viewport 0 0 $w $h)
|
||||||
(fullscreen)
|
(fullscreen)
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@
|
||||||
(fn bloom-blur-pass (lod fb1 fb2)
|
(fn bloom-blur-pass (lod fb1 fb2)
|
||||||
# Common stuff for both passes
|
# Common stuff for both passes
|
||||||
(use-pipeline pl-bloom-blur)
|
(use-pipeline pl-bloom-blur)
|
||||||
(uniforms prg-bloom-blur 2 $lod)
|
(uniforms-i prg-bloom-blur 2 $lod)
|
||||||
|
|
||||||
# Pass 1
|
# Pass 1
|
||||||
(use-framebuffer fb2)
|
(use-framebuffer fb2)
|
||||||
|
|
|
@ -740,6 +740,11 @@ bool T_CompilerImpl_::compileNode(
|
||||||
|
|
||||||
case A_Node::EXPR_INPUT:
|
case A_Node::EXPR_INPUT:
|
||||||
if ( !exit ) {
|
if ( !exit ) {
|
||||||
|
auto& in( (T_InputExprNode&) node );
|
||||||
|
assert( output->inputs.contains( in.id( ) ) );
|
||||||
|
addInstruction( OP_GET_INPUT ,
|
||||||
|
output->inputs.indexOf( in.id( ) ) ,
|
||||||
|
in.location( ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
37
ops.cc
37
ops.cc
|
@ -101,6 +101,7 @@ static T_KeyValueTable< E_OpType , T_OpInfo > OpInfoTable_{ ([]() {
|
||||||
infos.add( E_OpType::OP_CONST , T_OpInfo{ "const" , 1 } );
|
infos.add( E_OpType::OP_CONST , T_OpInfo{ "const" , 1 } );
|
||||||
infos.add( E_OpType::OP_OFFSET , T_OpInfo{ "offset" , 1 } );
|
infos.add( E_OpType::OP_OFFSET , T_OpInfo{ "offset" , 1 } );
|
||||||
//
|
//
|
||||||
|
infos.add( E_OpType::OP_GET_INPUT , T_OpInfo{ "get-input" , 1 , OpStackFPU{ 1 } } );
|
||||||
infos.add( E_OpType::OP_FP_LOAD , T_OpInfo{ "fp-load" , 1 , OpStackFPU{ 1 } } );
|
infos.add( E_OpType::OP_FP_LOAD , T_OpInfo{ "fp-load" , 1 , OpStackFPU{ 1 } } );
|
||||||
infos.add( E_OpType::OP_FP_SLOAD , T_OpInfo{ "fp-load-stack" , 1 , OpStackFPU{ 1 } } );
|
infos.add( E_OpType::OP_FP_SLOAD , T_OpInfo{ "fp-load-stack" , 1 , OpStackFPU{ 1 } } );
|
||||||
infos.add( E_OpType::OP_FP_STORE , T_OpInfo{ "fp-store" , 1 , OpStackFPU{ -1 } } );
|
infos.add( E_OpType::OP_FP_STORE , T_OpInfo{ "fp-store" , 1 , OpStackFPU{ -1 } } );
|
||||||
|
@ -286,6 +287,20 @@ void T_OpContext::run(
|
||||||
|
|
||||||
//#define YOUR_MUM_IS_A_TRACE
|
//#define YOUR_MUM_IS_A_TRACE
|
||||||
#ifdef YOUR_MUM_IS_A_TRACE
|
#ifdef YOUR_MUM_IS_A_TRACE
|
||||||
|
GL_ASSERT( );
|
||||||
|
T_StringBuilder sb;
|
||||||
|
sb << "\nEXECUTE " << instrPtr << ":\t(" << instr << ") {"
|
||||||
|
<< instr.location << "}\nSTACK:";
|
||||||
|
for ( auto i = 0u ; i < stack.size( ) ; i ++ ) {
|
||||||
|
sb << ' ' << stack[ i ].u;
|
||||||
|
}
|
||||||
|
sb << "\nFPU STACK:";
|
||||||
|
for ( auto i = 0u ; i < x87sp ; i ++ ) {
|
||||||
|
sb << ' ' << x87stack[ i ];
|
||||||
|
}
|
||||||
|
sb << "\nWREG: " << wreg.f << '/' << wreg.u << '\n' << '\0';
|
||||||
|
printf( "%s" , sb.data( ) );
|
||||||
|
|
||||||
printf( "VALUES\n00" );
|
printf( "VALUES\n00" );
|
||||||
for ( auto i = 0u ; i < values.size( ) ; i ++ ) {
|
for ( auto i = 0u ; i < values.size( ) ; i ++ ) {
|
||||||
printf( " %08x" , values[ i ].u );
|
printf( " %08x" , values[ i ].u );
|
||||||
|
@ -296,19 +311,6 @@ void T_OpContext::run(
|
||||||
if ( values.size( ) % 4 != 0 ) {
|
if ( values.size( ) % 4 != 0 ) {
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
T_StringBuilder sb;
|
|
||||||
sb << "EXECUTE " << instrPtr << ":\t(" << instr << ") {"
|
|
||||||
<< instr.location << "}\nSTACK:";
|
|
||||||
for ( auto i = 0u ; i < stack.size( ) ; i ++ ) {
|
|
||||||
sb << ' ' << stack[ i ].u;
|
|
||||||
}
|
|
||||||
sb << "\nFPU STACK:";
|
|
||||||
for ( auto i = 0u ; i < x87sp ; i ++ ) {
|
|
||||||
sb << ' ' << x87stack[ i ];
|
|
||||||
}
|
|
||||||
sb << '\n' << '\0';
|
|
||||||
printf( "%s" , sb.data( ) );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch ( instr.op ) {
|
switch ( instr.op ) {
|
||||||
|
@ -348,7 +350,7 @@ void T_OpContext::run(
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
|
|
||||||
case OP_RES_STACK:
|
case OP_RES_STACK:
|
||||||
stack.resize( stack.size( ) + instr.args[ 0 ] );
|
stack.resize( stack.size( ) + instr.args[ 0 ] + 1 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_PUSH:
|
case OP_PUSH:
|
||||||
|
@ -389,6 +391,11 @@ void T_OpContext::run(
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
case OP_GET_INPUT:
|
||||||
|
ensureFpuStack( instr , 0 , 1 );
|
||||||
|
x87stack[ x87sp ++ ] = Globals::Sync( ).inputs( )[ instr.args[ 0 ] + 1 ];
|
||||||
|
break;
|
||||||
|
|
||||||
case OP_FP_LOAD:
|
case OP_FP_LOAD:
|
||||||
ensureFpuStack( instr , 0 , 1 );
|
ensureFpuStack( instr , 0 , 1 );
|
||||||
checkAddress( instr , instr.args[ 0 ] );
|
checkAddress( instr , instr.args[ 0 ] );
|
||||||
|
@ -822,7 +829,7 @@ void T_OpContext::run(
|
||||||
if ( sv == 0 ) {
|
if ( sv == 0 ) {
|
||||||
glBindFramebuffer( GL_FRAMEBUFFER , 0 );
|
glBindFramebuffer( GL_FRAMEBUFFER , 0 );
|
||||||
curFb = -1;
|
curFb = -1;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto index( sv - 1 );
|
const auto index( sv - 1 );
|
||||||
|
|
Loading…
Reference in a new issue