Shader not working on Mac blender 3.5 - works in Windows #106698

Open
opened 2023-04-08 00:28:05 +02:00 by Adrian Lopez · 9 comments

System Information
Operating system: macOS-13.3-arm64-arm-64bit 64 Bits
Graphics card: Metal API Apple M1 Max 1.2

Blender Version
Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: 1be25cfff18b
Worked: (newest version of Blender that worked as expected)

Short description of error
I have been trying to install the Weight Paint Tools paid addon https://bartoszstyperek.gumroad.com/l/weight_paint_tools?layout=profile&recommended_by=library

This worked fine for years, up till 3.5, now it crashes upon activation. The developer has attempted to update it for metal, but it still wont work. He's sent me a simplified script that he says should work without errors.. but still errors out. See attached blend file.

Run the script

Exact steps for others to reproduce the error
Run the script

**System Information** Operating system: macOS-13.3-arm64-arm-64bit 64 Bits Graphics card: Metal API Apple M1 Max 1.2 **Blender Version** Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: `1be25cfff18b` Worked: (newest version of Blender that worked as expected) **Short description of error** I have been trying to install the Weight Paint Tools paid addon https://bartoszstyperek.gumroad.com/l/weight_paint_tools?layout=profile&recommended_by=library This worked fine for years, up till 3.5, now it crashes upon activation. The developer has attempted to update it for metal, but it still wont work. He's sent me a simplified script that he says should work without errors.. but still errors out. See attached blend file. Run the script **Exact steps for others to reproduce the error** Run the script
Adrian Lopez added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-04-08 00:28:06 +02:00
Adrian Lopez changed title from Shader not working on Mac - works in Windows to Shader not working on Mac blender 3.5 - works in Windows 2023-04-08 00:28:26 +02:00

Description of error
To clarify, bug is related to shader compilation error on Mac, using Metal gpu backend. Shader is working ok on linux nad window, thus I think this may be bug in new blender 3.5 API. Shader is using new gpu.types.ShaderCreateInfo() for drawing.

**Steps to reproduce: **

  1. Switch to Metal gpu backend in blender system preferences.

  2. Run above attached blend file, that contains simple script with gpu drawing, that will give 'shader compilation error' on Metal gpu backend.
    The error itself has noting to do with any addon (it was found by Weight Paint Tool addon user though)

**Description of error** To clarify, bug is related to shader compilation error on Mac, using Metal gpu backend. Shader is working ok on linux nad window, thus I think this may be bug in new blender 3.5 API. Shader is using new gpu.types.ShaderCreateInfo() for drawing. **Steps to reproduce: ** 1. Switch to Metal gpu backend in blender system preferences. 2. Run above attached blend file, that contains simple script with gpu drawing, that will give 'shader compilation error' on Metal gpu backend. The error itself has noting to do with any addon (it was found by Weight Paint Tool addon user though)
Member

Hi, thanks for the report. Unable to repro this on Windows.
AFAICS, new shader API is used in python code.
cc @Michael-Parkin-White-Apple

Hi, thanks for the report. Unable to repro this on Windows. AFAICS, new shader API is used in python code. cc @Michael-Parkin-White-Apple
Pratik Borhade added the
Platform
macOS
Interest
Metal
labels 2023-04-12 06:42:27 +02:00

Thanks @PratikPB2123 I can have a look into this, likely an issue with the create-info setup, but will see which path it is hitting in Metal.

Thanks @PratikPB2123 I can have a look into this, likely an issue with the create-info setup, but will see which path it is hitting in Metal.

Is there way to see the content of the Shader error message? Right now error just says to look into console, but there is no info about which line in shader is causing the problem.

Is there way to see the content of the Shader error message? Right now error just says to look into console, but there is no info about which line in shader is causing the problem.

If running Blender from command line, the compilation error will show in-place. Please note that the code will not map 1:1 with the source provided as GPUShaderCreateInfo generates an entry point wrapper.

The issue caused by this piece of code is that the uniform name col has a namespace conflict with an internal Blender library function parameter which also uses col. Changing the uniform name to ucol.

This is a small limitation with Metal shaders that each variable name, whether uniform, attribute or local/global variable must be uniquely named.

https://wiki.blender.org/wiki/Style_Guide/GLSL May outline some of the considerations for Metal compatibility.

If running Blender from command line, the compilation error will show in-place. Please note that the code will not map 1:1 with the source provided as GPUShaderCreateInfo generates an entry point wrapper. The issue caused by this piece of code is that the uniform name `col` has a namespace conflict with an internal Blender library function parameter which also uses `col`. Changing the uniform name to `ucol`. This is a small limitation with Metal shaders that each variable name, whether uniform, attribute or local/global variable must be uniquely named. https://wiki.blender.org/wiki/Style_Guide/GLSL May outline some of the considerations for Metal compatibility.

So every time I declare uniforms, I have to check if it is not conflicting with blender library parameters? I did not see anything about it in https://wiki.blender.org/wiki/Style_Guide/GLSL, is there list of taken 'names', so we can avoid them? I mean, I do not have mac, so I'm working blind here (maybe u have link to blender source code, that is affecting this issue) . @Michael-Parkin-White-Apple
I guess this issue can be closed, if it is not considered bug.

So every time I declare uniforms, I have to check if it is not conflicting with blender library parameters? I did not see anything about it in https://wiki.blender.org/wiki/Style_Guide/GLSL, is there list of taken 'names', so we can avoid them? I mean, I do not have mac, so I'm working blind here (maybe u have link to blender source code, that is affecting this issue) . @Michael-Parkin-White-Apple I guess this issue can be closed, if it is not considered bug.

Not a high priority issue, but maybe it deserves some attention or documentation showing names that can't be used as uniforms.

Not a high priority issue, but maybe it deserves some attention or documentation showing names that can't be used as uniforms.
Germano Cavalcante added
Status
Needs Info from Developers
and removed
Status
Needs Triage
labels 2023-04-12 21:27:25 +02:00

Yeah, there's definitely room for follow-up here. Perhaps we can more elegantly communicate the compilation failure and at the very least extend the GLSL documentation with a list of constraints which may run into problems with Metal, as the shaders are not GLSL, but semantically similar when compiled to Metal shading language.

Yeah, there's definitely room for follow-up here. Perhaps we can more elegantly communicate the compilation failure and at the very least extend the GLSL documentation with a list of constraints which may run into problems with Metal, as the shaders are not GLSL, but semantically similar when compiled to Metal shading language.

Can confirm.

Can confirm.
Richard Antalik added
Module
EEVEE & Viewport
Status
Confirmed
and removed
Status
Needs Info from Developers
labels 2023-04-13 05:09:23 +02:00
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
6 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#106698
No description provided.