[Bf-blender-cvs] [482b8fb879e] temp-gpu-image-engine: Some small cleanups before starting with repeat.

Jeroen Bakker noreply at git.blender.org
Fri Dec 3 11:12:48 CET 2021


Commit: 482b8fb879e779b521dc2c37293bfda9107940f3
Author: Jeroen Bakker
Date:   Fri Dec 3 10:41:16 2021 +0100
Branches: temp-gpu-image-engine
https://developer.blender.org/rB482b8fb879e779b521dc2c37293bfda9107940f3

Some small cleanups before starting with repeat.

===================================================================

M	source/blender/draw/engines/image/image_drawing_mode_screen_space.hh
M	source/blender/draw/engines/image/image_private.hh
M	source/blender/draw/engines/image/image_space_image.hh
M	source/blender/draw/engines/image/shaders/engine_image_vert.glsl

===================================================================

diff --git a/source/blender/draw/engines/image/image_drawing_mode_screen_space.hh b/source/blender/draw/engines/image/image_drawing_mode_screen_space.hh
index 15633cdcd8b..26f5bb895e7 100644
--- a/source/blender/draw/engines/image/image_drawing_mode_screen_space.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode_screen_space.hh
@@ -57,10 +57,12 @@ struct PrivateDataAccessor {
     /* Create a single texture that covers the visible screen space. */
     BLI_rctf_init(
         &pd->screen_space.texture_infos[0].clipping_bounds, 0, region->winx, 0, region->winy);
+    pd->screen_space.texture_infos[0].visible = true;
 
     /* Mark the other textures as invalid. */
     for (int i = 1; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
       BLI_rctf_init_minmax(&pd->screen_space.texture_infos[i].clipping_bounds);
+      pd->screen_space.texture_infos[i].visible = false;
     }
   }
 
@@ -135,20 +137,6 @@ struct ImageTileAccessor {
 
 using namespace blender::bke::image::partial_update;
 
-/* TODO: Should we use static class functions in stead of a namespace. */
-namespace clipping {
-
-static void update_texture_slots_visibility(const AbstractSpaceAccessor *UNUSED(space),
-                                            IMAGE_PrivateData *pd)
-{
-  pd->screen_space.texture_infos[0].visible = true;
-  for (int i = 1; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
-    pd->screen_space.texture_infos[i].visible = false;
-  }
-}
-
-}  // namespace clipping
-
 class ScreenSpaceDrawingMode : public AbstractDrawingMode {
  private:
   DRWPass *create_image_pass() const
@@ -282,6 +270,7 @@ class ScreenSpaceDrawingMode : public AbstractDrawingMode {
                          Image *image) const
   {
     while (iterator.get_next_change() == ePartialUpdateIterResult::ChangeAvailable) {
+      /* Quick exit when tile_buffer isn't availble. */
       if (iterator.tile_data.tile_buffer == nullptr) {
         continue;
       }
@@ -513,7 +502,6 @@ class ScreenSpaceDrawingMode : public AbstractDrawingMode {
     pda.clear_dirty_flag();
     pda.update_screen_space_bounds(region);
     pda.update_uv_bounds();
-    clipping::update_texture_slots_visibility(space, pd);
     update_texture_slot_allocation(txl, pd);
 
     // Step: Update the GPU textures based on the changes in the image.
diff --git a/source/blender/draw/engines/image/image_private.hh b/source/blender/draw/engines/image/image_private.hh
index 771a7021ab2..d50df426728 100644
--- a/source/blender/draw/engines/image/image_private.hh
+++ b/source/blender/draw/engines/image/image_private.hh
@@ -116,7 +116,6 @@ struct IMAGE_Data {
 #define IMAGE_DRAW_FLAG_SHUFFLING (1 << 2)
 #define IMAGE_DRAW_FLAG_DEPTH (1 << 3)
 #define IMAGE_DRAW_FLAG_DO_REPEAT (1 << 4)
-#define IMAGE_DRAW_FLAG_USE_WORLD_POS (1 << 5)
 
 struct ShaderParameters {
   constexpr static float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
diff --git a/source/blender/draw/engines/image/image_space_image.hh b/source/blender/draw/engines/image/image_space_image.hh
index 4da2f1435f6..559a76d4655 100644
--- a/source/blender/draw/engines/image/image_space_image.hh
+++ b/source/blender/draw/engines/image/image_space_image.hh
@@ -61,7 +61,6 @@ class SpaceImageAccessor : public AbstractSpaceAccessor {
     const int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(image_buffer);
     const bool do_repeat = (!is_tiled) && ((sima->flag & SI_DRAW_TILE) != 0);
     SET_FLAG_FROM_TEST(r_shader_parameters.flags, do_repeat, IMAGE_DRAW_FLAG_DO_REPEAT);
-    SET_FLAG_FROM_TEST(r_shader_parameters.flags, is_tiled, IMAGE_DRAW_FLAG_USE_WORLD_POS);
     if ((sima_flag & SI_USE_ALPHA) != 0) {
       /* Show RGBA */
       r_shader_parameters.flags |= IMAGE_DRAW_FLAG_SHOW_ALPHA | IMAGE_DRAW_FLAG_APPLY_ALPHA;
diff --git a/source/blender/draw/engines/image/shaders/engine_image_vert.glsl b/source/blender/draw/engines/image/shaders/engine_image_vert.glsl
index b812f08ff3a..1314928098f 100644
--- a/source/blender/draw/engines/image/shaders/engine_image_vert.glsl
+++ b/source/blender/draw/engines/image/shaders/engine_image_vert.glsl
@@ -1,7 +1,6 @@
 #pragma BLENDER_REQUIRE(common_view_lib.glsl)
 
 #define IMAGE_DRAW_FLAG_DO_REPEAT (1 << 4)
-#define IMAGE_DRAW_FLAG_USE_WORLD_POS (1 << 5)
 #define IMAGE_Z_DEPTH 0.75
 
 uniform int drawFlags;
@@ -29,7 +28,6 @@ void main()
     position.z = IMAGE_Z_DEPTH;
     gl_Position = position;
     /* UDIM texture uses the world position for tile selection. */
-    uvs = image_pos.xy;  //((drawFlags & IMAGE_DRAW_FLAG_USE_WORLD_POS) != 0) ? world_pos.xy :
-                         //image_pos.xy;
+    uvs = image_pos.xy; 
   }
 }



More information about the Bf-blender-cvs mailing list