Fix voxel graph test

master
Marc Gilleron 2022-04-22 22:06:35 +01:00
parent dc8aed91c3
commit 8cf52b8967
4 changed files with 10 additions and 11 deletions

View File

@ -602,7 +602,7 @@ void VoxelGraphEditor::update_previews() {
uint64_t time_before = Time::get_singleton()->get_ticks_usec();
const VoxelGraphRuntime::CompilationResult result = _graph->compile();
const VoxelGraphRuntime::CompilationResult result = _graph->compile(true);
if (!result.success) {
ERR_PRINT(String("Voxel graph compilation failed: {0}").format(varray(result.message)));

View File

@ -862,15 +862,14 @@ static bool has_output_type(
return false;
}
VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile() {
VoxelGraphRuntime::CompilationResult VoxelGeneratorGraph::compile(bool debug) {
const int64_t time_before = Time::get_singleton()->get_ticks_usec();
std::shared_ptr<Runtime> r = make_shared_instance<Runtime>();
VoxelGraphRuntime &runtime = r->runtime;
// Core compilation
const VoxelGraphRuntime::CompilationResult result =
runtime.compile(_graph, Engine::get_singleton()->is_editor_hint());
const VoxelGraphRuntime::CompilationResult result = runtime.compile(_graph, debug);
if (!result.success) {
return result;
@ -1589,7 +1588,7 @@ void VoxelGeneratorGraph::load_graph_from_variant_data(Dictionary data) {
register_subresources();
// It's possible to auto-compile on load because `graph_data` is the only property set by the loader,
// which is enough to have all information we need
compile();
compile(Engine::get_singleton()->is_editor_hint());
} else {
_graph.clear();
@ -1847,7 +1846,7 @@ Vector2 VoxelGeneratorGraph::_b_debug_analyze_range(Vector3 min_pos, Vector3 max
}
Dictionary VoxelGeneratorGraph::_b_compile() {
VoxelGraphRuntime::CompilationResult res = compile();
VoxelGraphRuntime::CompilationResult res = compile(false);
Dictionary d;
d["success"] = res.success;
if (!res.success) {

View File

@ -177,7 +177,7 @@ public:
// Internal
VoxelGraphRuntime::CompilationResult compile();
VoxelGraphRuntime::CompilationResult compile(bool debug);
bool is_good() const;
void generate_set(Span<float> in_x, Span<float> in_y, Span<float> in_z);

View File

@ -350,7 +350,7 @@ void test_voxel_graph_generator_default_graph_compilation() {
Ref<VoxelGeneratorGraph> generator;
generator.instantiate();
generator->load_plane_preset();
VoxelGraphRuntime::CompilationResult result = generator->compile();
VoxelGraphRuntime::CompilationResult result = generator->compile(false);
ZYLANN_TEST_ASSERT_MSG(
result.success, String("Failed to compile graph: {0}: {1}").format(varray(result.node_id, result.message)));
}
@ -378,7 +378,7 @@ void test_voxel_graph_generator_expressions() {
generator->add_connection(in_z, 0, n_expression, 2);
generator->add_connection(n_expression, 0, out_sdf, 0);
VoxelGraphRuntime::CompilationResult result = generator->compile();
VoxelGraphRuntime::CompilationResult result = generator->compile(false);
ZYLANN_TEST_ASSERT_MSG(result.success,
String("Failed to compile graph: {0}: {1}").format(varray(result.node_id, result.message)));
}
@ -432,7 +432,7 @@ void test_voxel_graph_generator_expressions() {
generator->add_connection(n_plane, 0, n_expr, 2);
generator->add_connection(n_expr, 0, out_sdf, 0);
VoxelGraphRuntime::CompilationResult result = generator->compile();
VoxelGraphRuntime::CompilationResult result = generator->compile(true);
ZYLANN_TEST_ASSERT_MSG(result.success,
String("Failed to compile graph: {0}: {1}").format(varray(result.node_id, result.message)));
@ -491,7 +491,7 @@ void test_voxel_graph_generator_texturing() {
generator->add_connection(n_sub1, 0, out_weight0, 0);
generator->add_connection(n_clamp, 0, out_weight1, 0);
VoxelGraphRuntime::CompilationResult compilation_result = generator->compile();
VoxelGraphRuntime::CompilationResult compilation_result = generator->compile(false);
ZYLANN_TEST_ASSERT_MSG(compilation_result.success,
String("Failed to compile graph: {0}: {1}")
.format(varray(compilation_result.node_id, compilation_result.message)));