Cycles: Use new MetalRT curve primitives for 3D curves and ribbons #111795

Merged
Michael Jones (Apple) merged 1 commits from Michael-Jones/blender:MetalRTCurves_Sep1 into main 2023-09-13 16:02:58 +02:00

This patch updates the experimental MetalRT code path to use new curve primitives which were recently added in macOS 14. This replaces the previous custom box intersection implementation, allowing the driver to better optimise curve acceleration structures for the GPU. On existing hardware, this can speed up MetalRT renders by up to 40% for scenes that use hair / curve primitives extensively.

The MetalRT option will only be available on macOS >= 14, and requires Xcode >= 15 to build (otherwise the option will be compiled out).

Authored by Marco Giordano, Michael Jones, and Jason Fielder


Before / after render times (M1 Max MacBook Pro, macOS 14 beta, MetalRT enabled):

                  Custom box intersection      MetalRT curve primitives       Speedup
fishy_cat           111.5                         80.5                         1.39
koro                114.4                         86.7                         1.32
sinosauropteryx     291.8                        279.2                         1.05
spring              142.3                        142.2                         1.00
victor              442.7                        347.7                         1.27

This patch updates the experimental MetalRT code path to use new [curve primitives](https://developer.apple.com/videos/play/wwdc2023/10128/) which were recently added in macOS 14. This replaces the previous custom box intersection implementation, allowing the driver to better optimise curve acceleration structures for the GPU. On existing hardware, this can speed up MetalRT renders by up to 40% for scenes that use hair / curve primitives extensively. The MetalRT option will only be available on macOS >= 14, and requires Xcode >= 15 to build (otherwise the option will be compiled out). Authored by Marco Giordano, Michael Jones, and Jason Fielder --- Before / after render times (M1 Max MacBook Pro, macOS 14 beta, MetalRT enabled): ``` Custom box intersection MetalRT curve primitives Speedup fishy_cat 111.5 80.5 1.39 koro 114.4 86.7 1.32 sinosauropteryx 291.8 279.2 1.05 spring 142.3 142.2 1.00 victor 442.7 347.7 1.27 ``` ---
Michael Jones (Apple) changed title from [WIP] MetalRT curves to WIP: MetalRT curves 2023-09-01 16:55:16 +02:00
Author
Member

@blender-bot build

@blender-bot build
Michael Jones (Apple) force-pushed MetalRTCurves_Sep1 from 671e2c30c8 to ac145448ee 2023-09-01 18:05:10 +02:00 Compare
Author
Member

@blender-bot build

@blender-bot build
Michael Jones (Apple) force-pushed MetalRTCurves_Sep1 from ac145448ee to a028dfe8b9 2023-09-02 11:32:29 +02:00 Compare
Michael Jones (Apple) changed title from WIP: MetalRT curves to Cycles: Use new MetalRT curve primitives for 3D curves and ribbons 2023-09-04 11:38:27 +02:00
Michael Jones (Apple) requested review from Brecht Van Lommel 2023-09-04 11:38:52 +02:00
Author
Member

Hey @brecht, I recreated this PR from a clean branch and the buildbot seems happier with it - should be fine to review now.

Hey @brecht, I recreated this PR from a clean branch and the buildbot seems happier with it - should be fine to review now.
Michael Jones (Apple) force-pushed MetalRTCurves_Sep1 from a028dfe8b9 to ef7567f60a 2023-09-06 23:03:17 +02:00 Compare
Michael Jones (Apple) force-pushed MetalRTCurves_Sep1 from ef7567f60a to bc4a406a0d 2023-09-06 23:23:35 +02:00 Compare
Author
Member

@brecht , I couldn't see any linker warnings in a clean build of this using Xcode 15, just a handful of compiler warnings in btSoftBody.cpp (see attached log)

@brecht , I couldn't see any linker warnings in a clean build of this using Xcode 15, just a handful of compiler warnings in btSoftBody.cpp (see attached log)

@Michael-Jones, details on the linker warnings are in #110243. It seems the latest Xcode beta with classic linker avoids the warnings, though the new linker still has them. So at least we can work around this for now.

@Michael-Jones, details on the linker warnings are in #110243. It seems the latest Xcode beta with classic linker avoids the warnings, though the new linker still has them. So at least we can work around this for now.
Brecht Van Lommel requested changes 2023-09-08 17:19:00 +02:00
Brecht Van Lommel left a comment
Owner

Can you run make format PATHS=intern/cycles? The formatting seems off in various places.

Can you run `make format PATHS=intern/cycles`? The formatting seems off in various places.
@ -836,4 +948,2 @@
for (Object *ob : objects) {
/* Skip non-traceable objects */
if (!ob->is_traceable())
continue;

Was this removed intentionally? If so, the comment should be updated.

Was this removed intentionally? If so, the comment should be updated.
Michael-Jones marked this conversation as resolved
@ -608,2 +719,2 @@
accelDesc.motionStartBorderMode = MTLMotionBorderModeVanish;
accelDesc.motionEndBorderMode = MTLMotionBorderModeVanish;
// accelDesc.motionStartBorderMode = MTLMotionBorderModeVanish;
// accelDesc.motionEndBorderMode = MTLMotionBorderModeVanish;

Can you remove this code or add a comment explaining why it is commented out?

Can you remove this code or add a comment explaining why it is commented out?
Michael-Jones marked this conversation as resolved
Brecht Van Lommel approved these changes 2023-09-12 15:12:14 +02:00
Michael Jones (Apple) force-pushed MetalRTCurves_Sep1 from c9773d879f to 7ec90dbb95 2023-09-13 15:56:51 +02:00 Compare
Michael Jones (Apple) merged commit 6c98cb73ac into main 2023-09-13 16:02:58 +02:00
Michael Jones (Apple) deleted branch MetalRTCurves_Sep1 2023-09-13 16:02:59 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
2 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#111795
No description provided.