Skip to content

Commit

Permalink
Merge pull request #1478 from GaijinEntertainment/missing-keepalive
Browse files Browse the repository at this point in the history
some keepalive calls were missing by default
  • Loading branch information
borisbat authored Jan 24, 2025
2 parents 9c11ffb + f7c3afc commit f714d93
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion include/daScript/simulate/debug_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace das
#endif

#ifndef DAS_ENABLE_KEEPALIVE
#define DAS_ENABLE_KEEPALIVE 1
#define DAS_ENABLE_KEEPALIVE 0
#endif

enum Type : int32_t {
Expand Down
4 changes: 4 additions & 0 deletions include/daScript/simulate/runtime_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ namespace das
}
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down Expand Up @@ -203,6 +204,7 @@ namespace das
ph += stride;
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down Expand Up @@ -655,6 +657,7 @@ namespace das
}
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down Expand Up @@ -700,6 +703,7 @@ namespace das
ph += stride;
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down
1 change: 1 addition & 0 deletions include/daScript/simulate/runtime_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ namespace das
*pi = i;
SimNode ** __restrict body = this->list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down
8 changes: 2 additions & 6 deletions include/daScript/simulate/simulate_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -3452,12 +3452,6 @@ SIM_NODE_AT_VECTOR(Float, float)

#endif

struct SimNodeKeepAlive_While : SimNode_While {
SimNodeKeepAlive_While ( const LineInfo & at, SimNode * c )
: SimNode_While(at,c) {}
DAS_EVAL_ABI virtual vec4f eval ( Context & context ) override;
};

struct SimNode_ForWithIteratorBase : SimNode_Block {
SimNode_ForWithIteratorBase ( const LineInfo & at )
: SimNode_Block(at) { }
Expand Down Expand Up @@ -3505,6 +3499,7 @@ SIM_NODE_AT_VECTOR(Float, float)
while ( !context.stopFlags ) {
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down Expand Up @@ -3562,6 +3557,7 @@ SIM_NODE_AT_VECTOR(Float, float)
while ( !context.stopFlags ) {
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down
22 changes: 2 additions & 20 deletions src/simulate/simulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ namespace das
while ( !context.stopFlags ) {
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down Expand Up @@ -705,6 +706,7 @@ namespace das
while ( cond->evalBool(context) && !context.stopFlags ) {
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
Expand Down Expand Up @@ -738,26 +740,6 @@ namespace das

#endif

#if DAS_ENABLE_KEEPALIVE
vec4f SimNodeKeepAlive_While::eval ( Context & context ) {
DAS_PROFILE_NODE
SimNode ** __restrict tail = list + total;
while ( cond->evalBool(context) && !context.stopFlags ) {
SimNode ** __restrict body = list;
loopbegin:;
DAS_KEEPALIVE_LOOP(&context);
for (; body!=tail; ++body) {
(*body)->eval(context);
DAS_PROCESS_LOOP_FLAGS(break);
}
}
loopend:;
evalFinal(context);
context.stopFlags &= ~EvalFlags::stopForBreak;
return v_zero();
}
#endif

// Return

vec4f SimNode_Return::eval ( Context & context ) {
Expand Down

0 comments on commit f714d93

Please sign in to comment.