GP Fill Tool not working on Mac with Metal GPU Backend #109363

Closed
opened 2023-06-26 11:03:32 +02:00 by CreateAniMissions · 37 comments

System Information
Operating system: macOS-13.4-x86_64-i386-64bit 64 Bits
Graphics card: AMD Radeon Pro 5500M OpenGL Engine ATI Technologies Inc. 4.1 ATI-4.12.7

Blender Version
Broken: version: 3.5.1, branch: blender-v3.5-release, commit date: 2023-04-24 18:11, hash: e1ccd9d4a1d3
Worked: (newest version of Blender that worked as expected)

Short description of error
When my GPU Backend is set to Metal, the Fill Tool in Grease Pencil is not working. It either doesn't fill, or fills randomly (and yes, my shapes are closed). If I switch my GPU Backend to OpenGL, the Fill Tool works as expected (although I have to click twice)

Exact steps for others to reproduce the error
With the Metal Backend turned on in Preferences...

  1. I open a new 2D Animation file.
  2. I select Ink Pen as my brush type.
  3. I draw some simple shapes.
  4. I switch to the Fills layer.
  5. I switch to the Fill Tool.
  6. I switch to a fill material.
  7. I click inside the drawn shapes.
  8. Some shapes fill and some shapes don't.

In this file there is a case where the Fill tool works with OpenGL but not with Metal: fill_metal_bug.blend

**System Information** Operating system: macOS-13.4-x86_64-i386-64bit 64 Bits Graphics card: AMD Radeon Pro 5500M OpenGL Engine ATI Technologies Inc. 4.1 ATI-4.12.7 **Blender Version** Broken: version: 3.5.1, branch: blender-v3.5-release, commit date: 2023-04-24 18:11, hash: `e1ccd9d4a1d3` Worked: (newest version of Blender that worked as expected) **Short description of error** When my GPU Backend is set to Metal, the Fill Tool in Grease Pencil is not working. It either doesn't fill, or fills randomly (and yes, my shapes are closed). If I switch my GPU Backend to OpenGL, the Fill Tool works as expected (although I have to click twice) <video src="/attachments/ced91529-9b57-4b74-b47b-012b02dd53c6" title="IMG_8032.MOV" controls height="360"></video> **Exact steps for others to reproduce the error** With the Metal Backend turned on in Preferences... 1. I open a new 2D Animation file. 2. I select Ink Pen as my brush type. 3. I draw some simple shapes. 4. I switch to the Fills layer. 5. I switch to the Fill Tool. 6. I switch to a fill material. 7. I click inside the drawn shapes. 8. Some shapes fill and some shapes don't. In this file there is a case where the Fill tool works with OpenGL but not with Metal: [fill_metal_bug.blend](/attachments/4a14e0d3-94b6-445c-8a81-1ca645a94069)
CreateAniMissions added the
Type
Report
Status
Needs Triage
Priority
Normal
labels 2023-06-26 11:03:33 +02:00
Member

Hi, this should be fixed already, see: #107766
Please download and verify in 3.6-beta: https://builder.blender.org/download/daily/

Hi, this should be fixed already, see: #107766 Please download and verify in 3.6-beta: https://builder.blender.org/download/daily/

No, it's not completely fixed. I downloaded the stable 3.6 just now and it's only filling about half the shapes. The bug is definitely still there, and even when the Fill Tool works, I have to click twice to get it to fill the shape. Also, the OpenGL bug with the Draw Tool is still there, too.

No, it's not completely fixed. I downloaded the stable 3.6 just now and it's only filling about half the shapes. The bug is definitely still there, and even when the Fill Tool works, I have to click twice to get it to fill the shape. Also, the OpenGL bug with the Draw Tool is still there, too.
Member

@CreateAniMissions Hi, could you check the daily build from the link above? Stable version will need some time till the next release where all fixes were in. Thanks!

@CreateAniMissions Hi, could you check the daily build from the link above? Stable version will need some time till the next release where all fixes were in. Thanks!

No, it's still the same using the version at the link you gave me. I am using the Intel version, btw, not the Apple Silicon. In the attached file you can see which areas filled and which areas didn't. No rhyme or reason I can see. And the Draw Tool issue with the OpenGL Backend is still working incorrectly (strokes not visible when drawing).

No, it's still the same using the version at the link you gave me. I am using the Intel version, btw, not the Apple Silicon. In the attached file you can see which areas filled and which areas didn't. No rhyme or reason I can see. And the Draw Tool issue with the OpenGL Backend is still working incorrectly (strokes not visible when drawing).
Member

Thanks. Could you update reproducing steps in report description and share .blend file in which the problem is visible?

re: Draw Tool issue with the OpenGL Backend is still working incorrectly (strokes not visible when drawing).

Yes, this is now a known issue on OpenGL backend and won't be fixed further, see: #102251 (#102251 (comment))

Thanks. Could you update reproducing steps in report description and share .blend file in which the problem is visible? > re: Draw Tool issue with the OpenGL Backend is still working incorrectly (strokes not visible when drawing). Yes, this is now a known issue on OpenGL backend and won't be fixed further, see: #102251 (https://projects.blender.org/blender/blender/issues/102251#issuecomment-93907)
Pratik Borhade changed title from GP Fill Tool not working on Mac with Metal GPU Backend, Draw Tool not working properly on OpenGL to GP Fill Tool not working on Mac with Metal GPU Backend 2023-06-27 06:51:48 +02:00

With the Metal Backend turned on in Preferences...

  1. I open a new 2D Animation file.
  2. I select Ink Pen as my brush type.
  3. I draw some simple shapes.
  4. I switch to the Fills layer.
  5. I switch to the Fill Tool.
  6. I switch to a fill material.
  7. I click inside the drawn shapes.
  8. Some shapes fill and some shapes don't.
With the Metal Backend turned on in Preferences... 1. I open a new 2D Animation file. 2. I select Ink Pen as my brush type. 3. I draw some simple shapes. 4. I switch to the Fills layer. 5. I switch to the Fill Tool. 6. I switch to a fill material. 7. I click inside the drawn shapes. 8. Some shapes fill and some shapes don't.
Member

Thanks.

Some shapes fill and some shapes don't.

Still a blend file will help to speed up the investigation.

@Michael-Parkin-White-Apple hi, can you check?

Thanks. > Some shapes fill and some shapes don't. Still a blend file will help to speed up the investigation. @Michael-Parkin-White-Apple hi, can you check?
Pratik Borhade added the
Platform
macOS
Interest
Metal
labels 2023-06-27 07:45:23 +02:00

Sorry, I did not think it was necessary since I am starting with a generic 2D Animation file. Here is an example file...

Sorry, I did not think it was necessary since I am starting with a generic 2D Animation file. Here is an example file...

Ah right, I will take a look into this and see what is going on.

Ah right, I will take a look into this and see what is going on.
Pratik Borhade added
Status
Confirmed
Module
EEVEE & Viewport
and removed
Status
Needs Triage
labels 2023-07-04 11:14:43 +02:00

I just installed Blender 4.0 and tested the Fill Tool, and it is still not working. Only now there is another problem... there is no longer a section in the Preferences under System to switch between Metal and OpenGL! So the only workaround has been removed, which leaves Grease Pencil completely unusable for artists in Blender 4.0. Help!

I just installed Blender 4.0 and tested the Fill Tool, and it is still not working. Only now there is another problem... there is no longer a section in the Preferences under System to switch between Metal and OpenGL! So the only workaround has been removed, which leaves Grease Pencil completely unusable for artists in Blender 4.0. Help!
Member

Yes, the OpenGL support has been removed for MacOS because newer feature requires OpenGL 4.3: cdb8a8929c

Yes, the OpenGL support has been removed for MacOS because newer feature requires OpenGL 4.3: cdb8a8929cecd09735092e9ad1fc3adf15501615

So this means the Fill Tool will simply not be available to folks using Intel Macs?
Is there another workaround for this issue?

So this means the Fill Tool will simply not be available to folks using Intel Macs? Is there another workaround for this issue?
Member

I'm not sure when this will be fixed in legacy GP. But there will be a new generation of grease pencil (GPv3) in 4.1 which may not have this bug.

I'm not sure when this will be fixed in legacy GP. But there will be a new generation of grease pencil (GPv3) in 4.1 which may not have this bug.

Okay, great. That sounds hopeful. 🙂

Okay, great. That sounds hopeful. 🙂
Germano Cavalcante added
Module
Grease Pencil
Interest
EEVEE & Viewport
and removed
Module
EEVEE & Viewport
labels 2023-12-19 19:57:01 +01:00

I have downloaded 4.1.0 Alpha and am still having this issue

I have downloaded 4.1.0 Alpha and am still having this issue

I'm not sure when this will be fixed in legacy GP. But there will be a new generation of grease pencil (GPv3) in 4.1 which may not have this bug.

Has GP3 not been implemented yet?

> I'm not sure when this will be fixed in legacy GP. But there will be a new generation of grease pencil (GPv3) in 4.1 which may not have this bug. Has GP3 not been implemented yet?

Also I do not have an intel chip. I have an apple M2 Max chip. Same problem

Also I do not have an intel chip. I have an apple M2 Max chip. Same problem
Member

Has GP3 not been implemented yet?

Postponed to 4.2, GPv3 is still under heavy development.

Raising the priority for now since this is been around for a while (3.6 LTS is broken too) and we got decent number of reports already.

> Has GP3 not been implemented yet? Postponed to 4.2, GPv3 is still under heavy development. Raising the priority for now since this is been around for a while (3.6 LTS is broken too) and we got decent number of reports already.
Pratik Borhade added
Priority
High
and removed
Priority
Normal
labels 2024-02-05 04:49:54 +01:00

Yep I'm getting the same bug on Macbook M1 Pro Sonoma.

Fill tool just doesn't work.

Yep I'm getting the same bug on Macbook M1 Pro Sonoma. Fill tool just doesn't work.
Contributor

Managed to reproduce with only one shape from given file on 4.0.0

Somehow it depends on zoom.

On build from master 4.2.0 Alpha could not reproduce.

Managed to reproduce with only one shape from given file on 4.0.0 <video src="/attachments/1f1819ad-903b-42bd-a656-af4cd4dbfc47" title="fill.m4v" width="454" height="300" controls></video> Somehow it depends on zoom. On build from master 4.2.0 Alpha could not reproduce.
465 KiB
Falk David added this to the Grease Pencil project 2024-03-08 12:21:49 +01:00
Member

@fclem @Jeroen-Bakker Could you look into this?

@fclem @Jeroen-Bakker Could you look into this?

To debug this, an image of the GPU buffer can be written out like this:

diff --git a/source/blender/editors/gpencil_legacy/gpencil_fill.cc b/source/blender/editors/gpencil_legacy/gpencil_fill.cc
index ca8d6fcd961..6c9308ca9d4 100644
--- a/source/blender/editors/gpencil_legacy/gpencil_fill.cc
+++ b/source/blender/editors/gpencil_legacy/gpencil_fill.cc
@@ -1333,6 +1333,12 @@ static bool gpencil_render_offscreen(tGPDfill *tgpf)
     IMB_rect_from_float(ibuf);
   }
 
+  static int counter = 0;
+  char filepath[FILE_MAX];
+  ibuf->ftype = IMB_FTYPE_OPENEXR;
+  BLI_snprintf(filepath, sizeof(filepath), "/tmp/gpencil_fill%d.exr", counter++);
+  IMB_saveiff(ibuf, filepath, IB_rectfloat);
+
   tgpf->ima = BKE_image_add_from_imbuf(tgpf->bmain, ibuf, "GP_fill");
   tgpf->ima->id.tag |= LIB_TAG_DOIT;
 

Here is what it looks like:

Linux macOS
linux.png mac.png

Evidently there is some issue with the stroke width. It's gpencil_draw_stroke_3d in source/blender/editors/gpencil_legacy/drawgpencil.cc that is drawing these white strokes. Not sure why there are both white and red strokes.

To debug this, an image of the GPU buffer can be written out like this: ``` diff --git a/source/blender/editors/gpencil_legacy/gpencil_fill.cc b/source/blender/editors/gpencil_legacy/gpencil_fill.cc index ca8d6fcd961..6c9308ca9d4 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_fill.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_fill.cc @@ -1333,6 +1333,12 @@ static bool gpencil_render_offscreen(tGPDfill *tgpf) IMB_rect_from_float(ibuf); } + static int counter = 0; + char filepath[FILE_MAX]; + ibuf->ftype = IMB_FTYPE_OPENEXR; + BLI_snprintf(filepath, sizeof(filepath), "/tmp/gpencil_fill%d.exr", counter++); + IMB_saveiff(ibuf, filepath, IB_rectfloat); + tgpf->ima = BKE_image_add_from_imbuf(tgpf->bmain, ibuf, "GP_fill"); tgpf->ima->id.tag |= LIB_TAG_DOIT; ``` Here is what it looks like: |Linux|macOS| |-|-| |![linux.png](/attachments/562daec5-4504-49fc-8406-9118cea126ca)|![mac.png](/attachments/66a61289-79a6-4b15-a84a-86ed1cd0c0d8)| Evidently there is some issue with the stroke width. It's `gpencil_draw_stroke_3d` in `source/blender/editors/gpencil_legacy/drawgpencil.cc` that is drawing these white strokes. Not sure why there are both white and red strokes.
155 KiB
@Michael-Parkin-White-Apple are you on it?

Thanks @brecht this helps clarify why the issue has been occurring, and should help with reproduction. @fclem I'll get on this.

My guess is what has happened is a possible change in the original grease pencil geometry shader after porting the non-geometry version to Metal, though this likely happened a while back.

Thanks @brecht this helps clarify why the issue has been occurring, and should help with reproduction. @fclem I'll get on this. My guess is what has happened is a possible change in the original grease pencil geometry shader after porting the non-geometry version to Metal, though this likely happened a while back.

PR issued with the fix. Strokes should now render the same as OpenGL.
There were a few small issues present, thickness and color parameters were being incorrectly propagated, and the datatype for color was also being misread utilising the incorrect source vertex data type.

Should this be a backport target for 3.6 LTS and 4.1?

(Given the modified files hadn't changed in quite a long time, should be a fairly straight-forward cherry-pick).

PR issued with the fix. Strokes should now render the same as OpenGL. There were a few small issues present, thickness and color parameters were being incorrectly propagated, and the datatype for color was also being misread utilising the incorrect source vertex data type. Should this be a backport target for 3.6 LTS and 4.1? (Given the modified files hadn't changed in quite a long time, should be a fairly straight-forward cherry-pick).
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-03-20 15:49:42 +01:00

This fix will be backported to 3.6 as well.

This fix will be backported to 3.6 as well.

Hi, so is this live in the 3.6 LTS now? Thanks

Hi, so is this live in the 3.6 LTS now? Thanks
Member

Not yet. This will be in 3.6.11

Not yet. This will be in 3.6.11

Thank you!

Thank you!

Hi folks
This is still happening in 4.0.2
I'm just not sure what your release cycle is like with this patch (pardon me, newbie)

Hi folks This is still happening in 4.0.2 I'm just not sure what your release cycle is like with this patch (pardon me, newbie)
Member

@Drenbot This bug was fixed in main (Blender 4.2) and the fix will also be backported to the current LTS which is Blender 3.6. Blender 4.0 is not an LTS version, so it does not get any more bug fixes.

@Drenbot This bug was fixed in main (Blender 4.2) and the fix will also be backported to the current LTS which is Blender 3.6. Blender 4.0 is not an LTS version, so it does not get any more bug fixes.

Just did a test on 4.2 but the bug is still there. M1 Pro Sonoma

Just did a test on 4.2 but the bug is still there. M1 Pro Sonoma
Member

@Cybran Just to make sure, what's the date/time of the build? You can see this info when you click the blender logo in the top left > "About Blender".

@Cybran Just to make sure, what's the date/time of the build? You can see this info when you click the blender logo in the top left > "About Blender".

@Cybran Just to make sure, what's the date/time of the build? You can see this info when you click the blender logo in the top left > "About Blender".

Hope that helps

> @Cybran Just to make sure, what's the date/time of the build? You can see this info when you click the blender logo in the top left > "About Blender". Hope that helps
Member

@Cybran Looks like that build was not recent enough and doesn't include the fix:
Time of the build: 2024-03-20 00:51
Time of commit of the fix: 2024-03-20 15:38
Try the latest build from https://builder.blender.org/download/daily/

@Cybran Looks like that build was not recent enough and doesn't include the fix: Time of the build: `2024-03-20 00:51` Time of commit of the fix: `2024-03-20 15:38` Try the latest build from https://builder.blender.org/download/daily/

@filedescriptor Oh good i'm glad. Will give that build a go. Thanks!

@filedescriptor Oh good i'm glad. Will give that build a go. Thanks!

That works! Thank you all

That works! Thank you all
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
11 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#109363
No description provided.