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.
This commit is contained in:
parent
3a98dc6812
commit
df5ebd348b
Notes:
blender-bot
2023-02-14 06:00:51 +01:00
Referenced by issue #103556, Regression: Cycles viewport pixels change if the UI is updated in a certain way.
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue