Skip to content

Commit

Permalink
Fix 64-bit float builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Aug 23, 2024
1 parent 965353d commit 0417f38
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions generators/graph/voxel_generator_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ void VoxelGeneratorGraph::gather_indices_and_weights(
}
};

// TODO This should not be necessary!
// We could use a pointer to the `min` member of intervals inside State, however Interval uses `real_t`, which
// breaks our code in 64-bit float builds of Godot. We should refactor Interval so everything can line up.
FixedArray<float, 16> constants;

// TODO Could maybe put this part outside?
WeightBufferArray buffers;
const unsigned int buffers_count = weight_outputs.size();
Expand All @@ -170,8 +175,10 @@ void VoxelGeneratorGraph::gather_indices_and_weights(
if (range.is_single_value()) {
// The weight is locally constant (or compile-time constant).
// We can't use the usual buffer because if we use optimized execution mapping, they won't be filled by any
// operation
buffers.array[oi] = Span<const float>(&range.min, 1);
// operation and would contain garbage
constants[oi] = range.min;
buffers.array[oi] = Span<const float>(&constants[oi], 1);
// buffers.array[oi] = Span<const float>(&range.min, 1);
} else {
const pg::Runtime::Buffer &buffer = state.get_buffer(info.output_buffer_index);
buffers.array[oi] = Span<const float>(buffer.data, buffer.size);
Expand Down

0 comments on commit 0417f38

Please sign in to comment.