How-to guide·Rendering

Configure the render backend

Choose the OpenGL or Vulkan render backend of an instance, let it render on a software Vulkan device where there is no GPU, enable vector exports, and fix UNIMPLEMENTED_ERROR and NO_3D_RENDERER.

For the administrator of an instance. Everything the server renders — the thumbnails of the tree, the screenshots the API returns, the snapshots in a BCF export, the images in a BRL report and the vector drawings — goes through its render backend. That backend is OpenGL by default; a Vulkan backend can run on a GPU or on a software device such as Mesa's lavapipe or SwiftShader, which run the same shaders on the CPU. An instance without a GPU then renders the same images, ten to fifty times slower. Vector exports need Vulkan in any case.

Before you start#

  • Access to the configuration of the node that executes render tasks, and a way to restart it: the backend is created at start-up, not on a configuration reload.
  • The container images ship the Mesa Vulkan drivers, which cover AMD and Intel GPUs and the CPU device in one package. Outside the images, install a Vulkan driver for the GPU, or lavapipe or SwiftShader for the CPU.

1. Choose the backend#

YAML#
rendering:
  type: local            # render on this node
  enabled: true          # false (default): nothing is rendered
  backend: opengl        # opengl (default) | vulkan | auto
  device_index: -1       # -1: automatic, discrete GPU first
  allow_software: false  # true: accept a CPU Vulkan device
  max_concurrent_renders: 0   # 0: min(4, gpus × 2), at least 1
  • type has no default: a rendering section without it is rejected. local is the kind these settings belong to. Without enabled: true the node renders nothing, and a render call answers NO_3D_RENDERER.
  • Which backend comes up also depends on resources.gpus. opengl needs a positive value; without one the node has no render backend.
  • vulkan is tried when resources.gpus is positive or allow_software is on. If Vulkan then does not come up, the node refuses to start and logs the cause; with neither, it starts without a render backend. auto tries Vulkan the same way and falls back to OpenGL with a warning, which again needs a positive resources.gpus.
  • The device is the first discrete GPU by default, or the one device_index names.
  • A CPU device is excluded unless allow_software is on, so a production instance never renders on the CPU by accident, with what would look like a mysterious slowdown. When it is on and no GPU is found, the server logs that it renders on a software device and carries on.

2. Give a CPU-only node render work#

Rendering tasks run on nodes that can render: a node with a positive resources.gpus, or one with backend: vulkan (or auto) and allow_software: true, which counts as one render slot. A CPU-only node therefore needs no resources.gpus value; leave it at 0, so the OpenGL backend stays off and the render concurrency is sized for a CPU device. A node that can do neither passes render requests to a fleet node with a GPU, and without one answers that a GPU is needed.

3. Enable vector exports#

Vector export (Export a vector drawing) is enabled by default (features.vector_svg; false switches it off), but its visibility pass needs the Vulkan backend. Merge these settings into the configuration of the node executing the export, keeping its other resource settings:

YAML#
rendering:
  type: local
  enabled: true
  backend: vulkan
resources:
  gpus: 1

On a CPU-only node, set rendering.allow_software: true instead of resources.gpus (the container images ship lavapipe; elsewhere install a software Vulkan device).

Restart the node. Its start-up log contains Render backend: with the selected Vulkan device.

If an export fails#

  • UNIMPLEMENTED_ERROR from ExportVectorSvg: the instance has switched vector export off. The response's error.userSafeMessage says "The vector_svg feature is not enabled on this instance". Remove features.vector_svg: false from the configuration, or set it to true.
  • NO_3D_RENDERER: the feature is enabled, but the node executing the task has no initialised Vulkan backend. Ordinary screenshots can work with the default opengl backend while vector exports fail, because their visibility pass requires Vulkan; backend: auto can fall back to OpenGL, which still cannot run the export. Set backend: vulkan (step 3) and restart.

Limits#

Very old or limited Vulkan devices are rejected. The speed difference of a software device is real: plan for it on an instance that renders many report images.

Check#

After the restart the log names the Vulkan device after Render backend:, and the demo on Render a screenshot on the server returns an image.

Since 3.0