Page MenuHome

Metal: Overlay UV Edge support.
ClosedPublic

Authored by Jason Fielder (jason_apple) on Nov 10 2022, 6:34 PM.

Details

Summary

Implemented geometry shader alternative for rendering of UV edges in Metal, as geometry shaders are unsupported.

Authored by Apple: Michael Parkin-White

Ref T96261

Diff Detail

Repository
rB Blender
Branch
viewport_commits/MetalUVEdges
Build Status
Buildable 24587
Build 24587: arc lint + arc unit

Event Timeline

Jason Fielder (jason_apple) requested review of this revision.Nov 10 2022, 6:34 PM
Jason Fielder (jason_apple) created this revision.
Clément Foucault (fclem) requested changes to this revision.Nov 12 2022, 7:53 PM
Clément Foucault (fclem) added inline comments.
source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh
238

Maybe only define this if WITH_METAL_BACKEND is defined. Otherwise just comment it out, as it will prevent using compile-time shader compilation with OpenGL backend.

source/blender/draw/engines/overlay/shaders/overlay_edit_uv_edges_vert_no_geom.glsl
44–45

Do not use gl_ prefix. These are reserved and might cause compilation issue on some implementation. Use ndc_pos instead.

This revision now requires changes to proceed.Nov 12 2022, 7:53 PM
source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh
238

Ah yes, this was a problem with the other similar cases as well. Will go through and apply the macro guard.

Though wondering if there should be anything safer for the cases where Metal + GL will be simultaneously available? I can add a non-functional pass-through implementation in the GLSL header to prevent compilation failure, though conscious of bloat.

Presuming API-availability at the create-info level would be a little clunky?

Another option could be to simply guard the shader source with GPU_METAL, such that the GLSL shader can still be compiled.

source/blender/draw/engines/overlay/shaders/infos/overlay_edit_mode_info.hh
238

I think you can add bool metal_backen_only_ = false; to the ShaderCreateInfo for now, and set it to true for these special shaders . Eventually, we want to have no special entire shaders for that.

Implemented geometry shader alternative for rendering of UV edges in Metal, as geometry shaders are unsupported.
Added ShaderCreateInfo flag to disable static compilation for Metal-only shaders when running with different backends.

This revision is now accepted and ready to land.Dec 8 2022, 5:26 PM
This revision was automatically updated to reflect the committed changes.