Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
MslBindingMap.h File Reference

The deterministic Metal argument-table mapping shared by the MSL emitter and the Metal backend. More...

#include <cstdint>
Include dependency graph for MslBindingMap.h:
This graph shows which files directly or indirectly include this file:

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

constexpr uint32_t donner::gpu::shader::MslBufferIndex (uint32_t binding)
 Metal buffer argument-table index for an RHI buffer binding (uniform or storage).
constexpr uint32_t donner::gpu::shader::MslTextureIndex (uint32_t binding)
 Metal texture argument-table index for an RHI texture binding.
constexpr uint32_t donner::gpu::shader::MslSamplerIndex (uint32_t binding)
 Metal sampler argument-table index for an RHI sampler binding.

Variables

constexpr uint32_t donner::gpu::shader::kMslVertexBufferIndex = 30
 Dedicated Metal vertex buffer index for stage-in vertex data (see file comment).

Detailed Description

The deterministic Metal argument-table mapping shared by the MSL emitter and the Metal backend.

Both sides of the Metal path must agree on how RHI (group, binding) pairs map onto Metal's per-stage argument tables. This header is the single source of truth (design 0053 "Original emitters": all emitters consume the same binding metadata):

  • Uniform and storage buffer binding b -> [[buffer(1 + b)]].
  • Texture binding b -> [[texture(b)]].
  • Sampler binding b -> [[sampler(b)]].
  • Stage-in vertex data occupies the dedicated vertex buffer index 30 (the last slot of Metal's 0..30 vertex buffer argument table). The 1 + b mapping therefore supports RHI buffer bindings b in 0..28 only: b = 29 would land on the reserved index 30, and b >= 30 would exceed Metal's table. The MSL emitter and the Metal backend both fail closed for b >= 29; the solid-fill family uses b in 0..11.

Only bind group 0 exists in the solid-fill pipeline family; multi-group support would extend this map with a per-group base offset when a pipeline family needs it.

Function Documentation

◆ MslBufferIndex()

uint32_t donner::gpu::shader::MslBufferIndex ( uint32_t binding)
inlineconstexpr

Metal buffer argument-table index for an RHI buffer binding (uniform or storage).

Parameters
bindingRHI binding index within group 0.

◆ MslSamplerIndex()

uint32_t donner::gpu::shader::MslSamplerIndex ( uint32_t binding)
inlineconstexpr

Metal sampler argument-table index for an RHI sampler binding.

Parameters
bindingRHI binding index within group 0.

◆ MslTextureIndex()

uint32_t donner::gpu::shader::MslTextureIndex ( uint32_t binding)
inlineconstexpr

Metal texture argument-table index for an RHI texture binding.

Parameters
bindingRHI binding index within group 0.