[Bf-blender-cvs] [5e6a37a3e4e] temp-gpu-texture-partial-updates: Multiple renames.
Jeroen Bakker
noreply at git.blender.org
Wed Nov 17 15:29:45 CET 2021
Commit: 5e6a37a3e4e09efa65f88bb95c9f64df266c20d9
Author: Jeroen Bakker
Date: Wed Nov 17 11:27:54 2021 +0100
Branches: temp-gpu-texture-partial-updates
https://developer.blender.org/rB5e6a37a3e4e09efa65f88bb95c9f64df266c20d9
Multiple renames.
===================================================================
M source/blender/blenkernel/BKE_image.h
M source/blender/blenkernel/intern/image_gpu.c
M source/blender/blenkernel/intern/image_partial_update.cc
M source/blender/blenkernel/intern/image_partial_update_test.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 8d4ab977f43..e6ddeaae895 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -397,7 +397,7 @@ bool BKE_image_clear_renderslot(struct Image *ima, struct ImageUser *iuser, int
struct PartialUpdateUser;
/**
- * \brief Result codes of #BKE_image_partial_update_collect_tiles.
+ * \brief Result codes of #BKE_image_partial_update_collect_changes.
*/
typedef enum ePartialUpdateCollectResult {
/** \brief Unable to construct partial updates. Caller should perform a full update. */
@@ -406,31 +406,31 @@ typedef enum ePartialUpdateCollectResult {
/** \brief No changes detected since the last time requested. */
PARTIAL_UPDATE_NO_CHANGES,
- /** \brief Changes detected sinve the last time requested. */
+ /** \brief Changes detected since the last time requested. */
PARTIAL_UPDATE_CHANGES_AVAILABLE,
} ePartialUpdateCollectResult;
/**
- * \brief A single tile to update.
+ * \brief A region to update.
*
* Data is organized in tiles. These tiles are in texel space (1 unit is a single texel). When
* tiles are requested they are merged with neighboring tiles.
*/
-typedef struct PartialUpdateTile {
+typedef struct PartialUpdateRegion {
/** \brief region of the image that has been updated. Region can be bigger than actual changes.
*/
struct rcti region;
-} PartialUpdateTile;
+} PartialUpdateRegion;
/**
- * \brief Return codes of #BKE_image_partial_update_next_tile.
+ * \brief Return codes of #BKE_image_partial_update_get_next_change.
*/
typedef enum ePartialUpdateIterResult {
/** \brief no tiles left when iterating over tiles. */
- PARTIAL_UPDATE_ITER_NO_TILES_LEFT = 0,
+ PARTIAL_UPDATE_ITER_FINISHED = 0,
/** \brief a tile was available and has been loaded. */
- PARTIAL_UPDATE_ITER_TILE_LOADED = 1,
+ PARTIAL_UPDATE_ITER_CHANGE_AVAILABLE = 1,
} ePartialUpdateIterResult;
/**
@@ -446,7 +446,7 @@ void BKE_image_partial_update_free(struct PartialUpdateUser *user);
/**
* \brief collect the partial update since the last request.
*
- * Invoke #BKE_image_partial_update_next_tile to iterate over the collected tiles.
+ * Invoke #BKE_image_partial_update_get_next_change to iterate over the collected tiles.
*
* \returns PARTIAL_UPDATE_NEED_FULL_UPDATE: called should not use partial updates but
* recalculate the full image. This result can be expected when called
@@ -456,14 +456,13 @@ void BKE_image_partial_update_free(struct PartialUpdateUser *user);
* invoke for the same user.
* PARTIAL_UPDATE_CHANGES_AVAILABLE: Parts of the image has been updated
* since last invoke for the same user. The changes can be read by
- * using #BKE_image_partial_update_next_tile.
+ * using #BKE_image_partial_update_get_next_change.
*/
-ePartialUpdateCollectResult BKE_image_partial_update_collect_tiles(struct Image *image,
- struct ImBuf *image_buffer,
- struct PartialUpdateUser *user);
+ePartialUpdateCollectResult BKE_image_partial_update_collect_changes(
+ struct Image *image, struct ImBuf *image_buffer, struct PartialUpdateUser *user);
-ePartialUpdateIterResult BKE_image_partial_update_next_tile(struct PartialUpdateUser *user,
- struct PartialUpdateTile *r_tile);
+ePartialUpdateIterResult BKE_image_partial_update_get_next_change(
+ struct PartialUpdateUser *user, struct PartialUpdateRegion *r_tile);
/* --- partial updater (image side) --- */
struct PartialUpdateRegister;
@@ -472,12 +471,11 @@ struct PartialUpdateRegister *BKE_image_partial_update_register_ensure(struct Im
struct ImBuf *image_buffer);
void BKE_image_partial_update_register_free(struct Image *image);
/** \brief Mark a region of the image to update. */
-void BKE_image_partial_update_register_mark_region(struct Image *image,
- struct ImBuf *image_buffer,
- rcti *updated_region);
+void BKE_image_partial_update_mark_region(struct Image *image,
+ struct ImBuf *image_buffer,
+ rcti *updated_region);
/** \brief Mark the whole image to be updated. */
-void BKE_image_partial_update_register_mark_full_update(struct Image *image,
- struct ImBuf *image_buffer);
+void BKE_image_partial_update_mark_full_update(struct Image *image, struct ImBuf *image_buffer);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c
index af28de7bf95..daf59c8d13e 100644
--- a/source/blender/blenkernel/intern/image_gpu.c
+++ b/source/blender/blenkernel/intern/image_gpu.c
@@ -378,7 +378,7 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
/* TODO(jbakker): bad call. Or we should do this everywhere where image is changed, or we should
* make it possible to initialize an empty register. */
if ((ima->gpuflag & IMA_GPU_REFRESH) != 0) {
- BKE_image_partial_update_register_mark_full_update(ima, ibuf_intern);
+ BKE_image_partial_update_mark_full_update(ima, ibuf_intern);
ima->gpuflag &= ~IMA_GPU_REFRESH;
}
@@ -386,8 +386,8 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
ima->runtime.partial_update_user = BKE_image_partial_update_create(ima);
}
- switch (
- BKE_image_partial_update_collect_tiles(ima, ibuf_intern, ima->runtime.partial_update_user)) {
+ switch (BKE_image_partial_update_collect_changes(
+ ima, ibuf_intern, ima->runtime.partial_update_user)) {
case PARTIAL_UPDATE_NEED_FULL_UPDATE: {
image_free_gpu(ima, true);
break;
@@ -396,10 +396,10 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
case PARTIAL_UPDATE_CHANGES_AVAILABLE: {
BLI_assert(ibuf_intern);
BLI_assert(tile);
- PartialUpdateTile changed_region;
- while (
- BKE_image_partial_update_next_tile(ima->runtime.partial_update_user, &changed_region) ==
- PARTIAL_UPDATE_ITER_TILE_LOADED) {
+ PartialUpdateRegion changed_region;
+ while (BKE_image_partial_update_get_next_change(ima->runtime.partial_update_user,
+ &changed_region) ==
+ PARTIAL_UPDATE_ITER_CHANGE_AVAILABLE) {
const int tile_offset_x = changed_region.region.xmin;
const int tile_offset_y = changed_region.region.ymin;
const int tile_width = BLI_rcti_size_x(&changed_region.region);
@@ -941,12 +941,12 @@ void BKE_image_update_gputexture_delayed(
{
/* Check for full refresh. */
if (ibuf && x == 0 && y == 0 && w == ibuf->x && h == ibuf->y) {
- BKE_image_partial_update_register_mark_full_update(ima, ibuf);
+ BKE_image_partial_update_mark_full_update(ima, ibuf);
}
else {
rcti dirty_region;
BLI_rcti_init(&dirty_region, x, x + w, y, y + h);
- BKE_image_partial_update_register_mark_region(ima, ibuf, &dirty_region);
+ BKE_image_partial_update_mark_region(ima, ibuf, &dirty_region);
}
}
diff --git a/source/blender/blenkernel/intern/image_partial_update.cc b/source/blender/blenkernel/intern/image_partial_update.cc
index 94e1312f1c8..8921199319c 100644
--- a/source/blender/blenkernel/intern/image_partial_update.cc
+++ b/source/blender/blenkernel/intern/image_partial_update.cc
@@ -1,4 +1,3 @@
-
/**
* \file image_gpu_partial_update.cc
*
@@ -22,16 +21,16 @@
*
* ...
*
- * switch (BKE_image_partial_update_collect_tiles(image, image_buffer))
+ * switch (BKE_image_partial_update_collect_changes(image, image_buffer))
* {
* case PARTIAL_UPDATE_NEED_FULL_UPDATE:
* // Unable to do partial updates. Perform a full update.
* break;
* case PARTIAL_UPDATE_CHANGES_AVAILABLE:
- * PartialUpdateTile tile;
- * while (BKE_image_partial_update_next_tile(partial_update_user, &tile) ==
- * PARTIAL_UPDATE_ITER_TILE_LOADED){
- * // Do something with the tile.
+ * PartialUpdateRegion change;
+ * while (BKE_image_partial_update_get_next_change(partial_update_user, &change) ==
+ * PARTIAL_UPDATE_ITER_CHANGE_AVAILABLE){
+ * // Do something with the change.
* }
* case PARTIAL_UPDATE_NO_CHANGES:
* break;
@@ -98,18 +97,18 @@ struct PartialUpdateUserImpl {
/** \brief last changeset id that was seen by this user. */
ChangesetID last_changeset_id = UnknownChangesetID;
- /** \brief tiles that have been updated. */
- Vector<PartialUpdateTile> updated_tiles;
+ /** \brief regions that have been updated. */
+ Vector<PartialUpdateRegion> updated_regions;
/**
- * \brief Clear the updated tiles.
+ * \brief Clear the list of updated regions.
*
- * Updated tiles should be cleared at the start of #BKE_image_partial_update_collect_tiles so
+ * Updated tiles should be cleared at the start of #BKE_image_partial_update_collect_changes so
* the
*/
- void clear_updated_tiles()
+ void clear_updated_regions()
{
- updated_tiles.clear();
+ updated_regions.clear();
}
};
@@ -119,7 +118,7 @@ struct PartialUpdateUserImpl {
* Internally dirty tiles are grouped together in change sets to make sure that the correct
* answer can be built for different users reducing the amount of merges.
*/
-struct TileChangeset {
+struct Changeset {
private:
/** \brief Dirty flag for each tile. */
std::vector<bool> tile_dirty_flags_;
@@ -172,7 +171,7 @@ struct TileChangeset {
}
/** \brief Merge the given changeset into the receiver. */
- void merge(const TileChangeset &other)
+ void merge(const Changeset &other)
{
BLI_assert(tile_x_len_ == other.tile_x_len_);
BLI_assert(tile_y_len_ == other.tile_y_len_);
@@ -209,9 +208,9 @@ struct PartialUpdateRegisterImpl {
ChangesetID last_changeset_id;
/** \brief history of changesets. */
- Vector<TileChangeset> his
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list