UV islands display issue - macOS Metal #126542
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#126542
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Operating system: Mac Studio (Sonoma 14.5)
Graphics card: Apple M1 Max
Broken: 4.2.0
Broken: 4.3.0 alpha (
baa20eb289
)Worked:
When selecting part of a big mesh, in the UV editor faces appear light orange but visuals of edges are everywhere on the screen, can't precisely work that way.
Everything working as usual though; created UV vertices, edges and faces can be manipulated. Just a visual pain because I can not see them well under all that UV web.
Only on certains meshes, so I assume it might be an issue with big meshes only (I work for WebGL devs so 40k triangles is quite a large mesh in my case).
Exact steps for others to reproduce the error
Select part of the mesh (already selected when opening the .blend file).
Has been like this for a long time (for all I can remember since I started working on this machine 1 year ago).
I can confirm this issue in Blender 4.2.0 with a M1 Pro. Can't on a Windows computer. It's likely to be a Metal issue.
I don't currently know the steps to reproduce this issue from scratch. @thibault-ging Can you provide steps to reproduce this issue from a new file?
I will set to high severity as it's a bad issue.
I figured, Blender seems to have multiple issues on Mac that I don't get on my pc at home.
I tried recreating it from a new file with Susans but have not succeeded. When I append the mesh from my project file into a new .blend the issue is visible though.
Thanks for taking the time.
uv islands display issueto UV islands display issue - macOS MetalThe root cause of the problem is that the Metal vertex fetch path does not consider the base index from the original render command. And this is used when the index buffer range of vertices is less than SHORT_MAX and not starting from 0.
The new Primitive Expansion API (which goal is to replace the Metal vertex fetch path) does the proper thing and is supposed to be used for UV drawing for the Overlay Next project #102179.
I will not take time to fix the Metal Vertex Fetch path and focus on the new implementation which should be default at the start of 4.4. However, it would be nice to fix for 4.2 and 4.3. So I will leave that to Apple to fix it.
@James-McCarthy-4 This is the issue I was mentioning in the meeting today. I am not sure how hard is it to fix for 4.2 / 4.3.
But it will definitely be fixed in 4.4 after replacing the Overlay engine by Overlay next.
@fclem Just to be clear when you say 'base-index' do you mean the indexBufferOffset in the draw command? And you're saying it's not being taken into account when you read the vertex_id in the shader?
@James-McCarthy-4 Yes it is
indexBufferOffset
but in vertex, not in bytes. Seegpu::IndexBuf::index_start_
.It is not taken into account inside the RESOLVE_VERTEX macro of the vertex fetch API.
It should be
MTL_INDEX_DATA_U16[v_id] + index_start_
. I guess it just needs to be passed as uniform.@fclem Hi Clement, indexBufferOffset is just to used to shift the base of the provided index buffer. It's not something that should be added on to an index, the HW uses it when calculating the value of vertex_id to pass into a shader.
i.e. For 32bit indicies.
vertex_id = index_buffer[ vertex_index + (indexBaseOffset / 4)]
So possibly the issue lies somewhere else - unless I'm missing something.
@fclem IIRC the behaviour for GL and Metal differs for values given for baseVertex maybe that's the issue?
@James-McCarthy-4 My bad. You are right. It is in fact
index_base_
(orbaseVertex
) that should be added to the index value from the index buffer.I believe the
indexBufferOffset
is already taken into account when binding the IBO as Storage buffer.I am pretty sure the behavior of GL and Metal regarding
baseVertex
is exactly the same since we feed the same value forMTLDrawList::append
andGLDrawList::append
. But the Metal Vertex Fetch API does not honor this specific offset (which IIRC is only used for 16bit indices).@fclem You're correct - I was thinking of gl_baseVertex which has no equivalent in Metal but I don't think that has any relevance here.
" But the Metal Vertex Fetch API does not honor this specific offset (which IIRC is only used for 16bit indices)."
vertex_id does include the baseVertex according to the Metal Language spec:
vertex_id - ushort or uint - The per-vertex identifier, which includes the base vertex value if one is specified.
(There's a good summary here of the differences between the APIs here: https://github.com/gpuweb/gpuweb/issues/901)
I'm still not sure if we're looking at a compiler/drive bug or a Blender bug. I'll have a look through the Metal draw code.
@James-McCarthy-4
I am looking at a Blender Metal Backend bug (so in our codebase). The SSBO Vertex Fetch API was introduced by Michael PW to be able to workaround Metal's lack of geometry shader.
See the part after
/* SSBO Vertex Fetch Mode. */
insidesource/blender/gpu/shaders/metal/mtl_shader_defines.msl
.When this API is used (e.g. inside
overlay_edit_uv_edges_vert_no_geom.glsl
), thevertex_id
does not represent the indices inside index buffer as the drawcall just emits X number of primitive (the max number of primitive you would expect after geometry shader expansion). The shader then usevertex_fetch_attribute
function to load the index buffer value for a specific input vertex using manual IBO indirection. This indirection is the source of the bug.You can find all code (that I found) related to this API in this PR #127660.