Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2022-02-14 11:42:03 +0300
committerJeroen Bakker <jeroen@blender.org>2022-02-14 11:42:03 +0300
commitefac4db166292229e4e2ab7afa6034d637893bd6 (patch)
treeda96af9ab754c24984fbb0a12b8bd9dc90b88d0e
parent08882ddfc2ba8aced32c97275a72234223249c43 (diff)
parentf0e32ef4ff34f8cf8ff85706fd863a858f5849b6 (diff)
Merge branch 'blender-v3.1-release'
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cc5
-rw-r--r--source/blender/draw/engines/image/image_drawing_mode.hh52
-rw-r--r--source/blender/draw/engines/image/image_instance_data.hh2
-rw-r--r--source/blender/draw/engines/image/image_texture_info.hh2
4 files changed, 26 insertions, 35 deletions
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc
index a00e537bd0b..bc7e08ee98a 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cc
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cc
@@ -200,7 +200,10 @@ void ViewerOperation::update_image(const rcti *rect)
rect->ymin,
rect->xmax,
rect->ymax);
- image_->gpuflag |= IMA_GPU_REFRESH;
+
+ /* This could be improved to use partial updates. For now disabled as the full frame compositor
+ * would not use partial frames anymore and the image engine requires more testing.*/
+ BKE_image_partial_update_mark_full_update(image_);
this->update_draw();
}
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh
index 61b7993c6b0..d0dbc799c31 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -47,20 +47,6 @@ struct OneTextureMethod {
}
}
- void update_region_uv_bounds(const ARegion *region)
- {
- TextureInfo &info = instance_data->texture_infos[0];
- if (!BLI_rctf_compare(&info.region_uv_bounds, &region->v2d.cur, EPSILON_UV_BOUNDS)) {
- info.region_uv_bounds = region->v2d.cur;
- info.dirty = true;
- }
-
- /* Mark the other textures as invalid. */
- for (int i = 1; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
- BLI_rctf_init_minmax(&instance_data->texture_infos[i].clipping_bounds);
- }
- }
-
void update_screen_uv_bounds()
{
for (int i = 0; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
@@ -77,7 +63,13 @@ struct OneTextureMethod {
float4x4 mat_inv = mat.inverted();
float3 min_uv = mat_inv * float3(0.0f, 0.0f, 0.0f);
float3 max_uv = mat_inv * float3(1.0f, 1.0f, 0.0f);
- BLI_rctf_init(&info.clipping_uv_bounds, min_uv[0], max_uv[0], min_uv[1], max_uv[1]);
+ rctf new_clipping_bounds;
+ BLI_rctf_init(&new_clipping_bounds, min_uv[0], max_uv[0], min_uv[1], max_uv[1]);
+
+ if (!BLI_rctf_compare(&info.clipping_uv_bounds, &new_clipping_bounds, EPSILON_UV_BOUNDS)) {
+ info.clipping_uv_bounds = new_clipping_bounds;
+ info.dirty = true;
+ }
}
};
@@ -252,7 +244,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
static_cast<float>(iterator.tile_data.tile_buffer->y) +
tile_offset_y);
rctf changed_overlapping_region_in_uv_space;
- const bool region_overlap = BLI_rctf_isect(&info.region_uv_bounds,
+ const bool region_overlap = BLI_rctf_isect(&info.clipping_uv_bounds,
&changed_region_in_uv_space,
&changed_overlapping_region_in_uv_space);
if (!region_overlap) {
@@ -264,14 +256,14 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
rcti gpu_texture_region_to_update;
BLI_rcti_init(
&gpu_texture_region_to_update,
- floor((changed_overlapping_region_in_uv_space.xmin - info.region_uv_bounds.xmin) *
- texture_width / BLI_rctf_size_x(&info.region_uv_bounds)),
- floor((changed_overlapping_region_in_uv_space.xmax - info.region_uv_bounds.xmin) *
- texture_width / BLI_rctf_size_x(&info.region_uv_bounds)),
- ceil((changed_overlapping_region_in_uv_space.ymin - info.region_uv_bounds.ymin) *
- texture_height / BLI_rctf_size_y(&info.region_uv_bounds)),
- ceil((changed_overlapping_region_in_uv_space.ymax - info.region_uv_bounds.ymin) *
- texture_height / BLI_rctf_size_y(&info.region_uv_bounds)));
+ floor((changed_overlapping_region_in_uv_space.xmin - info.clipping_uv_bounds.xmin) *
+ texture_width / BLI_rctf_size_x(&info.clipping_uv_bounds)),
+ floor((changed_overlapping_region_in_uv_space.xmax - info.clipping_uv_bounds.xmin) *
+ texture_width / BLI_rctf_size_x(&info.clipping_uv_bounds)),
+ ceil((changed_overlapping_region_in_uv_space.ymin - info.clipping_uv_bounds.ymin) *
+ texture_height / BLI_rctf_size_y(&info.clipping_uv_bounds)),
+ ceil((changed_overlapping_region_in_uv_space.ymax - info.clipping_uv_bounds.ymin) *
+ texture_height / BLI_rctf_size_y(&info.clipping_uv_bounds)));
rcti tile_region_to_extract;
BLI_rcti_init(
@@ -295,13 +287,13 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
for (int y = gpu_texture_region_to_update.ymin; y < gpu_texture_region_to_update.ymax;
y++) {
float yf = y / (float)texture_height;
- float v = info.region_uv_bounds.ymax * yf + info.region_uv_bounds.ymin * (1.0 - yf) -
+ float v = info.clipping_uv_bounds.ymax * yf + info.clipping_uv_bounds.ymin * (1.0 - yf) -
tile_offset_y;
for (int x = gpu_texture_region_to_update.xmin; x < gpu_texture_region_to_update.xmax;
x++) {
float xf = x / (float)texture_width;
- float u = info.region_uv_bounds.xmax * xf + info.region_uv_bounds.xmin * (1.0 - xf) -
- tile_offset_x;
+ float u = info.clipping_uv_bounds.xmax * xf +
+ info.clipping_uv_bounds.xmin * (1.0 - xf) - tile_offset_x;
nearest_interpolation_color(tile_buffer,
nullptr,
&extracted_buffer.rect_float[offset * 4],
@@ -344,7 +336,6 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
IMAGE_InstanceData &instance_data,
const ImageUser *image_user) const
{
-
ImBuf texture_buffer;
const int texture_width = GPU_texture_width(info.texture);
const int texture_height = GPU_texture_height(info.texture);
@@ -413,9 +404,9 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
1.0f};
rescale_m4(uv_to_texel, scale);
uv_to_texel[3][0] += image_tile.get_tile_x_offset() /
- BLI_rctf_size_x(&texture_info.region_uv_bounds);
+ BLI_rctf_size_x(&texture_info.clipping_uv_bounds);
uv_to_texel[3][1] += image_tile.get_tile_y_offset() /
- BLI_rctf_size_y(&texture_info.region_uv_bounds);
+ BLI_rctf_size_y(&texture_info.clipping_uv_bounds);
uv_to_texel[3][0] *= texture_width;
uv_to_texel[3][1] *= texture_height;
invert_m4(uv_to_texel);
@@ -465,7 +456,6 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
* screen space textures that aren't needed. */
const ARegion *region = draw_ctx->region;
method.update_screen_space_bounds(region);
- method.update_region_uv_bounds(region);
method.update_screen_uv_bounds();
/* Step: Update the GPU textures based on the changes in the image. */
diff --git a/source/blender/draw/engines/image/image_instance_data.hh b/source/blender/draw/engines/image/image_instance_data.hh
index 7349164062f..dde313d63f8 100644
--- a/source/blender/draw/engines/image/image_instance_data.hh
+++ b/source/blender/draw/engines/image/image_instance_data.hh
@@ -21,7 +21,7 @@
*
* 4 textures are used to reduce uploading screen space textures when translating the image.
*/
-constexpr int SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN = 4;
+constexpr int SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN = 1;
struct IMAGE_InstanceData {
struct Image *image;
diff --git a/source/blender/draw/engines/image/image_texture_info.hh b/source/blender/draw/engines/image/image_texture_info.hh
index ce605b0b6af..cd51cdaff3c 100644
--- a/source/blender/draw/engines/image/image_texture_info.hh
+++ b/source/blender/draw/engines/image/image_texture_info.hh
@@ -29,8 +29,6 @@ struct TextureInfo {
/** \brief area of the texture in screen space. */
rctf clipping_bounds;
- /** \brief uv area of the texture (copy from ARegion). */
- rctf region_uv_bounds;
/** \brief uv area of the texture in screen space. */
rctf clipping_uv_bounds;