Page MenuHome

Metal: MTLContext implementation and immediate mode rendering support.
ClosedPublic

Authored by Thomas Dinges (dingto) on Sep 13 2022, 9:53 AM.

Details

Summary

Metal: MTLContext implementation and immediate mode rendering support.

MTLContext provides functionality for command encoding, binding management and graphics device management. MTLImmediate provides simple draw enablement with dynamically encoded data. These draws utilise temporary scratch buffer memory to provide minimal bandwidth overhead during workload submission.

This patch also contains empty placeholders for MTLBatch and MTLDrawList to enable testing of first pixels on-screen without failure.

The Metal API also requires access to the GHOST_Context to ensure the same pre-initialized Metal GPU device is used by the viewport. Given the explicit nature of Metal, explicit control is also needed over presentation, to ensure correct work scheduling and rendering pipeline state.

Authored by Apple: Michael Parkin-White

Ref T96261

(The diff is based on 043f59cb3b5835ba1a0bbf6f1cbad080b527f7f6)

Diff Detail

Repository
rB Blender

Event Timeline

Thomas Dinges (dingto) requested review of this revision.Sep 13 2022, 9:53 AM
Thomas Dinges (dingto) created this revision.
Clément Foucault (fclem) requested changes to this revision.Sep 15 2022, 12:46 PM

Small nitpicks, otherwise looks good.

source/blender/gpu/intern/gpu_shader_interface.cc
25–27

Use MEM_SAFE_FREE

source/blender/gpu/metal/mtl_context.hh
582

Use int64_t instead. Applies to all the PR.

source/blender/gpu/metal/mtl_context.mm
147

Left over printf

This revision now requires changes to proceed.Sep 15 2022, 12:46 PM

Thanks for the feedback @Clément Foucault (fclem)! Will address this shortly. Please note that this patch also contains the mtl_vertex_buffer.hh/mtl_vertex_buffer.mm* changes from https://developer.blender.org/D15452 as they were required as a pre-requisite.
D15452 should be merged first however.

DIFF feedback addressed.

This revision is now accepted and ready to land.Sep 22 2022, 5:20 PM