Bug 398689

Summary: Image disappears when zooming in after scale transform
Product: [Applications] krita Reporter: Alberto <afonseca08>
Component: ToolsAssignee: vanyossi <ghevan>
Status: ASSIGNED ---    
Severity: normal CC: afonseca08, borkborkas, chris, dimula73, ghevan, halla, mangatengu, s.sbch, simon__sez, vyasab
Priority: NOR    
Version: 4.1.1   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Video repro
krita settings file
Canvas input profile
KritaSystemInformation.txt

Description Alberto 2018-09-16 01:16:02 UTC
Steps to reproduce:

1. Open an image in Kitra.
2. Select Image/Scale Image to New Size... from menu
3. Enter a size smaller than the original and click OK
4. Select Zoom tool and click to zoom in a few times
5. Observer the image starts to "fade" away until it is no longer visible

Please see video to illustrate above steps and behavior. I can reproduce this bug with other images consistently.
Comment 1 Alberto 2018-09-16 01:32:26 UTC
Created attachment 114988 [details]
Video repro
Comment 2 Alberto 2018-09-16 01:42:14 UTC
Additional details:
Source image used:
PNG 5204x3472

Hardware:
Single display.

Krita
  Version: 4.1.1

OS Information
  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: darwin
  Kernel Version: 17.7.0
  Pretty Productname: macOS High Sierra (10.13)
  Product Type: osx
  Product Version: 10.13

OpenGL Info
  **OpenGL not initialized**
Comment 3 Halla Rempt 2018-09-17 08:37:07 UTC
Hi Alberto,

I'm sorry, but I cannot reproduce this issue on my Mac. Maybe you should try as a different user on your system to see whether some settings are broken? If so, I'd like to see the contents of the kritarc file and the input configuration settings. (See https://docs.krita.org/en/KritaFAQ.html#where-are-the-configuration-files-stored)
Comment 4 Alberto 2018-09-17 08:47:10 UTC
Hi Boudewijn,

Thank you for following-up. This is a fresh install of Krita as I'm a new user to the software. I only have one user account on my Mac so I am including the requested kritarc file here.

Where can I find the input configuration settings? 

Also, I encounter the same issue after performing a crop operation.

Please let me know if I can provide any more information.
Comment 5 Alberto 2018-09-17 08:47:24 UTC
Created attachment 115030 [details]
krita settings file

Requested kritarc file
Comment 6 Alberto 2018-09-17 08:58:55 UTC
Created attachment 115031 [details]
Canvas input profile

I believe this is what was asked for, I don't think I've changed anything here from the default.
Comment 7 Halla Rempt 2018-09-17 09:35:28 UTC
Hi Alberto,

I'm really puzzled... Can you check whether you can enable canvas acceleration in settings/configure krita/display?
Comment 8 Alberto 2018-09-17 09:43:20 UTC
(In reply to Boudewijn Rempt from comment #7)
> Hi Alberto,
> 
> I'm really puzzled... Can you check whether you can enable canvas
> acceleration in settings/configure krita/display?

Ah, yes, that is it! If I uncheck it, then the issue goes away and everything works as expected (same with the crop operation).

So the bug happens in the default state, with the Canvas Graphics Acceleration enabled.
Comment 9 Halla Rempt 2018-09-17 10:04:04 UTC
Curious, because the info you pasted before said "opengl not initialized", while apparently it was. The problem is that on my mac, it doesn't matter whether opengl is enabled or not. Does your mac have an AMD gpu?
Comment 10 Alberto 2018-09-17 10:06:31 UTC
No, it's a MacBook Pro (Retina, 15-inch, Mid 2014) it's running an NVIDIA:

NVIDIA GeForce GT 750M 2048 MB
Intel Iris Pro 1536 MB
Comment 11 Halla Rempt 2018-09-17 10:07:47 UTC
If you enable gpu acceleration again, does it make a difference on which gpu you run Krita?
Comment 12 Alberto 2018-09-17 10:10:19 UTC
If I re-enable the checkbox, the issue returns. I don't think I can choose which renderer, it has OpenGL listed but the box is disabled and can't be altered.
Comment 13 Halla Rempt 2018-09-17 10:24:58 UTC
What I meant was switching manually between the gpu's and then testing Krita. Something like http://osxdaily.com/2010/05/08/manually-switch-graphics-cards-on-core-i5-and-i7-macbook-pros/
Comment 14 Alberto 2018-09-17 19:29:45 UTC
Thank you for clarifying, I wasn't aware you could do that. I downloaded the switching software for testing and found that the issue does not appear if I switch to Integrated only. If I leave it to Discrete or Dynamic then the issue is present. Note: I had to disconnect my external display in order to for the switcher to allow me to switch to Integrated. I normally run with an external display connected.

So the issue seems to happen when the NVIDIA GPU is used.
Comment 15 Halla Rempt 2018-09-18 08:58:15 UTC
Thanks for testing. I don't have access to a mac with an nvidia gpu, which is going to make finding a fix or workaround really hard :-(. But at least we now know where to look.
Comment 16 Dmitry Kazakov 2018-09-18 14:54:10 UTC
Hi, Alberto!

Can I ask you to try two things:

0) Enable back NVidia GPU

1) Go to Settings->Display->Scaling Mode and set 'Bilinear Filtering'. Does it solve the problem?

2) Disable a checkbox in View->Instant Preview disabled and check if the problem still persists?
Comment 17 Alberto 2018-09-19 00:56:42 UTC
(In reply to Dmitry Kazakov from comment #16)
> Hi, Alberto!
> 
> Can I ask you to try two things:
> 
> 0) Enable back NVidia GPU
> 
> 1) Go to Settings->Display->Scaling Mode and set 'Bilinear Filtering'. Does
> it solve the problem?
> 
> 2) Disable a checkbox in View->Instant Preview disabled and check if the
> problem still persists?

Hi Dmitry,

I tried the steps you suggested but neither one resolved the issue. However, since I was there on a whim I tried unchecking the "Use texture buffer" box below Scaling Mode and that seems to work. The checkbox is enabled by default.

So hopefully this helps narrow it down further, NVIDIA gpu with the default "Use texture buffer" enabled produces the issue.
Comment 18 Halla Rempt 2018-09-19 07:12:05 UTC
Ah, that's interesting as well.
Comment 19 Halla Rempt 2018-10-11 09:26:35 UTC
So, I'm going to assume that this is a bug in nvidia's macOS opengl driver -- and since apple no longer uses nvidia, it's unlikely nvidia will ever fix the issue...
Comment 20 Alberto 2018-10-15 01:56:13 UTC
Thank you for the update. I have a couple of questions regarding the bug status and process as I'm still getting up to speed here.

1. Was someone able to isolate the specific OpenGL API call that is not working as it's supposed to on a Mac OS Nvidia GPU? Do we have sufficient information to resolve this bug?

2. If indeed it is a bug in Nvidia's driver on OS X, is there no code workaround possible? I have not encountered a similar bug on other paint/image editing applications on my Mac with this GPU.

3. Although Apple no longer ships new MacBook's with Nvidia GPU's, they are still supported by Apple (I just updated my own Nvidia MacBook to MacOS Mojave). Other Krita users have already reported this issue (other bugs closed out marked as duplicate of this one). What is the support cutoff in terms of hardware age for the purposes of Krita development?
Comment 21 Alberto 2018-10-15 02:33:37 UTC
After doing a bit more research I just opened a bug for including Metal support in Krita. So if that is accepted then this issue would roll into that work.

Bug 399820 - Implement Metal support as OpenGL is deprecated on OS X
Comment 22 Halla Rempt 2018-10-15 09:24:39 UTC
It's simple: we cannot support hardware we don't have access to. We're also way too small to actually buy all kinds of hardware that we'd need to reproduce issues like this.
Comment 23 tertiumsquid 2023-02-12 02:35:15 UTC
This bug still happens in 5.1.5 on a Mac M1, so it seems to be unrelated to Nvidia.  I'm on macOS 12.6.2 using a Mac Mini M1 (2020).  As Alberto said though, unchecking Use Texture Buffer seems to correct the problem.

For me though the image doesn't "gradually" disappear, it goes completely transparent immediately when I zoom in or out after resizing the canvas.  Worse, if I save and re-open the saved file is also completely transparent!

I second the suggestion of switching to the Metal API instead of OpenGL, though I also understand that it may be difficult or impossible.
Comment 24 vanyossi 2023-02-15 23:24:08 UTC
I cannot reproduce the exact behaviour your are getting, Im testing on master (224b842). What I can reproduce is that upon activating zoom, some of the last tiles will not load, the tiles are not gone, just not displayed and saving in this state the data is not lost.

Disabling Texture Buffer will make all tiles to be loaded, The tiles are correctly loaded in debug mode as the canvas takes more time to load each tile, so this bug was difficult to catch. 

For reference I'm on a M1 mac mini as well.

About having the complete image disapear and loose data upon saving, that is a completely different bug and would need to be checked. Could you share your system information from krita -> help menu?
Comment 25 tertiumsquid 2023-02-20 01:46:44 UTC
Created attachment 156518 [details]
KritaSystemInformation.txt
Comment 26 tertiumsquid 2023-02-20 01:53:16 UTC
I tried on the regular 5.1.5 as well as both of today's Plus and Next builds, and the zooming issue is still present unless I disable the Texture Buffer.  Tbh now files seem to save correctly in any build.  Might've been something else, but at the time I did save two files and ended up with a blank transparent image.
Comment 27 vanyossi 2023-08-29 02:55:44 UTC
The canvas is not correctly updated when texture buffer is active. This happens at least from this version up to 5.2.0 beta and master.

The issue before going with 16 buffers was a completely transparent (with small images) or semi transparent images after a canvas operation and pan/move/paint with bigger ones as shown in bug 398689. With the current code an the 16 buffers only some of them fail to update sometimes, leaving. a portion of the image without redraw and showing the checkerboard as shown by bugs 459458, 452655 and 473806. If the image is small enough it can make the entire canvas become transparent.

My current testings are using M! with master (e0fa60d68f) and 5.2.0beta

This is a display error, no data is lost and hiding/showing the a layer makes the image redraw. I'll close all duplicates and use this bug as is the first one to mention a problem with texture buffer with macOS (Nvidia and M1-2).
Comment 28 vanyossi 2023-08-29 02:55:57 UTC
*** Bug 459458 has been marked as a duplicate of this bug. ***
Comment 29 vanyossi 2023-08-29 02:56:23 UTC
*** Bug 452655 has been marked as a duplicate of this bug. ***
Comment 30 vanyossi 2023-08-29 02:56:40 UTC
*** Bug 473806 has been marked as a duplicate of this bug. ***
Comment 31 vanyossi 2023-10-02 14:33:28 UTC
*** Bug 475052 has been marked as a duplicate of this bug. ***
Comment 32 Chris PeƱalver 2023-11-27 00:59:09 UTC
*** Bug 477484 has been marked as a duplicate of this bug. ***