Metal: MTLContext implementation and immediate mode rendering support.
commit697b447c2069bbbbaa9929aab0ea1f66ef8bf4d0
authorThomas Dinges <dingto>
Thu, 22 Sep 2022 15:27:51 +0000 (22 17:27 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Thu, 22 Sep 2022 15:32:43 +0000 (22 17:32 +0200)
treef5c78b102b5c1478fb1dbd262b23508f5f072e33
parentbb63b98d1ff5acfd24dff9b5e72175f82f5bca26
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)

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15953
45 files changed:
intern/ghost/intern/GHOST_Context.h
intern/ghost/intern/GHOST_ContextCGL.h
intern/ghost/intern/GHOST_ContextCGL.mm
intern/ghost/intern/GHOST_Window.cpp
intern/ghost/intern/GHOST_Window.h
intern/ghost/test/multitest/MultiTest.c
source/blender/draw/DRW_engine.h
source/blender/draw/engines/eevee/eevee_lightcache.c
source/blender/draw/engines/eevee_next/eevee_shader.cc
source/blender/draw/intern/DRW_render.h
source/blender/draw/intern/draw_manager.c
source/blender/draw/intern/draw_manager_shader.c
source/blender/gpu/CMakeLists.txt
source/blender/gpu/GPU_context.h
source/blender/gpu/GPU_material.h
source/blender/gpu/intern/gpu_backend.hh
source/blender/gpu/intern/gpu_codegen.cc
source/blender/gpu/intern/gpu_codegen.h
source/blender/gpu/intern/gpu_context.cc
source/blender/gpu/intern/gpu_material.c
source/blender/gpu/intern/gpu_node_graph.c
source/blender/gpu/intern/gpu_node_graph.h
source/blender/gpu/intern/gpu_shader_builder.cc
source/blender/gpu/intern/gpu_shader_interface.cc
source/blender/gpu/metal/mtl_backend.hh
source/blender/gpu/metal/mtl_backend.mm
source/blender/gpu/metal/mtl_batch.hh [new file with mode: 0644]
source/blender/gpu/metal/mtl_command_buffer.mm
source/blender/gpu/metal/mtl_common.hh
source/blender/gpu/metal/mtl_context.hh
source/blender/gpu/metal/mtl_context.mm
source/blender/gpu/metal/mtl_drawlist.hh [new file with mode: 0644]
source/blender/gpu/metal/mtl_immediate.hh [new file with mode: 0644]
source/blender/gpu/metal/mtl_immediate.mm [new file with mode: 0644]
source/blender/gpu/metal/mtl_memory.hh
source/blender/gpu/metal/mtl_shader.hh
source/blender/gpu/metal/mtl_shader.mm
source/blender/gpu/metal/mtl_shader_generator.mm
source/blender/gpu/metal/mtl_texture.mm
source/blender/gpu/metal/mtl_texture_util.mm
source/blender/gpu/opengl/gl_backend.hh
source/blender/gpu/tests/gpu_testing.cc
source/blender/render/intern/pipeline.cc
source/blender/windowmanager/intern/wm_playanim.c
source/blender/windowmanager/intern/wm_window.c