So, i have a weird phenomena here i cannot get rid of:
here I am using a gradient to stroke a path.
The path is just an open path.
Sometimes (depending on the path’s shape) I get these weird horizontal pixels rendering.
like the one in the top here.
If I use solid color, this does not happen.
It also happens to rounded rectangles with fillPath so it is not an issue with the stroke function.
It does not happen with the software renderer
This happened ever since I updated to 7.0.2
I have not tried to downgrade to 7.0.1 yet, but that is my next step.
Using MacOS Ventura 13.0.1
I would suggest bisecting over JUCE to find the exact commit which broke this. This sometimes provides a lot of insight on the problem, and sometimes even a workaround in the form of a simple revert commit.
If I attach an OpenGL context the artifact disappears. But this isn’t an option because on iOS the performance suffers a lot.
I wish I could help investigate the cause, but I am seeing this on an iOS 16 device and I can’t debug iOS 16 properly (I’m not on Xcode 14 yet so I can only install the app via Archive).
If the JUCE team are looking into this or if anyone has some tip that would be great.
If you can make a code example then I could check if this also reproduces on my macOS 12.5 setup.
If it does then I could try bisecting it.
The snippet in @assaf’s initial post refers to variables such as grad and round which are not included in the snippet, so I can’t make use of that one for a quick check.
So, I managed to get this to disappear by adding the following preprocessor definition:
JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1
It only happens on the Core Graphics renderer
To recreate - set a ColourGradient and stroke a wriggly Path and try to animate it.
The artifacts will often appear - it has to do with the shape.
I am unable to dig into this further at this time, as the pile of paperwork on my desk has almost reached the ceiling! Hopefully, January will be calmer.
I was under the impression this got fixed at some point, can’t remember when though. I have seen no artifacts for a while now, even without the multiple paint calls preprocessor definition. Are you on the latest JUCE version?
I’m filling a path with a color gradient and getting a lot of artifacts when the editor is shown the first time.
The succeeding paints don’t produce any artifacts. The artifacts appear on random places every time the editor is shown for the first time. They won’t appear after closing and reopening.
Setting JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1, as suggested, seems to remove the problem, but is this a real solution?
I searched occurrences of the macro, but didn’t become much wiser. Something to do with metal and low level core graphics. Does anyone know what that does? and i guess most importantly, whether it has any side effects i should be aware of? Is this only effective during initialization? as that would seem to suffice in my case.
So you are still having this issue? How and when exactly do you see the glitches? (JUCE version, target, etc.) I am doing similar things with paths and gradients but haven’t seen the glitches for a while. The glitches seem to appear only under very specific circumstances so it might be difficult to debug this without further information.
This certainly seems to be the case, so I doubt we’ll be able to make any progress without some example code that reproduces the issue. It would also be helpful to know the following:
The exact JUCE version you’re using
The full set of JUCE preprocessor definitions you’re using (ideally, supply a cmakelists or jucer project alongside any sample code)
The exact macOS/iOS version where you see problems