master
Marc Gilleron 2022-08-24 22:41:56 +01:00
parent 8facdce3af
commit c4b8a1e948
3 changed files with 13 additions and 14 deletions

View File

@ -772,9 +772,9 @@ VoxelGraphRuntime::CompilationResult VoxelGraphRuntime::_compile(
CRASH_COND(node.type_id > 0xff);
if (order_index == xzy_start_index) {
_program.default_execution_map.xzy_start_index = _program.default_execution_map.operation_adresses.size();
_program.default_execution_map.xzy_start_index = _program.default_execution_map.operation_addresses.size();
}
_program.default_execution_map.operation_adresses.push_back(operations.size());
_program.default_execution_map.operation_addresses.push_back(operations.size());
if (debug) {
// Will be remapped later if the node is an expanded one
_program.default_execution_map.debug_nodes.push_back(node_id);

View File

@ -216,10 +216,10 @@ void VoxelGraphRuntime::generate_optimized_execution_map(
if (xzy_start_not_assigned && node.op_address >= program.xzy_start_op_address) {
// This should be correct as long as the list of nodes in the graph follows the same re-ordered
// optimization done in `compile()` such that all nodes not depending on Y come first
execution_map.xzy_start_index = execution_map.operation_adresses.size();
execution_map.xzy_start_index = execution_map.operation_addresses.size();
xzy_start_not_assigned = false;
}
execution_map.operation_adresses.push_back(node.op_address);
execution_map.operation_addresses.push_back(node.op_address);
break;
default:
@ -450,13 +450,13 @@ void VoxelGraphRuntime::generate_set(State &state, Span<float> in_x, Span<float>
const Span<const uint16_t> operations(_program.operations.data(), 0, _program.operations.size());
Span<const uint16_t> op_adresses = execution_map != nullptr
? to_span_const(execution_map->operation_adresses)
: to_span_const(_program.default_execution_map.operation_adresses);
if (skip_xz && op_adresses.size() > 0) {
Span<const uint16_t> op_addresses = execution_map != nullptr
? to_span_const(execution_map->operation_addresses)
: to_span_const(_program.default_execution_map.operation_addresses);
if (skip_xz && op_addresses.size() > 0) {
const unsigned int offset = execution_map != nullptr ? execution_map->xzy_start_index
: _program.default_execution_map.xzy_start_index;
op_adresses = op_adresses.sub(offset);
op_addresses = op_addresses.sub(offset);
}
#ifdef TOOLS_ENABLED
@ -464,8 +464,8 @@ void VoxelGraphRuntime::generate_set(State &state, Span<float> in_x, Span<float>
const bool profile = state.debug_profiler_times.size() > 0;
#endif
for (unsigned int execution_map_index = 0; execution_map_index < op_adresses.size(); ++execution_map_index) {
unsigned int pc = op_adresses[execution_map_index];
for (unsigned int execution_map_index = 0; execution_map_index < op_addresses.size(); ++execution_map_index) {
unsigned int pc = op_addresses[execution_map_index];
const uint16_t opid = operations[pc++];
const VoxelGraphNodeDB::NodeType &node_type = VoxelGraphNodeDB::get_singleton().get_type(opid);

View File

@ -60,8 +60,7 @@ public:
// If no local optimization is done, this can remain the same for any position lists.
// If local optimization is used, it may be recomputed before each query.
struct ExecutionMap {
// TODO Rename typo?
std::vector<uint16_t> operation_adresses;
std::vector<uint16_t> operation_addresses;
// Stores node IDs referring to the user-facing graph.
// Each index corresponds to operation indices.
// The same node can appear twice, because sometimes a user-facing node compiles as multiple nodes.
@ -71,7 +70,7 @@ public:
unsigned int xzy_start_index = 0;
void clear() {
operation_adresses.clear();
operation_addresses.clear();
debug_nodes.clear();
xzy_start_index = 0;
}