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 043f59cb3b)

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15953
This commit is contained in:
Thomas Dinges
2022-09-22 17:27:51 +02:00
committed by Clément Foucault
parent bb63b98d1f
commit 697b447c20
45 changed files with 3259 additions and 605 deletions

View File

@@ -914,3 +914,22 @@ void gpu_node_graph_prune_unused(GPUNodeGraph *graph)
}
}
}
void gpu_node_graph_optimize(GPUNodeGraph *graph)
{
/* Replace all uniform node links with constant. */
LISTBASE_FOREACH (GPUNode *, node, &graph->nodes) {
LISTBASE_FOREACH (GPUInput *, input, &node->inputs) {
if (input->link) {
if (input->link->link_type == GPU_NODE_LINK_UNIFORM) {
input->link->link_type = GPU_NODE_LINK_CONSTANT;
}
}
if (input->source == GPU_SOURCE_UNIFORM) {
input->source = (input->type == GPU_CLOSURE) ? GPU_SOURCE_STRUCT : GPU_SOURCE_CONSTANT;
}
}
}
/* TODO: Consider performing other node graph optimizations here. */
}