Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
LinkedProjection.h File Reference

The one projection of each shader family a build links, and the view a device builds its shader module from. More...

Include dependency graph for LinkedProjection.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.

Macros

#define DONNER_LINKED_SHADER_ARTIFACT(family)
 Names the artifact of family this build links for its own devices: the platform-native projection (MSL on Apple platforms, SPIR-V on Linux) in a native build, and the authored WGSL in the WebAssembly package.
#define DONNER_LINKED_SHADER_SOURCE_KIND   Wgsl
 The ShaderSourceKind enumerator of the projection DONNER_LINKED_SHADER_ARTIFACT names in this build: Msl in a native Apple build, Spirv in a native Linux build, and Wgsl in every other build, the WebAssembly package among them.

Functions

const CompiledShaderView & donner::gpu::shader::SelectLinkedProjection (ShaderSourceKind deviceKind, const CompiledShaderView &linked)
 Selects the view a device that consumes deviceKind builds one family's module from, given the artifact of that family this build links.

Variables

constexpr ShaderSourceKind donner::gpu::shader::kLinkedShaderSourceKind
 Source kind of the artifacts DONNER_LINKED_SHADER_ARTIFACT names in this build.

Detailed Description

The one projection of each shader family a build links, and the view a device builds its shader module from.

Macro Definition Documentation

◆ DONNER_LINKED_SHADER_ARTIFACT

#define DONNER_LINKED_SHADER_ARTIFACT ( family)
Value:
(::donner::gpu::shader::programs::family##Shader())

Names the artifact of family this build links for its own devices: the platform-native projection (MSL on Apple platforms, SPIR-V on Linux) in a native build, and the authored WGSL in the WebAssembly package.

Production code names a family's artifact only through this macro and depends on the family through linked_shader_artifacts, so no build links a projection none of its devices consume. The caller includes the family's own program header.

Parameters
familyProgram name, as in SlugFill for SlugFillNativeShader and SlugFillShader.

◆ DONNER_LINKED_SHADER_SOURCE_KIND

#define DONNER_LINKED_SHADER_SOURCE_KIND   Wgsl

The ShaderSourceKind enumerator of the projection DONNER_LINKED_SHADER_ARTIFACT names in this build: Msl in a native Apple build, Spirv in a native Linux build, and Wgsl in every other build, the WebAssembly package among them.

It exists only to define kLinkedShaderSourceKind and is undefined right after, so no other code can name it.

Function Documentation

◆ SelectLinkedProjection()

const CompiledShaderView & donner::gpu::shader::SelectLinkedProjection ( ShaderSourceKind deviceKind,
const CompiledShaderView & linked )

Selects the view a device that consumes deviceKind builds one family's module from, given the artifact of that family this build links.

A Metal or Vulkan device in a native build, and the browser device in the WebAssembly package, consume the linked projection and receive linked. A device that consumes another projection exists only in tests, such as a recording device or the WebGPU reference on a native build: it receives the view a test-only library registered for linked through RegisterAlternateProjection (LinkedProjectionTesting.h, a test-only library, so no production target can register one). Without one it also receives linked, which carries nothing in its kind, so gpu::Device::createShaderModule refuses the empty descriptor rather than compiling nothing.

Callers that derive bindings, entry points or workgroup shapes from reflection may read them from linked: every projection of a family is compiled with one reflected interface.

Parameters
deviceKindSource kind the device consumes.
linkedThe family's artifact this build links.
Returns
The artifact view to build a shader module descriptor from.

Variable Documentation

◆ kLinkedShaderSourceKind

ShaderSourceKind donner::gpu::shader::kLinkedShaderSourceKind
inlineconstexpr
Initial value:
=
ShaderSourceKind::DONNER_LINKED_SHADER_SOURCE_KIND

Source kind of the artifacts DONNER_LINKED_SHADER_ARTIFACT names in this build.