[Bf-blender-cvs] [df5ebd348b6] master: Fix T103556: Cycles viewport unexpected pixel changes when hovering over UI

Brecht Van Lommel noreply at git.blender.org
Tue Jan 10 16:36:13 CET 2023


Commit: df5ebd348b66c16084c47543f95a15fc53da5a0f
Author: Brecht Van Lommel
Date:   Tue Jan 10 16:31:21 2023 +0100
Branches: master
https://developer.blender.org/rBdf5ebd348b66c16084c47543f95a15fc53da5a0f

Fix T103556: Cycles viewport unexpected pixel changes when hovering over UI

With the GPU API the sampler can not be set after texture binding, which caused
a delay of the actual change. Now do both in a single call for correctness and
performance.

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

M	intern/cycles/blender/display_driver.cpp

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

diff --git a/intern/cycles/blender/display_driver.cpp b/intern/cycles/blender/display_driver.cpp
index 58f179d1824..8df0061d8ca 100644
--- a/intern/cycles/blender/display_driver.cpp
+++ b/intern/cycles/blender/display_driver.cpp
@@ -721,8 +721,6 @@ static void draw_tile(const float2 &zoom,
     return;
   }
 
-  GPU_texture_bind(texture.gpu_texture, 0);
-
   /* Trick to keep sharp rendering without jagged edges on all GPUs.
    *
    * The idea here is to enforce driver to use linear interpolation when the image is not zoomed
@@ -735,14 +733,14 @@ static void draw_tile(const float2 &zoom,
   const float zoomed_height = draw_tile.params.size.y * zoom.y;
   if (texture.width != draw_tile.params.size.x || texture.height != draw_tile.params.size.y) {
     /* Resolution divider is different from 1, force nearest interpolation. */
-    GPU_texture_filter_mode(texture.gpu_texture, false);
+    GPU_texture_bind_ex(texture.gpu_texture, GPU_SAMPLER_DEFAULT, 0, false);
   }
   else if (zoomed_width - draw_tile.params.size.x > 0.5f ||
            zoomed_height - draw_tile.params.size.y > 0.5f) {
-    GPU_texture_filter_mode(texture.gpu_texture, false);
+    GPU_texture_bind_ex(texture.gpu_texture, GPU_SAMPLER_DEFAULT, 0, false);
   }
   else {
-    GPU_texture_filter_mode(texture.gpu_texture, true);
+    GPU_texture_bind_ex(texture.gpu_texture, GPU_SAMPLER_FILTER, 0, false);
   }
 
   /* Draw at the parameters for which the texture has been updated for. This allows to always draw



More information about the Bf-blender-cvs mailing list