Switch to using blender::BitVector in tile changesets
This avoids an issue in clang-cl on Windows ARM64 where an invalid pointer would be (re)used. See #124182 for more details, but basically without this, when the vector of tiles inside changeset is resized, a reference to an invalid pointer (ie, the location in the old vector) is kept somewhere, which makes the test fail. Pull Request: https://projects.blender.org/blender/blender/pulls/126083
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
|
||||
#include "IMB_imbuf_types.hh"
|
||||
|
||||
#include "BLI_bit_vector.hh"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
@@ -161,7 +162,7 @@ struct PartialUpdateUserImpl {
|
||||
struct TileChangeset {
|
||||
private:
|
||||
/** \brief Dirty flag for each chunk. */
|
||||
std::vector<bool> chunk_dirty_flags_;
|
||||
blender::BitVector<> chunk_dirty_flags_;
|
||||
/** \brief are there dirty/ */
|
||||
bool has_dirty_chunks_ = false;
|
||||
|
||||
@@ -238,7 +239,7 @@ struct TileChangeset {
|
||||
for (int chunk_y = start_y_chunk; chunk_y <= end_y_chunk; chunk_y++) {
|
||||
for (int chunk_x = start_x_chunk; chunk_x <= end_x_chunk; chunk_x++) {
|
||||
int chunk_index = chunk_y * chunk_x_len + chunk_x;
|
||||
chunk_dirty_flags_[chunk_index] = true;
|
||||
chunk_dirty_flags_[chunk_index].set();
|
||||
}
|
||||
}
|
||||
has_dirty_chunks_ = true;
|
||||
@@ -263,7 +264,7 @@ struct TileChangeset {
|
||||
return;
|
||||
}
|
||||
for (int index = 0; index < min_ii(chunk_len, previous_chunk_len); index++) {
|
||||
chunk_dirty_flags_[index] = false;
|
||||
chunk_dirty_flags_[index].reset();
|
||||
}
|
||||
has_dirty_chunks_ = false;
|
||||
}
|
||||
@@ -276,8 +277,8 @@ struct TileChangeset {
|
||||
const int chunk_len = chunk_x_len * chunk_y_len;
|
||||
|
||||
for (int chunk_index = 0; chunk_index < chunk_len; chunk_index++) {
|
||||
chunk_dirty_flags_[chunk_index] = chunk_dirty_flags_[chunk_index] ||
|
||||
other.chunk_dirty_flags_[chunk_index];
|
||||
chunk_dirty_flags_[chunk_index].set(chunk_dirty_flags_[chunk_index] ||
|
||||
other.chunk_dirty_flags_[chunk_index]);
|
||||
}
|
||||
has_dirty_chunks_ |= other.has_dirty_chunks_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user